[ Debugging | Reference Manual | Alphabetic Index ]

debug(+Goal)

Execute the goal Goal with the debugger in leap mode.
Goal
Atom or compound term.

Description

The goal Goal is called with the debugger in leap mode. debug/1 succeeds or fails depending if Goal succeeds or fails.

This predicate is particularly useful for debugging large programs that would take too much space or time to run completely with the debugger. The debugger is only switched on in leap mode at the call port of Goal and switched off when Goal exits (or fails, leaves,...).

If the debugger was already on before calling debug/1, it has no effect.

An alternative way of turning on the debugger selectively is to set the start_tracing property of a particular predicate using set_flag/3.

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Fail Conditions

Fails if Goal fails

Resatisfiable

Resatisifable if Goal is resatisfiable

Examples

Success:
      [eclipse]: [user].
       p :- big_goal1, debug(buggy_goal), big_goal2.
       big_goal1.
       big_goal2.
       buggy_goal.
       user        compiled 208 bytes in 0.02 seconds
      yes.
      [eclipse]: set_flag(big_goal2/0, spy, on),
              set_flag(buggy_goal/0, spy, on).
      yes.
      [eclipse]: p.
      Start debugging - leap mode
       +(1) 0  CALL   buggy_goal %> creep
       +(1) 0  EXIT   buggy_goal %> creep
      Stop debugging.
      yes.



See Also

debug / 0, notrace / 0, trace / 0, trace / 1, set_flag / 3