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.
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.