Google

Go to the first, previous, next, last section, table of contents.


Debugger commands

Only indispensable commands of dbx are supported in the current version. Generally, the effect of a command is the same as that of dbx. There are, however, slight differences: Commands step and next execute the next statement, but not the next line; therefore, if there are multiple statements in one line, one should issue such commands several times to proceed the next line. The debugger reads in `.dbxinit', which allows the same aliases as is used in dbx.

step
Executes the next statement; if the next statement contains a function call, then enters the function.
next
Executes the next statement.
finish
Enter the debug-mode again after finishing the execuction of the current function. This is useful when an unnecessary step has been executed.
cont
quit
Exits from the debug-mode and continues execution.
up [n]
Move up the call stack one level. Move up the call stack n levels if n is specified.
down [n]
Move down the call stack one level. Move down the call stack n levels if n is specified.
frame [n]
Print the current stack frame with no argument. n specifies the stack frame number to be selected. Here the stack frame number is a number at the top of lines displayed by executing where.
list [startline]
list function
Displays ten lines in a source file from startline, the current line if the startline is not specified, or from the top line of current target function.
print expr
Displays expr.
func function
Set the target function to function.
stop at sourceline [if cond]
stop in function
Set a break-point at the sourceline-th line of the source file, or at the top of the target function. Break-points are removed whenever the relevant function is redefined. When if statements are repeatedly encountered, Asir enters debug-mode only when the corresponding cond parts are evaluated to a non-zero value.
trace expr at sourceline [if cond]
trace expr in function
These are similar to stop. trace simply displays the value of expr and without entering the debug-mode.
delete n
Remove the break point specified by a number n, which can be known by the status command.
status
Displays a list of the break-points.
where
Displays the calling sequence of functions from the top level through the current level.
alias alias command
Create an alias alias for command

The debugger command print can take almost all expressions as its argument. The ordinary usage is to print the values of (programming) variables. However, the following usage is worth to remember.

  • overwriting the variable One might sometimes wish to continue the execution with several values of variables modified. For such an purpose, take the following procedure.
    (debug) print A
    A = 2
    (debug) print A=1
    A=1 = 1
    (debug) print A
    A = 1
    
  • function call A function call is also an expression, therefore, it can appear at the argument place of print.
    (debug) print length(List)
    length(List) = 14
    
    In this example, the length of the list assigned to the variable List is examined by a function length().
    (debug) print ctrl("cputime",1)
    ctrl("cputime",1) = 1
    
    This example shows such a usage where measuring CPU time is activated from within the debug-mode, even if one might have forgotten to specify the activation of CPU time measurement. It is also useful to save intermediate results to files from within the debug-mode by the built-in function bsave() when one is forced to quit the computation by any reason.
    (debug) print bsave(A,"savefile")
    bsave(A,"savefile") = 1
    
    Note that continuation of the parent function will be impossible if an error will occur in the function call from within the debug-mode.


Go to the first, previous, next, last section, table of contents.