Next: Tracing of Alternatives and
Up: Tracing and Debugging
Previous: Identifying Possible Bugs: Trace-bp
Levels of Tracing
In the attempt to reduce the amount of trace messages and finding the
original source of failure, the most useful tool is the trace-level
function, which filters tracing messages according to their importance.
The following levels of importance are predefined:
- 30: important failure - end of alt
- 20: constituent level action
- 15: freeze, ignore, bk-class
- 12: demo messages
- 10: alt-level action - branch number trying
- 05: unimportant alt-level action
- 00: feature level action
The function trace-level sets the minimum level of tracing messages
that can be printed. Thus, calling (trace-level 20) insures that only
important messages of level 20 and 30 will be printed.
The levels are defined as follows:
- 30: An ``important'' failure in unification occurs - that is, all the
branches of an alt have been tried and failed. This in general means that
the input is not compatible with the grammar. It does not force immediate
failure of the overall unification process, because some backtracking
options may still be open, but it is a strong indication that something
wrong is going on. In general, there is a high probability that the
first level 30 failure message is the initial failure (cf.
p.
).
- 20: Constituent Level Action - traces the constituent tree traversal of
FUF. Whenever the grammar is re-accessed to unify a new constituent, a
tracing message is printed. This is useful to follow the progression of
the unifier through the total FD. In general, the traversal is a
top-down breadth-first expansion of the constituent tree.
- 15: Control messages: The dominant control strategy of FUF is the top-down
constituent traversal. Fine-tuning of this strategy is, however, possible,
using the bk-class, wait and ignore directives. These
constructs are described in more detail in Section
.
- 12: Demo messages: The alt construct allows the grammar writer to output
``demo messages'' when an alt is entered. These messages are considered of
level 12.
- 10: Alt-level action - branch number trying: when an alt is tried, branches
are tried successively, in order, randomly (for a ralt) or directly (for an
indexed alt). A tracing message is output each time a branch is tried,
indicating the name of the alt (therefore the position of the unifier
within the grammar) and the number of the branch within the alt.
- 05: unimportant alt-level action: when an alt is indexed, certain tracing
messages are printed to document the index search.
- 00: feature level action: each time a feature is added to the total FD by
the unifier, a tracing message is printed. This is the absolute lowest
level of tracing and results in unending seas of messages.
In general, when debugging, start by setting (trace-level 30), this
provides most of the time directly the location of the initial failure.
Next: Tracing of Alternatives and
Up: Tracing and Debugging
Previous: Identifying Possible Bugs: Trace-bp
Michael Elhadad - elhadad@cs.bgu.ac.il