Scheme 48 Manual | Contents | In Chapter: Command processor
Previous: Switches | Next: Command programs

Inspection mode

There is a data inspector available via the ,inspect and ,debug commands or by setting the inspect-focus-value switch. The inspector is particularly useful with procedures, continuations, and records. The command processor can be taken out of inspection mode by using the q command, by unsetting the inspect-focus-value switch, or by going to a command level where the inspect-focus-value is not set. When in inspection mode, input that begins with a letter or digit is read as a command, not as an expression. To see the value of a variable or number, do (begin exp) or use the ,run exp command.

In inspection mode the command processor prints out a menu of selectable components for the current focus object. To inspect a particular component, just type the corresponding number in the menu. That component becomes the new focus object. For example:

> ,inspect '(a (b c) d)
(a (b c) d)

[0] a
[1] (b c)
[2] d
: 1
(b c)

[0] b
[1] c

When a new focus object is selected the previous one is pushed onto a stack. You can pop the stack, reverting to the previous object, with the u command, or use the stack command to move to an earlier object.

Commands useful when in inspection mode:

Multiple selection commands (u, d, and menu indexes) may be put on a single line.

All ordinary commands are available when in inspection mode. Similarly, the inspection commands can be used when not in inspection mode. For example:

> (list 'a '(b c) 'd)
'(a (b c) d)
> ,0
'(b c)
> ,menu
[0] b
[1] c

If the current command level was initiated because of a breakpoint in the next level down, then ,debug will invoke the inspector on the continuation at the point of the error. The u and d (up and down) commands then make the inspected-value stack look like a conventional stack debugger, with continuations playing the role of stack frames. D goes to older or deeper continuations (frames), and u goes back up to more recent ones.

Previous: Switches | Next: Command programs