- Reference manual
To enable tracing just when noun/2 is called from test_noun2/2 with
as the first argument, set_breakpoint_condition/2
can be used like below. Note that the condition is a Prolog string that
is parsed to obtain the goal as well as the variable names. The
resulting goal is called in the module in which the clause body is
?- set_breakpoint('/...path.../Example.pl', 8, 24, ID). ID = 1. ?- set_breakpoint_condition(1, "X == rock2"). true. ?- debug. true. [debug] ?- test_noun2(X, rock). X = rock1 ; X = rock2. [debug] ?- test_noun2(rock2, rock). Call: (11) noun(rock2, rock) ? creep Call: (12) is_a(rock2, rock) ? creep Exit: (12) is_a(rock2, rock) ? creep Exit: (11) noun(rock2, rock) ? creep Exit: (10) test_noun2(rock2, rock) ? creep true. [trace] ?-
In summary, there are really two distinct "tracing" features: trace mode and trace points. Both write traces to the console using the "Byrd Box Model" but that's where similarity ends.
Trace mode is the main Prolog command line debugger that allows for tracing the transitions through the resolution states of predicates represented by ports in the "Byrd Box Model" and optionally pausing for a command when certain ports are hit.
It can be turned on manually via trace/0, or (when put into debug mode using debug/0) when a specific predicate is encountered via spy/1, or when a specific call to a predicate is encountered via set_breakpoint/4 or set_breakpoint/5.
When execution is paused, there are many commands that can be used to inspect the state of the program, cause goals to fail or succeed, etc.
Trace points are a separate feature from trace mode that allow writing specified ports to the console when a predicate is being evaluated. It does not ever pause program execution and does not need to be in trace or debug mode to work.
They can be turned off via trace/2.