CHR Debugging Predicates

The following predicates control the operation of the CHR debugger:

chr_trace

Switches the CHR debugger on and ensures that the next time control enters a CHR port, a message will be produced and you will be asked to interact.

At this point you have a number of options. See CHR Debugging Options. In particular, you can just type <RET> to creep (or single-step) into your program. You will notice that the CHR debugger stops at many ports. If this is not what you want, the predicate chr_leash gives full control over the ports at which you are prompted.

chr_debug

Switches the CHR debugger on and ensures that the next time control enters a CHR port with a spypoint set, a message will be produced and you will be asked to interact.

chr_nodebug

Switches the CHR debugger off. If there are any spypoints set then they will be kept.

chr_notrace

Equivalent to chr_nodebug.

chr_debugging

Prints onto the standard error stream information about the current CHR debugging state. This will show:

  1. Whether the CHR debugger is switched on.
  2. What spypoints have been set (see below).
  3. What mode of leashing is in force (see below).

chr_leash(+Mode)

The leashing mode is set to Mode. It determines the CHR ports at which you are to be prompted when you creep through your program. At unleashed ports a tracing message is still output, but program execution does not stop to allow user interaction. Note that the ports of spypoints are always leashed (and cannot be unleashed). Mode is a list containing none, one or more of the following port names:

call
Prompt when a constraint is executed for the first time.
exit
Prompt when the constraint is successfully processed, i.e. the applicable rules have applied.
redo
Prompt at subsequent exits generated by nondeterminate rule bodies.
fail
Prompt when a constraint fails.
wake
Prompt when a constraint from the constraint store is woken and reconsidered because one of its variables has been touched.
try
Prompt just before the guard evaluation of a rule, after constraints matching the heads have been found.
apply
Prompt upon the application of a rule, after the successful guard evaluation, when the rule commits and fires, just before evaluating the body.
insert
Prompt when a constraint gets inserted into the constraint store, i.e. after all rules have been tried.
remove
Prompt when a constraint gets removed from the constraint store, e.g. when a simplification rule applies.

The initial value of the CHR leashing mode is [call,exit,fail,wake,apply]. Predefined shortcuts are:

chr_leash(none), chr_leash(off)
To turn leashing off.
chr_leash(all)
To prompt at every port.
chr_leash(default)
Same as chr_leash([call,exit,fail,wake,apply]).
chr_leash(call)
No need to use a list if only a singular port is to be leashed.