[ Debugging | Reference Manual | Alphabetic Index ]

# trace(+Goal)

Execute the goal Goal with the debugger in creep mode.

Goal
  Atom or compound term.

## Description

The goal Goal is called with the debugger in creep mode. trace/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 creep mode at the call port of Goal and switched off when Goal exits (or fails, leaves,...).

If the debugger was already on before calling trace/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, trace(buggy_goal), big_goal2.
           big_goal1.
           big_goal2.
           buggy_goal.
           user        compiled 208 bytes in 0.02 seconds
          yes.
          [eclipse]: p.
            % big_goal1/0 is executed without the debugger
          Start debugging - creep mode
            (1) 0  CALL   buggy_goal %> creep
            (1) 0  EXIT   buggy_goal %> creep
          Stop debugging.
            % big_goal2/0 is executed without the debugger
          yes.

## See Also

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