Previous Up Next

15.4  Starting the Debugger

Several methods can be used to switch the debugger on. If the textual interactive top-level is used, the commands trace/0 and debug/0 are used to switch the debugger on for the following queries typed from the top-level. trace/0 will switch the debugger to creep mode whereas debug/0 will switch it in leap mode.

For the TkECLiPSe graphical toplevel, the debugger may be switched on by starting the tracer from the Tools menu before executing the query. This puts the debugger in creep mode.

When the debugger is in creep mode, it will prompt for a command at the crossing of the first port of a leashed procedure. When the debugger is in leap mode, it will prompt for a command at the first port of a leashed procedure that has a spy point. The debugger is switched off either from the toplevel with the commands nodebug/0 or notrace/0, or by typing n or N to the debugger prompt.

A spy point can be set on a procedure, or a breakpoint on a specific call, using spy/1 (which will also switch the debugger to leap) and removed with nospy/1. They both accept a SpecList as argument. Note that set_flag/3 can be used to set and reset spy points without switching the debugger on and without printing messages.

debugging/0 can be used to list the spied predicates and the current debugger mode.

[eclipse 1]: spy writeln/1.
spypoint added to writeln / 1.

yes.
Debugger switched on - leap mode
[eclipse 2]: debugging.
Debug mode is leap
writeln / 1 is being spied

yes.
[eclipse 3]: true, writeln(hello), true.
B+(2) 0  CALL   writeln(hello) %> l leap
hello
B+(2) 0  EXIT   writeln(hello) %> c creep
B (3) 0  CALL   true %> l leap

yes.
[eclipse 4]: trace.
Debugger switched to creep mode

yes.
[eclipse 5]: true, writeln(hello), true.
B (1) 0  CALL   true %> c creep
B (1) 0  EXIT   true %> c creep
B+(2) 0  CALL   writeln(hello) %> l leap
hello
B+(2) 0  EXIT   writeln(hello) %> l leap

yes.

Previous Up Next