Port denotes the reason to activate the tracer (`port' in the 4/5-port, but with some additions:
redo
port signals resuming a predicate to generate
alternative solutions.
retry
. Except is the pending exception-term.
break
instruction is executed. PC is program
counter. This port is used by the graphical debugger.
cut_call(PC)
for more
information.
Frame is a reference to the current local stack frame,
which can be examined using prolog_frame_attribute/4. Choice
is a reference to the last choice-point and can be examined using
prolog_choice_attribute/3. Action
should be unified with one of the atoms continue
(just
continue execution), retry
(retry the current goal) or fail
(force the current goal to fail). Leaving it a variable is identical to continue
.
Together with the predicates described in section 4.39 and the other predicates of this chapter this predicate enables the Prolog user to define a complete new debugger in Prolog. Besides this it enables the Prolog programmer monitor the execution of a program. The example below records all goals trapped by the tracer in the database.
prolog_trace_interception(Port, Frame, _PC, continue) :- prolog_frame_attribute(Frame, goal, Goal), prolog_frame_attribute(Frame, level, Level), recordz(trace, trace(Port, Level, Goal)). |
To trace the execution of `go' this way the following query should be given:
?- trace, go, notrace. |
very_deep
(meaning don't skip). The `skip level' is a
global variable of the Prolog system that disables the debugger on all
recursion levels deeper than the level of the variable. Used to
implement the trace options `skip' (sets skip level to the level of the
frame) and `up' (sets skip level to the level of the parent frame (i.e.,
the level of this frame minus 1).