asymptote: Debugger
14 Debugger
***********
Asymptote now includes a line-based (as opposed to code-based) debugger
that can assist the user in following flow control. To set a break
point in file 'file' at line 'line', use the command
void stop(string file, int line, code s=quote{});
The optional argument 's' may be used to conditionally set the variable
'ignore' in 'plain_debugger.asy' to 'true'. For example, the first 10
instances of this breakpoint will be ignored (the variable 'int count=0'
is defined in 'plain_debugger.asy'):
stop("test",2,quote{ignore=(++count <= 10);});
To set a break point in file 'file' at the first line containing the
string 'text', use
void stop(string file, string text, code s=quote{});
To list all breakpoints, use:
void breakpoints();
To clear a breakpoint, use:
void clear(string file, int line);
To clear all breakpoints, use:
void clear();
The following commands may be entered at the debugging prompt:
'h'
help;
'c'
continue execution;
'i'
step to the next instruction;
's'
step to the next executable line;
'n'
step to the next executable line in the current file;
'f'
step to the next file;
'r'
return to the file associated with the most recent breakpoint;
't'
toggle tracing ('-vvvvv') mode;
'q'
quit debugging and end execution;
'x'
exit the debugger and run to completion.
Arbitrary 'Asymptote' code may also be entered at the debugging prompt;
however, since the debugger is implemented with 'eval', currently only
top-level (global) variables can be displayed or modified.
The debugging prompt may be entered manually with the call
void breakpoint(code s=quote{});