next up previous
Next: Obtaining Runtime Statistics Up: Built-In Predicates Previous: Creating a Protocol

Debugging and Tracing Programs

 

trace

  Start the tracer. trace/0 itself cannot be seen in the tracer. Note that the Prolog toplevel treats trace/0 special; it means `trace the next goal'.
tracing

  Succeeds when the tracer is currently switched on. tracing/0 itself can not be seen in the tracer.
notrace

  Stop the tracer. notrace/0 itself cannot be seen in the tracer.
trace( +Pred)

  Equivalent to trace( Pred, +all).
trace( +Pred, +Ports)

  Put a trace-point on all predicates meeting the predicate specification Pred. Ports is a list of portnames ( call, redo, exit, fail). The atom all refers to all ports. If the port is predeced by a `-' sign the trace-point is cleared for the port. If it is predeced 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:

The predicate debugging/0 shows all currently defined trace-points.

debug

  Start debugger (stop at spy points).
nodebug

  Stop debugger (do not trace, nor stop at spy points).
debugging

  Print debug status and spy points on current output stream.
spy( +Pred)

  Put a spy point on all predicates meeting the predicate specification Pred. See section gif.
nospy( +Pred)

  Remove spy point from all predicates meeting the predicate specification Pred.
nospyall

  Remove all spy points from the entire program.
leash( ?Ports)

  Set/query leashing (ports which allow for user interaction). Ports is one of +Name , -Name , ?Name or a list of these. +Name enables leashing on that port, -Name disables it and ?Name succeeds or fails according to the current setting. Recognised ports are: call , redo , exit , fail and unify . The special shorthand all refers to all ports, full refers to all ports except for the unify port (default). half refers to the call , redo and fail

port.

visible( +Ports)

  Set the ports shown by the debugger. See leash/1 for a description of the port specification. Default is full .
unknown( -Old, +New)

  Unify Old with the current value of the unknown system flag. On success New will be used to specify the new value. New should be instantiated to either fail or trace and determines the interpreter's action when an undefined predicate which is not declared dynamic is encountered (see dynamic/1). fail implies the predicate just fails silently. trace implies the tracer is started. Default is trace . The unknown flag is local to each module and unknown/2 is module transparent. Using it as a directive in a module file will only change the unknown flag for that module. Using the :/2 construct the behaviour on trapping an undefined predicate can be changed for any module. Note that if the unknown flag for a module equals fail the system will not call exception/3 and will not try to resolve the predicate via the dynamic library system. The system will still try to import the predicate from the public module.
style_check( +Spec)

  Set style checking options. Spec is either +<option>, -<option>, ?<option> or a list of such options. +<option> sets a style checking option, -<option> clears it and ?<option> succeeds or fails according to the current setting. consult/1 and derivates resets the style checking options to their value before loading the file. If --for example-- a file containing long atoms should be loaded the user can start the file with:
:- style_check(-atom).

Currently available options are:



next up previous
Next: Obtaining Runtime Statistics Up: Built-In Predicates Previous: Creating a Protocol



Passani Luca
Tue Nov 14 08:58:33 MET 1995