Top-level Command |  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## :step

Arguments: &rest args

If not in ldb mode (ldb does not appear in the prompt), this command initiates or affects stepping, as we now describe. See below for behavior in ldb mode.

The :step top-level command implements the functionality of the step macro.

With an argument of `t`, stepping is enabled globally, otherwise the arguments are assumed to be symbols naming functions wherein stepping should occur. Any non-functions supplied to :step will be flagged as invalid arguments, but an error will not be signaled.

Called with no arguments or `nil` as an argument while not stepping, stepping is disabled. Use the command :sover to get out of stepping in order to turn stepping off. :step and :step nil have no effect while stepping is going on. It is only useful to step through compiled code. When you try to step through interpreted code, you end up stepping through the interpreter itself, with most output irrelevant to understanding your own code.

See also :sover and :scont.

The minimal abbreviation of :step is :st.

### :step in ldb mode

When in ldb-step mode, the step command recognizes several sub-commands as its first argument:

Subcommand | Action
`:step cont [n]` | Continues through the current instruction (skipping n steps if n supplied, otherwise skipping one) even if there is a breakpoint in it.
`:step over [slide-dir]` | Step over a function call. See below for the meaning of slide-dir. This command is sticky, which means calls just to :step after a call to :step over will be another similar call to :step over.
`:step into [slide-dir]` | Step into a function call. A primcall (a call to a runtime system function) is never stepped into. See below for the meaning of slide-dir. This command is sticky, which means calls just to :step after a call to :step into will be another similar call to :step into.
`:step - [slide-dir]` | Step as before but with a different slide-direction. See below for the meaning of slide-dir.
`:step this` | No actual stepping is done, but the current instruction is re-printed in disassembled form.
`:step return` | The currently-debugged function continues to its end, and the caller of the function is breakpointed just after the call (so step out to the caller of the current function).
`:step type` | Prints information on what kind of stepping is being remembered for the <return> key. :none is printed until the first occurrence of either a :step over or :step into is done. See The Lisp DeBug (ldb) stepper in debugging.htm.

To step through only the top-level forms (i.e. un-macroexpanded) specify :step :over 0.

### slide-direction

slide-dir is optional and directs the stepper how to deal with macroexpansions and forms. The choices are:

- into: means expand macros
- across: means step across the top levels of the current form
- over: means step over this form or macroexpansion and to the next form
- out: means step until the next outer macroexpansion is re-entered
- [N]: where N is a positive fixnum, allows N macroexpand levels deep

The default is :step :over 0 which steps over function calls, but only stops at level 0 breakpoints.

To use :step in ldb mode, you must be at a breakpoint. Thus:

    cl-user(1): :ldb t
    [ldb] cl-user(2): :step into
    You must be stopped at a breakpoint before ldb-stepping can begin.
    [ldb] cl-user(3):

When not at a function call point, over and into are equivalent. Typing return repeats the remembered previous command.

## Example

    cl-user(1): (declaim (optimize debug))
                    ;; Code compiled when the DEBUG optimization
                    ;; is not 3 will not associated code with the
                    ;; courses and so :pos and :rec will not work
                    ;; for the :break command.
    t
    cl-user(2): (shell "cat times.cl")

    (defun doit (n)
      (let ((res))
        (do ((i 0 (1+ i)))
    	((= i n)
    	 res)
          (push i res))))
    0
    cl-user(3): :cf times
    ;;; Compiling file times.cl
    ;;; Writing fasl file times.fasl
    ;;; Fasl write complete
    cl-user(4): :ld times
    ; Fast loading /net/penn/acl/duane/acl91/src/times.fasl
    cl-user(5): :br doit :pos 27
    Adding #<Function doit>: 0
      Form=(defun doit (n) (let ((res)) (do (#) (# res)  (push i res))))
      lev=0 pc=0 rec=0  in #P"times.cl" starting at 23 ending at 115.
    Possible slide directions: (into over across)
    Current step/slide type: over/into
    cl-user(6): :ldb t             ;; necessary so stepping/breakpoints work
    [ldb] cl-user(7): (doit 10)

    Hit breakpoint at func = #<Function doit>, pc=0
      Form=(defun doit (n) (let ((res)) (do (#) (# res)  (push i res))))
      lev=0 pc=0 rec=0  in #P"times.cl" starting at 23 ending at 115.
    Possible slide directions: (into over across)
    Current step/slide type: over/into
    [ldb-step] cl-user(8): :loc
    Compiled lexical environment:
    0(Required): n: 10
    [ldb-step] cl-user(10): :step cont 2
    Continuing past #<Lisp Bpt doit #0 pc: 0 @23:115 lev:   0  @ #x20279eda2> 2 times
    (9 8 7 6 5 4 3 2 1 0)
    [ldb-step] cl-user(11):  :br
    #<Function doit>: lisp:rec=0 pc=0 pos=23:115 hit 3 times

    [ldb-step] cl-user(12):

See with-breakpoints-installed and the :break.

See The Lisp DeBug (ldb) stepper in debugging.htm for information on ldb stepping.

See top-level.htm for more information on top-level commands. See debugging.htm for information on the debugger and examples of stepping.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version