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. 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. 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:

- `u` (up) pop object stack
- `m` (more) print more of a long menu
- `(...)` evaluate a form and select result
- `q` quit
- `template` select a closure or continuation's template (Templates are the static components of procedures; these are found inside of procedures and continuations, and contain the quoted constants and top-level variables referred to by byte-compiled code.)
- `d` (down) move to the next continuation (current object must be a continuation)
- `menu` print the selection menu for the focus object

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)
>     > ,1
>     '(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