|Did you know ...||Search Documentation:|
|Debugging and Tracing Programs|
This section is a reference to the debugger interaction predicates. A more use-oriented overview of the debugger is in section 2.9.
If you have installed XPCE, you can use the graphical front-end of the tracer. This front-end is installed using the predicate guitracer/0.
fail). The atom
allrefers to all ports. If the port is preceded by a
sign, the trace point is cleared for the port. If it is preceded by a
, the trace point is set.
The predicate trace/2 activates debug mode (see debug/0). Each time a port (of the 4-port model) is passed that has a trace point set, the goal is printed as with trace/0. Unlike trace/0, however, the execution is continued without asking for further information. Examples:
|Trace all ports of hello with any arity in any module.|
|Trace failures of foo/2 in any module.|
|Stop tracing bar/1.|
The predicate debugging/0 shows all currently defined trace points.
Note that the
min_free parameter of all stacks is
enlarged to 8 K cells if debugging is switched off in order to
avoid excessive GC. GC complicates tracing because it renames the _G<NNN>
variables and replaces unreachable variables with the atom
<garbage_collected>. Calling nodebug/0
does not reset the initial free-margin because several parts of
the top level and debugger disable debugging of system code regions. See
unify. The special shorthand
allrefers to all ports,
fullrefers to all ports except for the unify port (default).
halfrefers to the
fail. If the unknown flag is set to
warning, unknown/2 reports the value as
Loading a file using load_files/2 or one of its derived predicates reset the style checking options to their value before loading the file, scoping the option to the remainder of the file and all files loaded after changing the style checking.
always_false(X) :- X == Y, write(Y).
p(Next)may be called with Next unbound.
p(Arg) :- ( Cond -> Next = value1 ; true ), p(Next).
If a variable V is intended to be left unbound, one can
V=_. This construct is removed by the compiler and thus has
no implications for the performance of your program.
This check was suggested together with semantic singleton checking. The SWI-Prolog libraries contain about a hundred clauses that are triggered by this style check. Unlike semantic singleton analysis, only a tiny fraction of these clauses proofed faulty. In most cases, the branches failing to bind the variable fail or raise an exception or the caller handles the case where the variable is unbound. The status of this style check is unclear. It might be removed in the future or it might be enhanced with a deeper analysis to be more precise.
c. This flag also enables warnings on
<newline> followed by blank space in native mode. See section 220.127.116.11. Note that the ISO standard does not allow for unescaped newlines in quoted atoms.