Debug Mode

We can distinguish a couple of debugging modes. In any debugging mode the instrumented fork of a clause will be executed. Depending on the debugging mode the instrumentation will check a certain condition and when this condition is met the current execution is suspended and a callback is called. The debugging modes are:

Table 2: Debugging Modes






Run until paused or aborted

step in


Run until next port

step over


Run until predicate is executed

step out


Run until parent predicate is executed



Run until next spy or break point

When the current goal is shown additional information about the debugging mode, the invoca-tion depth and the current port is shown as well. Last call optimization is currently defunct while debugging, the invocation depth is therefore larger than usual. The information is provided in the following format on the display console:

   <mode> <depth> <port> <goal> ?

Predicates that have the sys_notrace predicate property set are ignored in any debugging mode. A couple of predicates that resemble commands, e.g. listing/1, trace/1, etc., have the sys_notrace predicate property by default set. Predicates that are invoked from within a source which has the sys_notrace source property set are as well ignored in any debugging mode. The system sources have the sys_notrace source property by default set.

The following debug mode predicates are provided:
The predicate switches to the off debugging mode.
The predicate switches to the step in debugging mode.
The predicate switches to the step over debugging mode.
The predicate switches to the step out debugging mode.
The predicate switches to the on debugging mode.
Show the ports that are listed in L, hide the ports that are not listed in L. In debug mode, hidden ports are not further debugged but simply continue. The following mnemonics work for the predicate:
Never prompt.
Only prompt on call port.
Only prompt on call and redo port.
Only prompt on call, redo and fail port.
Prompt on call, exit, redo and fail port
Prompt on call, exit, redo, fail and head port.

The predicate shows the debug mode, the spy points and the break points.
The predicate adds the predicate P to the spy points.
The predicate removes the predicate P from the spy points.
The predicate succeeds in P for every spy point.
break(F, L):
The predicate adds the file F and the line number L to the break points.
nobreak(F, L):
The predicate removes the file F and the line number L from the break points.
breaking(F, L):
For every break point the predicate succeeds with the file F and the line number L

The following debug mode Prolog flags are provided:

unknown: [ISO]
Legal values are error [ISO], fail [ISO] and warning [ISO]. The flag indicates how undefined predicates should be executed. Default value is error. Currently the value cannot be changed.
debug: [ISO]
The legal values are on [ISO], step_in, step_over, step_out and off [ISO]. The value indicates the debugging mode the current thread is in. Default value is off. The value can be changed.
The property indicates the size of the stack trace that should be generated for an exception. Legal values are non-negative integers. The value can be changed.
Legal values are lists of debugger ports. Legal debugger ports are call, exit, redo, fail, head and chop. The flag is per interpreter. The default value is [call,exit,redo,fail]. The value can be changed.