Previous: Experimental commands, Up: Debugger commands [Contents][Index]
The following commands are intended for use by the developers of the Mercury implementation.
var_details
Prints all the information the debugger has about all the variables at the current program point.
flag
Prints the values of all the runtime low-level debugging flags.
flag flagname
Prints the value of the specified runtime low-level debugging flag.
flag flagname on
Sets the specified runtime low-level debugging flag to true.
flag flagname off
Sets the specified runtime low-level debugging flag to false.
subgoal n
In minimal model grades, prints the details of the specified subgoal. In other grades, it reports an error.
consumer n
In minimal model grades, prints the details of the specified consumer. In other grades, it reports an error.
gen_stack
In minimal model grades, prints the contents of the frames on the generator stack. In other grades, it reports an error.
cut_stack
In minimal model grades, prints the contents of the frames on the cut stack. In other grades, it reports an error.
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.
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.
nondet_stack [-d] [-fnumframes] [numlines]
Prints the contents of the frames on the nondet stack. By default, it prints only the fixed slots in each nondet stack frame, but if the ‘-d’ or ‘--detailed’ option is given, it will also print the names and values of the live variables in them.
The ‘-f’ option, if present, specifies that only the topmost numframes stack frames should be printed.
The optional number numlines, if present, specifies that only the topmost numlines lines should be printed.
stack_regs
Prints the contents of the virtual machine registers that point to the det and nondet stacks.
all_regs
Prints the contents of all the virtual machine registers.
debug_vars
Prints the values of the variables used by the debugger to record event numbers, call sequence numbers and call depths.
stats [-f filename] subject
Prints statistics about the given subject to standard output, unless the ‘-f’ or ‘--filename’ option is given, in which case it prints the statistic to filename.
subject can be ‘procs’, which asks for statistics about proc layout structures in the program.
subject can be ‘labels’, which asks for statistics about label layout structures in the program.
subject can be ‘var_names’, which asks for statistics about the space occupied by variable names in the layout structures in the program.
subject can be ‘io_tabling’, which asks for statistics about the number of times each predicate appears in the I/O action table.
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.
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.
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.
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.
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.
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.
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.
all_procedures [-su] [-m modulename] filename
In the absence of the ‘-m’ or ‘--module’ option, puts a list of all the debuggable procedures in the program into the named file. In the presence of the ‘-m’ or ‘--module’ option, puts a list of all the debuggable procedures in the names module into the named file.
If the ‘-s’ or ‘--separate’ option is given, the various components of procedure names are separated by spaces.
If the ‘-u’ or ‘--uci’ option is given, the list will include the procedures of compiler generated unify, compare, index and initialization predicates. Normally, the list includes the procedures of only user defined predicates.
ambiguity [-o filename] [-ptfbs] [modulename …]
Print ambiguous procedure, type constructor and/or function symbol names. A procedure name is ambiguous if a predicate or function is defined with that name in more than one module or with more than one arity. A type constructor name is ambiguous if a type constructor is defined with that name in more than one module or with more than one arity. A function symbol name is ambiguous if a function symbol is defined with that name in more than one module or with more than one arity.
If any module names are given, then only those modules are consulted, (any ambiguities involving predicates, functions and type constructors in non-listed modules are ignored). The module names have to be fully qualified, if a module child is a submodule of module parent, the module name list must include parent.child; listing just child won’t work, since that is not a fully qualified module name.
If the ‘-o’ or ‘--outputfile’ option is given, the output goes to the file named as the argument of the option; otherwise, it goes to standard output.
If given one or more of the ‘-p’, ‘-t’ and ‘-f’ options, or their long equivalents ‘--procedures’, ‘--types’, and ‘--functors’, this command prints ambiguities only for the indicated kinds of constructs. The default is to print ambiguities for all these three kinds of constructs.
This command does not normally report two kinds of ambiguities among procedures.
First, this command does not usually report
operations that have both function and predicate forms,
with the predicate version having a (usually output) argument
in place of the function’s return value.
An example is list.length
being both a function with arity one
and a predicate with arity two.
The reason for not reporting this by default is that
this is usually an intended ambiguity,
and this command is usually used to find unintended ambiguities,
so that they can be eliminated by renaming.
However, users can ask for these ambiguities to be printed
by specifying either the option ‘-b’,
or its long form ‘--both-pred-and-func’.
Second, this command does not usually report ambiguities involving procedures that were created by the compiler as a type specialized version of another procedure. The reason for not reporting this by default is that ambiguities among the names of type specialized procedures cannot arise without ambiguities among the names of the original, not-yet-type-specialized procedures, and eliminating the ambiguities among the original names will perforce eliminate the ambiguities among the specialized names as well. However, users can ask for these ambiguities to be printed by specifying either the option ‘-s’, or its long form ‘--typespec’.
trail_details
In grades that specify trailing, prints out low-level details of the state of the trail. In other grades, it reports an error.
Previous: Experimental commands, Up: Debugger commands [Contents][Index]