Wiki Discussion: gtrace

Subtopics to cover:

FAQ

What is gtrace/0?
How is gtrace different from trace/0?
Is there any other ways to trace code? Note meta-interpreter.

See: SWI-Prolog -- Intercepting the Tracer
Explain Hooks

Explain each command: See Overview of the Debugger

See: Wiki Discussion: Unification - #4 by EricGT
See: Choice points
Explain how unification and backtracking is portrayed with gtrace

Explain box model
Explain derivation tree

See: Gtrace - Example finite-state automaton - #5 by jamesnvc
Explain how behind the seen data structures such as frames effect how gtrace works.

See: Descriptions of the icons/glyphs in the graphical debugger?
Explain icons
Explain source code line highlight color.
Explain parts of the window.
Explain lines in upper right display frame.

Explain slider controls between panels for resizing.

Explain use with constraints. See: Understanding CLP(FD) Prolog code of N-queens problem

Explain development cycle that doesn’t require shutting down and starting gtrace each time by using make e.g.
edit, save, make, gtrace, query
then
edit,save,make,query
Also note that if the source code is in modules and unit test are in the same file as the module and not in a plt file then the unit test can catch problems before needing to start gtrace in some cases which leads to faster development cycles.

See: Small bug in the gui tracer - #5 by martin
Note display problem that sometimes happens.

See: SWI-Prolog -- Debugging threads
Talk about debugging threads.

See: Lazy list
Talk about how lazy list are displayed with gtrace.

Talk about how to change the viewing of variable values using the dialog.

Explain how indexing works and show how it skips ahead. It may look like a predicate was skipped but it wasn’t.

Show example of how long list of \+<character>, causes gtrace to speed ahead while updating screen; appears to jiggle.

SWI-Prolog

Trigger trace after hitting semi-colon from console window?

Help!

Personal notes:
Note that if Prolog had types and more specifically Algebraic Data Types, a class of errors could be eliminated or at least noted at compile time instead of run time and thus the need to use gtrace for them would be eliminated.

With regards to algebraic data types and SWI-Prolog see package typedef. I have not used this, but worth a look.


Related posts:

How to trace “system” predicates/hide my predicates from tracing?
Debug mode and trace points
What is the unify port used for?
What does the / Find command do in Trace Mode?

1 Like