Node:Debug Format, Next:Debug Commands, Previous:Plain Spypoint, Up:Debug Intro
We shall now look at the exact format of the message output by the
system at a port. All trace messages are output to the standard error
stream, using the print_message/2
predicate; see Messages and Queries. This allows you to trace programs while they are
performing file I/O. The basic format is as follows:
N S 23 6 Call: T foo(hello,there,_123) ?
N is only used at Exit ports and indicates whether the invocation
could backtrack and find alternative solutions. Unintended
nondeterminacy is a source of inefficiency, and this annotation can
help spot such efficiency bugs. It is printed as ?
, indicating
that foo/3
could backtrack and find alternative solutions, or
otherwise.
S is a spypoint indicator. If there is a plain spypoint on
foo/3
, it is printed as +
. In case of conditional
and generic spypoints it takes the form *
and #
,
respectively. Finally, it is printed as
, if there is no
spypoint on the predicate being traced.
The first number is the unique invocation identifier. It is increasing regardless of whether or not debugging messages are output for the invocations (provided that the debugger is switched on). This number can be used to cross correlate the trace messages for the various ports, since it is unique for every invocation. It will also give an indication of the number of procedure calls made since the start of the execution. The invocation counter starts again for every fresh execution of a command, and it is also reset when retries (see later) are performed.
The number following this is the current depth; i.e. the number of direct ancestors this goal has, for which a procedure box has been built by the debugger.
The next word specifies the particular port (Call, Exit, Redo, Fail, or Exception).
T is a subterm trace. This is used in conjunction with the
^
command (set subterm), described below. If a subterm has been
selected, T is printed as the sequence of commands used to select
the subterm. Normally, however, T is printed as
,
indicating that no subterm has been selected.
The goal is then printed so that you can inspect its current instantiation state.
The final ?
is the prompt indicating that you should type in one of the
commands allowed (see Debug Commands). If this particular port is
unleashed then you will not get this prompt since you have
specified that you do not wish to interact at this point.
At Exception ports, the trace message is preceded by a message about the pending exception, formatted as if it would arrive uncaught at the top level.
Note that calls that are compiled in-line and built-in predicates at depth 1 (e.g. those called directly from the top-level) are not traced.
Block and unblock ports are exceptions to the above debugger message
format. A message
S - - Block: p(_133)
indicates that the debugger has encountered a blocked goal, i.e.
one which is temporarily suspended due to insufficiently instantiated
arguments (see Procedural). By default, no interaction takes place at this
point, and the debugger simply proceeds to the next goal in the
execution stream. The suspended goal will be eligible for execution
once the blocking condition ceases to exist, at which time a message
S - - Unblock: p(_133)
is printed. Although Block and Unblock ports are unleashed by default in trace mode, you can make the debugger interact at these ports by using conditional spypoints.