Debugging
This chapter describes the debugging facilities that are available in
development systems. The purpose of these facilities is to
provide information concerning the control flow of your program.
The main features of the debugging package are as follows:
- The Procedure Box model of Prolog execution, which provides a
simple way of visualizing control flow, especially during
backtracking. Control flow is viewed at the predicate
level, rather than at the level of individual clauses.
- The ability to exhaustively trace your program or to selectively
set spypoints. Spypoints allow you to nominate interesting
predicates at which, for example, the program is to pause so
that you can interact.
- The ability to set advice-points. An advice-point allows you
to carry out some actions at certain points of execution, independently
of the tracing activity. Advice-points can be used, e.g. for
checking certain program invariants (cf. the assert facility of
the C programming language), or for gathering profiling or branch
coverage information. Spypoints and advice-points are
collectively called breakpoints.
- The wide choice of control and information options available during
debugging.
The Procedure Box model of execution is also called the Byrd Box
model after its inventor, Lawrence Byrd.
Much of the information in this chapter is also in Chapter eight of
[Clocksin & Mellish 81], which is recommended as an introduction.
Unless otherwise stated, the debugger prints goals using
write_term/3
with the value of the Prolog flag
debugger_print_options
(see State Info).
The debugger is not available in runtime systems and the
predicates defined in this chapter are undefined; see Runtime Systems.