For programs of any size, it is clearly impractical to creep through the entire program. Spypoints make it possible to stop the program whenever it gets to a particular predicate of interest. Once there, one can set further spypoints in order to catch the control flow a bit further on, or one can start creeping.
In this section we discuss the simplest form of spypoints, the plain spypoints. The more advanced forms, the conditional and generic spypoints will be discussed later; see Advanced Debugging.
Setting a plain spypoint on a predicate indicates that you wish to see all control flow through the various ports of its invocation boxes, except during skips. When control passes through any port of an invocation box with a spypoint set on it, a message is output and the user is asked to interact. Note that the current mode of leashing does not affect plain spypoints: user interaction is requested on every port.
Spypoints are set and removed by the following built-in predicates. The first two are also standard operators:
spy
:Spec developmentExamples:
| ?- spy [user:p, m:q/[2,3]]. | ?- spy m:[p/1, q/1].
If you set some spypoints when the debugger is switched off then
it will be automatically switched on, entering zip mode.
nospy
:Spec developmentspy
Spec except that all the predicates
given by Spec will have all previously set spypoints removed
from them (including conditional spypoints; see Creating Breakpoints).
nospyall
developmentThe commands available when you arrive at a spypoint are described later. See Debug Commands.