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 development
Sets plain spypoints on all the predicates given by the generalized predicate spec Spec.
| ?- spy [user:p, m:q/2, m:q/3]. | ?- spy m:[p/1, q/1].
If you set some spypoints when the debugger is switched off, it will be automatically switched on, entering zip mode. See mpg-ref-spy.
nospy :Spec development
spy Spec except that all the predicates
given by Spec will have all previously set spypoints removed
from them (including conditional spypoints; see Creating Breakpoints).
Removes all the spypoints that have been set, including the conditional and generic ones. See mpg-ref-nospyall.
The commands available when you arrive at a spypoint are described later. See Debug Commands.