YAP 7.1.0
Interacting with the debugger

Debugging with YAP is similar to debugging with C-Prolog. More...

Detailed Description

Debugging with YAP is similar to debugging with C-Prolog.

Both systems include a procedural debugger, based on Byrd's four port model In this model, execution is seen at the procedure level: each activation of a procedure is seen as a box with control flowing into and out of that box

In the four port model control is caught at four key points: before entering the procedure, after exiting the procedure (meaning successful evaluation of all queries activated by the procedure), after backtracking but before trying new alternative to the procedure and after failing the procedure Each one of these points is named a port:

Call | | Exit
+ descendant(X,Y) :- offspring(X,Y). + offspring
| |
| descendant(X,Z) :- |
descendant + offspring(X,Y), descendant(Y,Z). + descendant
Fail | | Redo

To start debugging, the user will either call trace or spy the relevant procedures, entering debug mode, and start execution of the program When finding the first spy-point, YAP's debugger will take control and show a message of the form: v

(1) : quicksort([1,2,3],_38) ?

The debugger message will be shown while creeping, or at spy-points, and it includes four or five fields:

If the active port is leashed, the debugger will prompt the user with a ?, and wait for a command A debugger command is just a character, followed by a return By default, only the call and redo entries are leashed, but the leash/1 predicate can be used in order to make the debugger stop where needed

There are several commands available, but the user only needs to remember the help command, which is h This command shows all the available options, which are:

same as <tt>k</tt>

s - skip

YAP will continue execution without showing any messages until returning to the current activation Spy-points will be ignored in this mode Note that this command keeps all debugging history, use t for fast execution This command is meaningless, and therefore illegal, in the fail and exit ports

q+ a - abort

execution will be aborted, and the interpreter will return to the

top-level YAP disactivates debug mode, but spypoints are not removed

The debugging information, when fast-skip quasi-leap is used, will be lost


 Implementation of the Debugger
 Prolog code to do debugging.
 Debugger Control
 The following predicates are available to control the debugging of programs: