Next: Definite Clause Grammars
Up: Debugging
Previous: High-Level Tracing
  Contents
  Index
Low-Level Tracing
XSB also provides a facility for low-level tracing of execution.
This can be activated by invoking the emulator with the -T option
(see Section 3.5), or through the predicate trace/0.
It causes trace information to be printed out at every call (including
those to system trap handlers). The volume of such trace information
can very become large very quickly, so this method of tracing is not
recommended in general.
XSB debugger also provides means for the low-level control of what must be
traced. Normally, various low-level predicates are masked out from the
trace, since these predicates do not make sense to the application programmer.
However, if tracing below the application level is needed, you can retract
some of the facts specified in the file syslib/debugger_data.P
(and in some cases assert into them). All these predicates are documented
in the header of that file. Here we only mention the four predicates that an
XSB developer is more likely to need. To get more trace, you should retract
from the first three predicates and assert into the last one.
- hide_this_show(Pred,Arity): specifies calls (predicate name and
arity) that the debugger should not show at the prompt. However,
the evaluation of this hidden call is traced.
- hide_this_hide(Pred,Arity): specifies calls to hide. Trace
remains off while evaluating those predicates. Once trace is off, there
is no way to resume it until the hidden predicate exits or fails.
- show_this_hide(Pred,Arity): calls to show at the
prompt. However, trace is switched off right after that.
- trace_standard_predicate(Pred,Arity): Normally trace doesn't
go inside standard predicates ( i.e., those specified in
syslib/std_xsb.P. If you need to trace some of those, you must
assert into this predicate.
In principle, by retracting all facts from the first three predicates and
asserting enough facts into the last one, it is possible to achieve the
behavior that approximates the -T option. However, unlike -T,
debugging can be done interactively. This does not obviate -T,
however. First, it is easier to use -T than to issue multiple asserts
and retracts. Second, -T can be used when the error occurs early on,
before the moment when XSB shows its first prompt.
Next: Definite Clause Grammars
Up: Debugging
Previous: High-Level Tracing
  Contents
  Index
Baoqiu Cui
2000-04-23