Sometimes your program may not act like you expected (surprise surprise!!), and you
would want to trace the execution of your query by means of the debugging facilities provided by
MacProlog32. There are two debuggers: one is at the source level (and recommended for
beginners - i.e. you) which shows the execution one step at a time, by highlighting
the sub-query being evaluated and the assignment of variables within this evaluation;
the other debugger is a linear trace of all the calls made during execution. This first one
is the default option; to change it to the second one, run the query
(pretty obvious (NOT) hunh).
Regardless of the debugging mode chosen, the tracing facility is activated and
deactivated by using the queries debug and nodebug respectively. Also,
you need to indicate which relation(s) you want to trace by using the call
spy followed by the relation name and its arity, hence for instance to trace
a relation called likes that has 2 arguments, you have to evaluate the call
spy likes/2. Once the debugging mode is switched on and there are spy point(s)
set on some predicate(s), every time you execute a query involving one of the spied
relations, a debug dialog will appear; you need to click on the Creep button to have
one step of the execution, or click on Skip if you don't want to see the execution of a particular call. The debug dialog disappears when the evaluation terminates,
or by clicking on the Abort button.