Previous: , Up: prolog   [Index]


16.14 How to debug prolog programs

There is a simple tracing framework that can be used. If one are using compile-prolog-string use syntax parameters Trace = #f/#t to make all function goals defined to be under tracing supervision and use the syntax parameter Level do define the default level. It is possible to force a single defination of a goal functions to be traced by using the prolog functor

prolog -trace.

To define the level of the traced function use prolog -trace(level).

When running the level of the run is controled by trace-level and all defined goal functions that have trace enabled will be printed if,

Level <= trace-level

The simplest way to use this feature is to just use the functor -trace on the goal functions that needs to be traced.