Debug Plugins

A call back can replace the default debugger user interface. The instrumented code of a clause automatically checks for debugging conditions. The typical conditions are those from debug mode, spy points and break points described in the previous section. When the corresponding condition is met, the interpreter will call the predicate trace_goal/2.

The system predicate trace_goal/2 is customizable by the end-user via additional rules for the multi-file predicate goal_tracing/2. If the additional multi-file rules fail, the system predicate will invoke the default debugger user interface. The behaviour of the default debugger user inter-face can be further configured by the predicate leash/1.

Predicates that have the sys_notrace predicate property set can also meet some condition, but are not display by the default debugger user interface. A couple of predicates that resemble commands, e.g. listing/1, trace/1, etc., have the sys_notrace predicate property by set, so that they do not clutter interactive debugging.

The following debug plugins predicates are provided:

goal_tracing(P, F):
The predicate can be used to define a custom debugger call back for the port P and the frame F.
trace_goal(P, F):
The predicate invokes the current debugger call back for the port P and the frame F. If no call back is defined then the current goal is traced and optionally prompted.
store_changing(S):
The predicate can be used to define a custom debugger call back for the store S.
change_store(S):
The predicate invokes the current debugger call back for the store S. If no call back is defined then does nothing.
leash(L):
Leash the ports that are listed in L, unleash the ports that are not listed in L. When prompted unleashed ports do not await user interaction but simply continue.The predicate accepts the same mnemonics as the predicate visible/1.

The following debug plugins Prolog flags are provided:

sys_leash:
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.

Kommentare