Node:CHR Debugging Options, Previous:CHR Debugging Messages, Up:CHR Debugging



CHR Debugging Options

This section describes the options available when the system prompts you after printing out a debugging message. Most of them you know from the standard Prolog debugger. All the options are one letter mnemonics, some of which can be optionally followed by a decimal integer. They are read from the standard input stream up to the end of the line (Return, <<cr>>). Blanks will be ignored.

The only option which you really have to remember is h. This provides help in the form of the following list of available options.

CHR debugging options:
   <cr>   creep            c      creep
    l     leap
    s     skip             s <i>  skip (ancestor i)
    g     ancestors
    &     constraints      & <i>  constraints (details)
    n     nodebug          =      debugging
    +     spy this
    -     nospy this       .      show rule
    <     reset printdepth < <n>  set printdepth
    a     abort            b      break
    ?     help             h      help
c
<<cr>>
creep causes the debugger to single-step to the very next port and print a message. Then if the port is leashed, the user is prompted for further interaction. Otherwise, it continues creeping. If leashing is off, creep is the same as leap (see below) except that a complete trace is printed on the standard error stream.
l
leap causes the debugger to resume running your program, only stopping when a spypoint is reached (or when the program terminates). Leaping can thus be used to follow the execution at a higher level than exhaustive tracing.
s
s i
skip over the entire execution of the constraint. That is, you will not see anything until control comes back to this constraint (at either the exit port or the fail port). This includes ports with spypoints set; they will be masked out during the skip. The command can be used with a numeric argument to skip the execution up to and including the ancestor indicated by the argument. Example:
      ...
      4   - exit    prime(8)#<c6> ? g
Ancestors:
      1   1 apply   eratosthenes:rule(2) @ primes(10)#<c1>
      2   1 apply   eratosthenes:rule(2) @ primes(9)#<c3>
      3   1 apply   eratosthenes:rule(2) @ primes(8)#<c5>
      4   - call    prime(8)#<c6>

      4   - exit    prime(8)#<c6> ? s 2
      2   - exit    primes(9)#<c3> ?

g
print ancestors provides you with a list of ancestors to the currently active constraint, i.e. all constraints not yet exited that led to the current constraint in the derivation sequence. The format is the same as with trace messages. Constraints start with call entries in the stack. The subsequent application of a rule replaces the call entry in the stack with an apply entry. Later the constraint shows again as redo or fail entry. Example:
      0   - call    primes(10)#<c1> ?
      1   1 try     eratosthenes:rule(2) @ primes(10)#<c1> ? g

Ancestors:
      1   - call    primes(10)#<c1>

      1   1 try     eratosthenes:rule(2) @ primes(10)#<c1> ?
      1   1 apply   eratosthenes:rule(2) @ primes(10)#<c1> ?
      1   - call    prime(10)#<c2> ?
      2   - insert  prime(10)#<c2>
      2   - exit    prime(10)#<c2> ? g

Ancestors:
      1   1 apply   eratosthenes:rule(2) @ primes(10)#<c1>
      2   - call    prime(10)#<c2>

&
print constraints prints a list of the constraints in the constraint store. With a numeric argument, details relevant primarily to CHR implementors are shown.
n
nodebug switches the CHR debugger off.
=
debugging outputs information concerning the status of the CHR debugger as via chr_debugging/0
+
spy this sets a spypoint on the current constraint or rule.
-
nospy this removes the spypoint from the current constraint or rule, if it exists.
.
show rule prints the current rule instantiated by the matched constraints. Example:
 8   1 apply   era:absorb(8) @ prime(4)#<c14> \ prime(8)#<c6> ? .

 absorb(8) @
  prime(4)#<c14> \
    prime(8)#<c6> <=>

    8 mod 4=:=0
    |
    true.

<
< n
While in the debugger, a printdepth is in effect for limiting the subterm nesting level when printing rules and constraints. The limit is initially 10. This command, without arguments, resets the limit to 10. With an argument of n, the limit is set to n, treating 0 as infinity.
a
abort calls the built-in predicate abort/0.
b
break calls the built-in predicate break/0, thus putting you at a recursive top-level. When you end the break (entering ^D) you will be re-prompted at the port at which you broke. The CHR debugger is temporarily switched off as you call the break and will be switched on again when you finish the break and go back to the old execution. Any changes to the CHR leashing or to spypoints during the break will remain in effect.
?
h
help displays the table of options given above.