|Did you know ...||Search Documentation:|
|Breakpoint and watchpoint handling|
SWI-Prolog support breakpoints. Breakpoints can be
manipulated with the library
Setting a breakpoint replaces a virtual machine instruction with the
instruction. If the virtual machine executes a
performs a callback to decide on the action to perform. This section
describes this callback, called prolog:break_hook/7.
D_BREAK, set using set_breakpoint/4. Clause and PC identify the breakpoint. FR and BFR provide the environment frame and current choicepoint. Debug is
trueif the system was in debug mode when the breakpoint was reached, otherwise Debug is
false. Expression identifies the action that is interrupted, and is one of the following:
call(A is 9)if the clause was compiled with optimization enabled.
If prolog:break_hook/7 succeeds, it must unify Action with a value that describes how execution must continue. Possible values for Action are:
If this hook throws an exception, the exception is propagated
normally. If this hook is not defined or fails, the default action is
executed. This implies that, if the thread is in debug mode, the tracer
will be enabled (
trace) and otherwise the breakpoint is
This hook allows for injecting various debugging scenarios into the executable without recompiling. The hook can access variables of the calling context using the frame inspection predicates. Here are some examples.