document_category 100 concepts
concepts   - The concepts on which the Mercury debugger is based.
             The concepts for which documentation is available are
             `break_points', `strict_commands', `print_level',
             `default_print_level', `current_environment',
             and `procedure_specification'.

end
document_category 150 queries
queries    - Commands for invoking goals interactively.
             The commands for queries are
             `query', `cc_query', and `io_query'.

end
document_category 200 forward
forward    - Commands that move execution forward.
             The forward commands are `step', `goto', `next', `finish',
             `exception', `forward', `mindepth', `maxdepth' and `continue'.

end
document_category 300 backward
backward   - Commands that move execution backward.
             The only such command is `retry'.

end
document_category 400 browsing
browsing   - Commands that let users explore the state of the computation.
             The browsing commands are `vars', `print', `browse',
             `stack', `up', `down', `level', `current' and `view'.

end
document_category 500 breakpoint
breakpoint - Commands that let users set and control breakpoints.
             The breakpoint commands are `break', `disable', `enable',
             `delete', `modules', `procedures' and `register'.

end
document_category 600 table_io
table_io   - Commands that let users control the tabling of I/O actions.
             The only such command is `table_io'.

end
document_category 700 parameter
parameter  - Commands that let users access debugger parameters.
             The parameter commands are `set', `printlevel', `echo', `context',
             `scroll', `mmc_options', `scope', `alias' and `unalias'.

end
document_category 800 help
help       - Commands that let users access and control the help system.
             The help commands are `document_category', `document' and `help'.
             For help on the `help' command, type `help help help'.

end
document_category 900 misc
misc       - Commands that are of interest to most users but do not fit into
             other categories. The misc commands are `source', `save', `dd'
             and `quit'.

end
document_category 1000 exp
exp        - Commands that let users collect and inspect experimental
             data about the behavior of the program. The exp commands are
             `histogram_all', `histogram_exp', and `clear_histogram'.

end
document_category 1100 developer
developer  - Commands that are intended to be of use only to developers
             of the Mercury implementation. The developer commands are
             `flag', `subgoal', `consumer', `gen_stack', `cut_stack,
             `pneg_stack', `mm_stacks', `nondet_stack', `stack_regs',
             `all_regs', `debug_vars', `proc_stats', `label_stats',
             `var_name_stats', `print_optionals', `unhide_events', `dd_dd',
             `table', `type_ctor', `class_decl', `all_type_ctors' and
             `all_class_decls'.

end
document concepts 100 break_points
break_points
     The user may associate a break point with some events that occur
     inside a procedure; the invocation condition of the break point
     says which events these are.  The four possible invocation
     conditions (also called scopes) are:

        * the call event,

        * all interface events,

        * all events, and

        * the event at a specific point in the procedure.

     The effect of a break point depends on the state of the break
     point.

        * If the state of the break point is `stop', execution will
          stop and user interaction will start at any event within the
          procedure that matches the invocation conditions, unless the
          current debugger command has specifically disabled this
          behaviour (see the concept `strict commands' below).

        * If the state of the break point is `print', the debugger will
          print any event within the procedure that matches the
          invocation conditions, unless the current debugger command
          has specifically disabled this behaviour (see the concept
          `print level' below).

     Neither of these will happen if the break point is disabled.

end
document concepts 200 strict_commands
strict_commands
     When a debugger command steps over some events without user
     interaction at those events, the _strictness_ of the command
     controls whether the debugger will stop execution and resume user
     interaction at events to which a break point with state `stop'
     applies.  By default, the debugger will stop at such events.
     However, if the debugger is executing a strict command, it will
     not stop at an event just because a break point in the stop state
     applies to it.

     If the debugger receives an interrupt (e.g. if the user presses
     control-C), it will stop at the next event regardless of what
     command it is executing at the time.

end
document concepts 300 print_level
print_level
     When a debugger command steps over some events without user
     interaction at those events, the _print level_ controls under what
     circumstances the stepped over events will be printed.

        * When the print level is `none', none of the stepped over
          events will be printed.

        * When the print level is `all', all the stepped over events
          will be printed.

        * When the print level is `some', the debugger will print the
          event only if a break point applies to the event.

     Regardless of the print level, the debugger will print any event
     that causes execution to stop and user interaction to start.

end
document concepts 400 default_print_level
default_print_level
     The debugger maintains a default print level.  The initial value
     of this variable is `some', but this value can be overridden by
     the user.

end
document concepts 500 current_environment
current_environment
     Whenever execution stops at an event, the current environment is
     reset to refer to the stack frame of the call specified by the
     event.  However, the `up', `down' and `level' commands can set the
     current environment to refer to one of the ancestors of the
     current call.  This will then be the current environment until
     another of these commands changes the environment yet again or
     execution continues to another event.

end
document concepts 600 procedure_specification
procedure_specification
     Some debugger commands, e.g. `break', require a parameter that
     specifies a procedure.  Such a procedure specification has the
     following components in the following order:
        * An optional prefix of the form `pred*' or `func*' that
          specifies whether the procedure belongs to a predicate or a
          function.

        * An optional prefix of the form `MODULE:' or `MODULE__' that
          specifies the name of the module that defines the predicate
          or function to which the procedure belongs.

        * The name of the predicate or function to which the procedure
          belongs.

        * An optional suffix of the form `/ARITY' that specifies the
          arity of the predicate or function to which the procedure
          belongs.

        * An optional suffix of the form `-MODENUM' that specifies the
          mode number of the procedure within the predicate or function
          to which the procedure belongs.

end
document queries 100 query
query MODULE1 MODULE2 ...
    See help for `cc_query'.
end
document queries 200 cc_query
cc_query MODULE1 MODULE2 ...
    See help for `io_query'.
end
document queries 300 io_query
io_query MODULE1 MODULE2 ...
     These commands allow you to type in queries (goals) interactively
     in the debugger.  When you use one of these commands, the debugger
     will respond with a query prompt (`?-' or `run <--'), at which you
     can type in a goal; the debugger will the compile and execute the
     goal and display the answer(s).  You can return from the query
     prompt to the `mdb>' prompt by typing the end-of-file indicator
     (typically control-D or control-Z), or by typing `quit.'.

     The module names MODULE1, MODULE2, ... specify which modules will
     be imported.  Note that you can also add new modules to the list
     of imports directly at the query prompt, by using a command of the
     form `[MODULE]', e.g. `[int]'.  You need to import all the modules
     that define symbols used in your query.  Queries can only use
     symbols that are exported from a module; entities which are
     declared in a module's implementation section only cannot be used.

     The three variants differ in what kind of goals they allow.  For
     goals which perform I/O, you need to use `io_query'; this lets you
     type in the goal using DCG syntax.  For goals which don't do I/O,
     but which have determinism `cc_nondet' or `cc_multi', you need to
     use `cc_query'; this finds only one solution to the specified goal.
     For all other goals, you can use plain `query', which finds all
     the solutions to the goal.

     For `query' and `cc_query', the debugger will print out all the
     variables in the goal using `io__write'.  The goal must bind all
     of its variables to ground terms, otherwise you will get a mode
     error.

     The current implementation works by compiling the queries
     on-the-fly and then dynamically linking them into the program
     being debugged.  Thus it may take a little while for your query to
     be executed.  Each query will be written to a file named
     `mdb_query.m' in the current directory, so make sure you don't
     name your source file `mdb_query.m'.  Note that dynamic linking
     may not be supported on some systems; if you are using a system
     for which dynamic linking is not supported, you will get an error
     message when you try to run these commands.

     You may also need to build your program using shared libraries for
     interactive queries to work.  With Linux on the Intel x86
     architecture, the default is for executables to be statically
     linked, which means that dynamic linking won't work, and hence
     interactive queries won't work either (the error message is rather
     obscure: the dynamic linker complains about the symbol
     `__data_start' being undefined).  To build with shared libraries,
     you can use `MGNUCFLAGS=--pic-reg' and `MLFLAGS=--shared' in your
     Mmakefile.  See the `README.Linux' file in the Mercury
     distribution for more details.

end
document forward 100 step
step [-NSans] [NUM]
     Steps forward NUM events.  If this command is given at event CUR,
     continues execution until event CUR + NUM. The default value of
     NUM is 1.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is not strict, and it uses the default
     print level.

     A command line containing only a number NUM is interpreted as if
     it were `step NUM'.

     An empty command line is interpreted as `step 1'.

end
document forward 200 goto
goto [-NSans] NUM
     Continues execution until the program reaches event number NUM.
     If the current event number is larger than NUM, it reports an
     error.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 300 next
next [-NSans] [NUM]
     Continues execution until it reaches the next event of the NUM'th
     ancestor of the call to which the current event refers.  The
     default value of NUM is zero, which means skipping to the next
     event of the current call.  Reports an error if execution is
     already at the end of the specified call.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 400 finish
finish [-NSans] [NUM]
     Continues execution until it reaches a final (EXIT, FAIL or EXCP)
     port of the NUM'th ancestor of the call to which the current event
     refers.  The default value of NUM is zero, which means skipping to
     the end of the current call.  Reports an error if execution is
     already at the desired port.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 500 exception
exception [-NSans]
     Continues the program until execution reaches an exception event.
     Reports an error if the current event is already an exception
     event.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 600 return
return [-NSans]
     Continues the program until the program finished returning, i.e.
     until it reaches a port other than EXIT.  Reports an error if the
     current event already refers to such a port.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 700 forward
forward [-NSans]
     Continues the program until the program resumes forward execution,
     i.e. until it reaches a port other than REDO or FAIL.  Reports an
     error if the current event already refers to such a port.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 800 mindepth
mindepth [-NSans] DEPTH
     Continues the program until the program reaches an event whose
     depth is at least DEPTH.  Reports an error if the current event
     already refers to such a port.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 900 maxdepth
maxdepth [-NSans] DEPTH
     Continues the program until the program reaches an event whose
     depth is at most DEPTH.  Reports an error if the current event
     already refers to such a port.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is strict, and it uses the default print
     level.

end
document forward 1000 continue
continue [-NSans]
     Continues execution until it reaches the end of the program.

     The options `-n' or `--none', `-s' or `--some', `-a' or `--all'
     specify the print level to use for the duration of the command,
     while the options `-S' or `--strict' and `-N' or `--nostrict'
     specify the strictness of the command.

     By default, this command is not strict. The print level used by
     the command by default depends on the final strictness level: if
     the command is strict, it is `none', otherwise it is `some'.

end
document backward 100 retry
retry [-fio] [NUM]
     If the optional number is not given, restarts execution at the
     call port of the call corresponding to the current event.  If the
     optional number is given, restarts execution at the call port of
     the call corresponding to the NUM'th ancestor of the call to which
     the current event belongs.  For example, if NUM is 1, it restarts
     the parent of the current call.

     The command will report an error unless the values of all the
     input arguments of the selected call are available at the return
     site at which control would reenter the selected call.  (The
     compiler will keep the values of the input arguments of traced
     predicates as long as possible, but it cannot keep them beyond the
     point where they are destructively updated.)  The exception is
     values of type `io__state'; the debugger can perform a retry if
     the only missing value is of type `io__state' (there can be only
     one io__state at any given time).

     Retries over I/O actions are guaranteed to be safe only if the
     events at which the retry starts and ends are both within the I/O
     tabled region of the program's execution.  If the retry is not
     guaranteed to be safe, the debugger will normally ask the user if
     they really want to do this.  The option `-f' or `--force'
     suppresses the question, telling the debugger that retrying over
     I/O is OK; the option `-o' or `--only-if-safe' suppresses the
     question, telling the debugger that retrying over I/O is not OK;
     the option `-i' or `--interactive' restores the question if a
     previous option suppressed it.

end
document browsing 100 vars
vars
     Prints the names of all the known variables in the current
     environment, together with an ordinal number for each variable.

end
document browsing 200 print
print [-fpv] NAME
print [-fpv] NUM
     Prints the value of the variable in the current environment with
     the given name, or with the given ordinal number.  This is a
     non-interactive version of the `browse' command (see below).
     Various settings which affect the way that terms are printed out
     (including e.g. the maximum term depth) can be set using the `set'
     command.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for printing.

print [-fpv] *
     Prints the values of all the known variables in the current
     environment.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for printing.

print [-fpv]

print [-fpv] goal
     Prints the goal of the current call in its present state of
     instantiation.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for printing.

print [-fpv] exception
     Prints the value of the exception at an EXCP port.  Reports an
     error if the current event does not refer to such a port.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for printing.

print [-fpv] action NUM
     Prints a representation of the NUM'th I/O action executed by the
     program.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for printing.

end
document browsing 300 browse
browse [-fpv] NAME
browse [-fpv] NUM
     Invokes an interactive term browser to browse the value of the
     variable in the current environment with the given ordinal number
     or with the given name.

     The interactive term browser allows you to selectively examine
     particular subterms.  The depth and size of printed terms may be
     controlled.  The displayed terms may also be clipped to fit within
     a single screen.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for browsing.

     For further documentation on the interactive term browser, invoke
     the `browse' command from within `mdb' and then type `help' at the
     `browser>' prompt.

browse [-fpv]

browse [-fpv] goal
     Invokes the interactive term browser to browse the goal of the
     current call in its present state of instantiation.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for browsing.

browse [-fpv] exception
     Invokes the interactive term browser to browse the value of the
     exception at an EXCP port.  Reports an error if the current event
     does not refer to such a port.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for browsing.

browse [-fpv] action NUM
     Invokes an interactive term browser to browse a representation of
     the NUM'th I/O action executed by the program.

     The options `-f' or `--flat', `-p' or `--pretty', and `-v' or
     `--verbose' specify the format to use for browsing.

end
document browsing 400 stack
stack [-d] [NUM]
     Prints the names of the ancestors of the call specified by the
     current event.  If two or more ancestor calls are for the same
     procedure, the procedure identification will be printed once with
     the appropriate multiplicity annotation.

     The option `-d' or `--detailed' specifies that for each ancestor
     call, the call's event number, sequence number and depth should
     also be printed if the call is to a procedure that is being
     execution traced.

     The optional number, if present, specifies that only the topmost
     NUM stack frames should be printed.

     This command will report an error if there is no stack trace
     information available about any ancestor.

end
document browsing 500 up
up [-d] [NUM]
     Sets the current environment to the stack frame of the NUM'th
     level ancestor of the current environment (the immediate caller is
     the first-level ancestor).

     If NUM is not specified, the default value is one.

     This command will report an error if the current environment
     doesn't have the required number of ancestors, or if there is no
     execution trace information about the requested ancestor, or if
     there is no stack trace information about any of the ancestors
     between the current environment and the requested ancestor.

     The option `-d' or `--detailed' specifies that for each ancestor
     call, the call's event number, sequence number and depth should
     also be printed if the call is to a procedure that is being
     execution traced.

end
document browsing 600 down
down [-d] [NUM]
     Sets the current environment to the stack frame of the NUM'th
     level descendant of the current environment (the procedure called
     by the current environment is the first-level descendant).

     If NUM is not specified, the default value is one.

     This command will report an error if there is no execution trace
     information about the requested descendant.

     The option `-d' or `--detailed' specifies that for each ancestor
     call, the call's event number, sequence number and depth should
     also be printed if the call is to a procedure that is being
     execution traced.

end
document browsing 700 level
level [-d] [NUM]
     Sets the current environment to the stack frame of the NUM'th
     level ancestor of the call to which the current event belongs.
     The zero'th ancestor is the call of the event itself.

     This command will report an error if the current environment
     doesn't have the required number of ancestors, or if there is no
     execution trace information about the requested ancestor, or if
     there is no stack trace information about any of the ancestors
     between the current environment and the requested ancestor.

     The option `-d' or `--detailed' specifies that for each ancestor
     call, the call's event number, sequence number and depth should
     also be printed if the call is to a procedure that is being
     execution traced.

end
document browsing 800 current
current
     Prints the current event.  This is useful if the details of the
     event, which were printed when control arrived at the event, have
     since scrolled off the screen.

end
document browsing 900 set
set [-APBfpv] PARAM VALUE
     Updates the configuration parameters of the browser.  The
     parameters that can be configured are `format', `depth', `size',
     `width' and `lines'.

        * `format' can be set to `flat', `pretty' or `verbose' to
          change the output style of the browser.

        * `depth' is the maximum depth to which subterms will be
          displayed.  Subterms at the depth limit may be abbreviated as
          functor/arity, or (in lists) may be replaced by an ellipsis
          (`...').  The principal functor of any term has depth zero.
          For subterms which are not lists, the depth of any argument
          of the functor is one greater than the depth of the functor.
          For subterms which are lists, the depth of each element of
          the list is one greater than the depth of the list.

        * `size' is the suggested maximum number of functors to display.
          Beyond this limit, subterms may be abbreviated as
          functor/arity, or (in lists) may be replaced by an ellipsis
          (`...').  For the purposes of this parameter, the size of a
          list is one greater than the sum of the sizes of the elements
          in the list.

        * `width' is the width of the screen in characters.

        * `lines' is the maximum number of lines of one term to display.

     The browser maintains separate configuration parameters for the
     three commands `print *', `print VAR', and `browse VAR'.  A single
     `set' command can modify the parameters for more than one of these;
     the options `-A' or `--print-all', `-P' or `--print', and `-B' or
     `--browse' select which commands will be affected by the change.
     If none of these options is given, the default is to affect all
     commands.

     The browser also maintains separate configuration parameters for
     the three different output formats.  This applies to all
     parameters except for the format itself.  The options `-f' or
     `--flat', `-p' or `--pretty', and `-v' or `--verbose' select which
     formats will be affected by the change.  If none of these options
     is given, the default is to affect all formats.  In the case that
     the format itself is being set, these options are ignored.

end
document browsing 1000 view
view [-vf2] [-w WINDOW-CMD] [-s SERVER-CMD] [-n SERVER-NAME] [-t TIMEOUT]
view -c [-v] [-s SERVER-CMD] [-n SERVER-NAME]
     Opens a new window displaying the source code, at the location of
     the current event.  As mdb stops at new events, the window is
     updated to track through the source code.  This requires X11 and a
     version of `vim' compiled with the client/server option enabled.

     The debugger only updates one window at a time.  If you try to
     open a new source window when there is already one open, this
     command aborts with an error message.

     The variant with `-c' (or `--close') does not open a new window
     but instead attempts to close a currently open source window.  The
     attempt may fail if, for example, the user has modified the source
     file without saving.

     The option `-v' (or `--verbose') prints the underlying system
     calls before running them, and prints any output the calls
     produced.  This is useful to find out what is wrong if the server
     does not start.

     The option `-f' (or `--force') stops the command from aborting if
     there is already a window open.  Instead it attempts to close that
     window first.

     The option `-2' (or `--split-screen') starts the vim server with
     two windows, which allows both the callee as well as the caller to
     be displayed at interface events.  The lower window shows what
     would normally be seen if the split-screen option was not used,
     which at interface events is the caller.  At these events, the
     upper window shows the callee definition.  At internal events, the
     lower window shows the associated source, and the view in the
     upper window (which is not interesting at these events) remains
     unchanged.

     The option `-w' (or `--window-command') specifies the command to
     open a new window.  The default is `xterm -e'.

     The option `-s' (or `--server-command') specifies the command to
     start the server.  The default is `vim'.

     The option `-n' (or `--server-name') specifies the name of an
     existing server.  Instead of starting up a new server, mdb will
     attempt to connect to the existing one.

     The option `-t' (or `--timeout') specifies the maximum number of
     seconds to wait for the server to start.

end
document breakpoint 100 break
break [-PS] [-EIGNORE-COUNT] [-IIGNORE-COUNT] FILENAME:LINENUMBER
     Puts a break point on the specified line of the specified source
     file, if there is an event or a call at that position.  If the
     filename is omitted, it defaults to the filename from the context
     of the current event.

     The options `-P' or `--print', and `-S' or `--stop' specify the
     action to be taken at the break point.

     The options `-EIGNORE-COUNT' and `--ignore-entry IGNORE-COUNT'
     tell the debugger to ignore the breakpoint until after
     IGNORE-COUNT occurrences of a call event that matches the
     breakpoint.  The options `-IIGNORE-COUNT' and `--ignore-interface
     IGNORE-COUNT' tell the debugger to ignore the breakpoint until
     after IGNORE-COUNT occurrences of interface events that match the
     breakpoint.

     By default, the initial state of the break point is `stop', and
     the ignore count is zero.

break [-AOPSaei] [-EIGNORE-COUNT] [-IIGNORE-COUNT] PROC-SPEC
     Puts a break point on the specified procedure.

     The options `-A' or `--select-all', and `-O' or `--select-one'
     select the action to be taken if the specification matches more
     than one procedure.  If you have specified option `-A' or
     `--select-all', mdb will put a breakpoint on all matched
     procedures, whereas if you have specified option `-O' or
     `--select-one', mdb will report an error.  By default, mdb will
     ask you whether you want to put a breakpoint on all matched
     procedures or just one, and if so, which one.

     The options `-P' or `--print', and `-S' or `--stop' specify the
     action to be taken at the break point.

     The options `-a' or `--all', `-e' or `--entry', and `-i' or
     `--interface' specify the invocation conditions of the break point.
     If none of these options are specified, the default is the one
     indicated by the current scope (see the `scope' command below).
     The initial scope is `interface'.

     The options `-EIGNORE-COUNT' and `--ignore-entry IGNORE-COUNT'
     tell the debugger to ignore the breakpoint until after
     IGNORE-COUNT occurrences of a call event that matches the
     breakpoint.  The options `-IIGNORE-COUNT' and `--ignore-interface
     IGNORE-COUNT' tell the debugger to ignore the breakpoint until
     after IGNORE-COUNT occurrences of interface events that match the
     breakpoint.

     By default, the action of the break point is `stop', its
     invocation condition is `interface', and the ignore count is zero.

break [-PS] [-EIGNORE-COUNT] [-IIGNORE-COUNT] here
     Puts a break point on the procedure referred to by the current
     event, with the invocation condition being the event at the
     current location in the procedure body.

     The options `-P' or `--print', and `-S' or `--stop' specify the
     action to be taken at the break point.

     The options `-EIGNORE-COUNT' and `--ignore-entry IGNORE-COUNT'
     tell the debugger to ignore the breakpoint until after
     IGNORE-COUNT occurrences of a call event that matches the
     breakpoint.  The options `-IIGNORE-COUNT' and `--ignore-interface
     IGNORE-COUNT' tell the debugger to ignore the breakpoint until
     after IGNORE-COUNT occurrences of interface events that match the
     breakpoint.

     By default, the initial state of the break point is `stop', and
     the ignore count is zero.

break info
     Lists the details and status of all break points.

end
document breakpoint 200 ignore
ignore [-EIGNORE-COUNT] [-IIGNORE-COUNT] NUM

     The options `-EIGNORE-COUNT' and `--ignore-entry IGNORE-COUNT'
     tell the debugger to ignore the breakpoint until after
     IGNORE-COUNT occurrences of a call event that matches the
     breakpoint with the specified number.  The options `-IIGNORE-COUNT'
     and `--ignore-interface IGNORE-COUNT' tell the debugger to ignore
     the breakpoint until after IGNORE-COUNT occurrences of interface
     events that match the breakpoint with the specified number.  If
     neither option is given, the default is to ignore one call event
     that matches the breakpoint with the specified number.  Reports an
     error if there is no break point with the specified number.

ignore [-EIGNORE-COUNT] [-IIGNORE-COUNT]

     The options `-EIGNORE-COUNT' and `--ignore-entry IGNORE-COUNT'
     tell the debugger to ignore the breakpoint until after
     IGNORE-COUNT occurrences of a call event that matches the most
     recently added breakpoint.  The options `-IIGNORE-COUNT' and
     `--ignore-interface IGNORE-COUNT' tell the debugger to ignore the
     breakpoint until after IGNORE-COUNT occurrences of interface events
     that match the most recently added breakpoint.  If neither option
     is given, the default is to ignore one call event that matches the
     most recently added breakpoint.  Reports an error if the most
     recently added breakpoint has since been deleted.

end
document breakpoint 300 disable
disable NUM
     Disables the break point with the given number.  Reports an error
     if there is no break point with that number.

disable *
     Disables all break points.

disable
     Disables the most recently added breakpoint.  Reports an error if
     the most recently added breakpoint has since been deleted.

end
document breakpoint 400 enable
enable NUM
     Enables the break point with the given number.  Reports an error
     if there is no break point with that number.

enable *
     Enables all break points.

enable
     Enables the most recently added breakpoint.  Reports an error if
     the most recently added breakpoint has since been deleted.

end
document breakpoint 500 delete
delete NUM
     Deletes the break point with the given number.  Reports an error
     if there is no break point with that number.

delete *
     Deletes all break points.

delete
     Deletes the most recently added breakpoint.  Reports an error if
     the most recently added breakpoint has already been deleted.

end
document breakpoint 600 modules
modules
     Lists all the debuggable modules (i.e. modules that have debugging
     information).

end
document breakpoint 700 procedures
procedures MODULE
     Lists all the procedures in the debuggable module MODULE.

end
document breakpoint 800 register
register
     Registers all debuggable modules with the debugger.  Has no effect
     if this registration has already been done.  The debugger will
     perform this registration when creating breakpoints and when
     listing debuggable modules and/or procedures.

end
document table_io 100 table_io
table_io
     Reports which phase of I/O tabling we are in at the moment.

table_io start
     Tells the debugger to start tabling I/O actions.

table_io stop
     Tells the debugger to stop tabling I/O actions.

table_io stats
     Reports statistics about I/O tabling.

end
document parameter 100 mmc_options
mmc_options OPTION1 OPTION2 ...
     This command sets the options that will be passed to `mmc' to
     compile your query when you use one of the query commands:
     `query', `cc_query', or `io_query'.  For example, if a query
     results in a compile error, it may sometimes be helpful to use
     `mmc_options --verbose-error-messages'.

end
document parameter 200 printlevel
printlevel none
     Sets the default print level to `none'.

printlevel some
     Sets the default print level to `some'.

printlevel all
     Sets the default print level to `all'.

printlevel
     Reports the current default print level.

end
document parameter 300 echo
echo on
     Turns on the echoing of commands.

echo off
     Turns off the echoing of commands.

echo
     Reports whether commands are being echoed or not.

end
document parameter 400 scroll
scroll on
     Turns on user control over the scrolling of sequences of event
     reports.  This means that every screenful of event reports will be
     followed by a `--more--' prompt.  You may type an empty line,
     which allows the debugger to continue to print the next screenful
     of event reports.  By typing a line that starts with `a', `s' or
     `n', you can override the print level of the current command,
     setting it to `all', `some' or `none' respectively.  By typing a
     line that starts with `q', you can abort the current debugger
     command and get back control at the next event.

scroll off
     Turns off user control over the scrolling of sequences of event
     reports.

scroll SIZE
     Sets the scroll window size to SIZE, which tells scroll control to
     stop and print a `--more--' prompt after every SIZE - 1 events.
     The default value of SIZE is the value of the `LINES' environment
     variable, which should correspond to the number of lines available
     on the terminal.

scroll
     Reports whether user scroll control is enabled and what the window
     size is.

end
document parameter 500 context
context none
     When reporting events or ancestor levels, does not print contexts
     (filename/line number pairs).

context before
     When reporting events or ancestor levels, prints contexts
     (filename/line number pairs) before the identification of the
     event or call to which they refer, on the same line.  With long
     fully qualified predicate and function names, this may make the
     line wrap around.

context after
     When reporting events or ancestor levels, prints contexts
     (filename/line number pairs) after the identification of the event
     or call to which they refer, on the same line.  With long fully
     qualified predicate and function names, this may make the line
     wrap around.

context prevline
     When reporting events or ancestor levels, prints contexts
     (filename/line number pairs) on a separate line before the
     identification of the event or call to which they refer.

context nextline
     When reporting events or ancestor levels, prints contexts
     (filename/line number pairs) on a separate line after the
     identification of the event or call to which they refer.

context
     Reports where contexts are being printed.

end
document parameter 600 scope
scope all
     Sets the default scope of new breakpoints to "all", i.e. by
     default, new breakpoints on procedures will stop at all events in
     the procedure.

scope interface
     Sets the default scope of new breakpoints to "interface", i.e. by
     default, new breakpoints on procedures will stop at all interface
     events in the procedure.

scope entry
     Sets the default scope of new breakpoints to "entry", i.e. by
     default, new breakpoints on procedures will stop only at events
     representing calls to the procedure.

scope
     Reports the current default scope of new breakpoints.

end
document parameter 700 alias
alias NAME COMMAND [COMMAND-PARAMETER ...]
     Introduces NAME as an alias for the given command with the given
     parameters.  Whenever a command line has NAME as its first word,
     the debugger will substitute the given command and parameters for
     this word before executing the command line.

     If NAME is the upper-case word `EMPTY', the debugger will
     substitute the given command and parameters whenever the user
     types in an empty command line.

     If NAME is the upper-case word `NUMBER', the debugger will insert
     the given command and parameters before the command line whenever
     the user types in a command line that consists of a single number.

end
document parameter 800 unalias
unalias NAME
     Removes any existing alias for NAME.

end
document help 100 document_category
document_category SLOT CATEGORY
     Create a new category of help items, named CATEGORY.  The summary
     text for the category is given by the lines following this command,
     up to but not including a line containing only the lower-case word
     `end'.  The list of category summaries printed in response to the
     command `help' is ordered on the integer SLOT numbers of the
     categories involved.

end
document help 200 document
document CATEGORY SLOT ITEM
     Create a new help item named ITEM in the help category CATEGORY.
     The text for the help item is given by the lines following this
     command, up to but not including a line containing only the
     lower-case word `end'.  The list of items printed in response to
     the command `help CATEGORY' is ordered on the integer SLOT numbers
     of the items involved.

end
document help 300 help
help CATEGORY ITEM
     Prints help text about the item ITEM in category CATEGORY.

help WORD
     Prints help text about WORD, which may be the name of a help
     category or a help item.

help
     Prints summary information about all the available help categories.

end
document misc 100 source
source [-i] FILENAME
     Executes the commands in the file named FILENAME.

     The option `-i' or `--ignore-errors' tells `mdb' not to complain
     if the named file does not exist or is not readable.

end
document misc 200 save
save FILENAME
     Saves current set of breakpoints and the current set of aliases in
     the named file as a set of `break' and `alias' commands.  Sourcing
     the file will recreate the current breakpoints and aliases.

end
document misc 300 dd
dd
     Starts declarative debugging using the current event as the
     initial symptom.  For details, see *Note Declarative debugging::.

end
document misc 400 quit
quit [-y]
     Quits the debugger and aborts the execution of the program.  If
     the option `-y' is not present, asks for confirmation first.  Any
     answer starting with `y', or end-of-file, is considered
     confirmation.

     End-of-file on the debugger's input is considered a quit command.

end
document exp 100 histogram_all
histogram_all FILENAME
     Prints (to file FILENAME) a histogram that counts all events at
     various depths since the start of the program.  This histogram is
     available only in some experimental versions of the Mercury
     runtime system.

end
document exp 200 histogram_exp
histogram_exp FILENAME
     Prints (to file FILENAME) a histogram that counts all events at
     various depths since the start of the program or since the
     histogram was last cleared.  This histogram is available only in
     some experimental versions of the Mercury runtime system.

end
document exp 300 clear_histogram
clear_histogram
     Clears the histogram printed by `histogram_exp', i.e. sets the
     counts for all depths to zero.

end
document developer 100 flag
flag FLAGNAME
     Prints the value of the specified runtime lowlevel debugging flag.

flag FLAGNAME on
     Sets the specified runtime lowlevel debugging flag to true.

flag FLAGNAME off
     Sets the specified runtime lowlevel debugging flag to false.

end
document developer 200 subgoal
subgoal N
     In minimal model grades, prints the details of the specified
     subgoal.  In other grades, it reports an error.

end
document developer 300 consumer
consumer N
     In minimal model grades, prints the details of the specified
     consumer.  In other grades, it reports an error.

end
document developer 400 gen_stack
gen_stack
     In minimal model grades, prints the contents of the frames on the
     generator stack.  In other grades, it reports an error.

end
document developer 500 cut_stack
cut_stack
     In minimal model grades, prints the contents of the frames on the
     cut stack.  In other grades, it reports an error.

end
document developer 600 pneg_stack
pneg_stack
     In minimal model grades, prints the contents of the frames on the
     possible negated context stack.  In other grades, it reports an
     error.

end
document developer 700 mm_stacks
mm_stacks
     In minimal model grades, prints the contents of the frames on the
     generator stack, the cut stack and the possible negated context
     stack.  In other grades, it reports an error.

end
document developer 800 nondet_stack
nondet_stack [-d] [NUM]
     Prints the contents of the frames on the nondet stack.  By
     default, it prints only of the fixed slots in each nondet stack
     frame, but if the option `-d' or `--detailed' option is given, it
     will also print the names and values of the live variables in them.

     The optional number, if present, specifies that only the topmost
     NUM stack frames should be printed.

end
document developer 900 stack_regs
stack_regs
     Prints the contents of the virtual machine registers that point to
     the det and nondet stacks.

end
document developer 1000 all_regs
all_regs
     Prints the contents of all the virtual machine registers.

end
document developer 1100 debug_vars
debug_vars
     Prints the values of the variables used by the debugger to record
     event numbers, call sequence numbers and call depths.

end
document developer 1200 proc_stats
proc_stats
     Prints statistics about proc layout structures in the program.

proc_stats FILENAME
     Prints statistics about proc layout structures in the program to
     the file FILENAME.

end
document developer 1300 label_stats
label_stats
     Prints statistics about label layout structures in the program.

label_stats FILENAME
     Prints statistics about label layout structures in the program to
     the file FILENAME.

end
document developer 1400 var_name_stats
var_name_stats
     Prints statistics about the memory requirements of variable names
     in the layout structures in the program.

var_name_stats FILENAME
     Prints statistics about the memory requirements of variable names
     in the layout structures in the program to the file FILENAME.

end
document developer 1500 print_optionals
print_optionals
     Reports whether optionally-printed values such as typeinfos that
     are usually of interest only to implementors are being printed or
     not.

print_optionals on
     Tells the debugger to print optionally-printed values.

print_optionals off
     Tells the debugger not to print optionally-printed values.

end
document developer 1600 unhide_events
unhide_events
     Reports whether events that are normally hidden (that are usually
     of interest only to implementors) are being exposed or not.

unhide_events on
     Tells the debugger to expose events that are normally hidden.

unhide_events off
     Tells the debugger to hide events that are normally hidden.

end
document developer 1700 dd_dd
dd_dd
     Starts declarative debugging using the current event as the
     initial symptom, but unlike the standard `dd' command, does not
     turn off the events generated by the declarative debugger itself.
     This makes it possible to debug the declarative debugger itself.

end
document developer 1800 table
table PROC [NUM1 ...]
     Tells the debugger to print the call table of the named procedure,
     together with the saved answer (if any) for each call.  Reports an
     error if the named procedure isn't tabled.

     For now, this command is supported only for procedures whose
     arguments are all either integers, floats or strings.

     If the user specifies one or more integers on the command line,
     the output is restricted to the entries in the call table in which
     the Nth argument is equal to the Nth number on the command line.

end
document developer 1900 type_ctor
type_ctor [-fr] MODULENAME TYPECTORNAME ARITY
     Tests whether there is a type constructor defined in the given
     module, with the given name, and with the given arity.  If there
     isn't, it prints a message to that effect.  If there is, it echoes
     the identity of the type constructor.

     If the option `-r' or `--print-rep' option is given, it also
     prints the name of the type representation scheme used by the type
     constructor (known as its `type_ctor_rep' in the implementation).

     If the option `-f' or `--print-functors' option is given, it also
     prints the names and arities of function symbols defined by type
     constructor.

end
document developer 2000 all_type_ctors
all_type_ctors [-fr] [MODULENAME]
     If the user specifies a module name, lists all the type
     constructors defined in the given module.  If the user doesn't
     specify a module name, lists all the type constructors defined in
     the whole program.

     If the option `-r' or `--print-rep' option is given, it also
     prints the name of the type representation scheme of each type
     constructor (known as its `type_ctor_rep' in the implementation).

     If the option `-f' or `--print-functors' option is given, it also
     prints the names and arities of function symbols defined by each
     type constructor.

end
document developer 2100 class_decl
class_decl [-im] MODULENAME TYPECLASSNAME ARITY
     Tests whether there is a type class defined in the given module,
     with the given name, and with the given arity.  If there isn't, it
     prints a message to that effect.  If there is, it echoes the
     identity of the type class.

     If the option `-m' or `--print-methods' option is given, it also
     lists all the methods of the type class.

     If the option `-i' or `--print-instance' option is given, it also
     lists all the instances of the type class.

end
document developer 2200 all_class_decls
all_class_decls [-im] [MODULENAME]
     If the user specifies a module name, lists all the type classes
     defined in the given module.  If the user doesn't specify a module
     name, lists all the type classes defined in the whole program.

     If the option `-m' or `--print-methods' option is given, it also
     lists all the methods of each type class.

     If the option `-i' or `--print-instance' option is given, it also
     lists all the instances of each type class.

end
