Once a program (or a part of it) has been debugged, it can be compiled in nodbgcomp mode so that all optimisations are done by the compiler. The advantages of non-debugged procedures are:- pragma(nodebug). :- pragma(debug).
It is also possible to enable the debugger in the middle of execution without changing the code. To do so, use set_flag/3 to set the start_tracing flag of the predicate of interest. Tracing will then start (in leap mode) at every call of this predicate1. To see the starting predicate itself, set a spy point in addition to the start_tracing flag:[eclipse 1]: debugging. Debugger is switched off yes. [eclipse 2]: big_goal1, trace(buggy_goal), big_goal2. Start debugging - creep mode (1) 0 CALL buggy_goal %> c creep (1) 0 EXIT buggy_goal %> c creep Stop debugging. yes.
In tkeclipse, the debugger can also be started in this way. The tracer tool will popup at the appropriate predicate if it has not been invoked already. The start_tracing flag can also be set with the predicate browser tool.[eclipse 1]: debugging. Debugger is switched off yes. [eclipse 2]: set_flag(buggy_goal/0, start_tracing, on), set_flag(buggy_goal/0, spy, on). yes. [eclipse 3]: big_goal1, buggy_goal, big_goal2. +(0) 0 CALL buggy_goal %> creep +(0) 0 EXIT buggy_goal %> creep yes.