[top] [up] [next]

Stepping through a program


Stepping through a program is allowing the Prolog inference engine to execute the next step(s) of a Prolog program and then stop the execution again. There are two different ways of stepping through a program: stepping into and stepping over.

Stepping into

Stepping through a program is done by pressing the F7 key, the Start Step button or the Next Step button.

If the next step is calling a user-defined Prolog predicate then the debugger stops on finding the first candidate for a match, if there is one. If there is no candidate then the debugger stops after failing the call statement. After a match the debugger enters the user-defined predicate.

Stepping over

The difference between stepping over and stepping into a program is that with stepping over no user defined predicate is entered and its prove tree is not displayed. Stepping over is useful for skipping predicates that have been tested but still debug the current predicate or some other predicate.

Stepping through code and the text editor

While the debugger is stepping through Prolog source code it attempts to display the current execution point in a file in the text editor. In the gutter of the text editor a small image is used to show the state of the inference engine: the possible images displayed are:

pl_img112.gif (2640 bytes) FIND and CALL
A darkblue arrow pointing to the current clause is used for the FIND and CALL state.
FIND: a candidate for a match is found
CALL: start for a search is started
 
pl_img113.gif (2693 bytes) EXIT
A darkgreen arrow pointing upwards is used for the EXIT state.
EXIT: an expression was completely proved and thus exited
 
pl_img114.gif (2508 bytes) FAIL
A darkred arrow pointing upwards is used for the FAIL state.
FAIL: an expression could not be proven
 
pl_img115.gif (2605 bytes) REDO
A lightblue arrow pointing to a clause is used for the REDO state.
REDO: another attempt to find a solution for a (sub)goal is started.
 
pl_img116.gif (2697 bytes) MISMATCH
A red arrow pointing to a clause is used for the MISMATCH state.
MISMATCH: a match between two predicates failed, the reason for the mismatch is shown in the execution trace.

[top] [up] [next]

 

info@trinc-prolog.com