NOEU
NOEU

Reputation: 21

How can I execute step-by-step debugging in Common Lisp ECL?

I am studying Common Lisp using ECL. I tried referring to https://malisper.me/debugging-lisp-part-1-recompilation/ for the debugging method, but the step execution did not work properly.

When I insert "(break)" and select "RETRY", processing stops first at the break. This is the intended behavior as shown on the page above.

(defun fib (n)
  (break)
  (if (<= 0 n 1)
      (/ 1 0)
      (+ (fib (- n 1))
         (fib (- n 2)))))
Break
   [Condition of type SIMPLE-CONDITION]

The next time I pressed the S key, the following error message was displayed, even though it should have been stepped.

SWANK/BACKEND: ACTIVATE-STEPPING not implemented
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [ABORT] Return to sldb level 1.
 1: [CONTINUE] Return from BREAK.
 2: [RETRY] ​​Retry SLIME REPL evaluation request.
 3: [* ABORT] Return to SLIME's top level.
 4: [ABORT] ABORT

This may be a problem in the implementation of ECL, but I would like to know what kind of debugging is usually done in ECL.

Best regards, NOEU

Upvotes: 2

Views: 725

Answers (1)

Rainer Joswig
Rainer Joswig

Reputation: 139261

One option: STEP in ECL. Use :h to see commands in the stepper.

> (defun fib (n)                                                                                                             
    (if (<= 0 n 1)                                                                                                             
        (/ 1 0)                                                                                                                
        (+ (fib (- n 1))                                                                                                       
           (fib (- n 2)))))

FIB
> (step (fib 3))
 (FIB 3) -
 (BLOCK FIB ...) -
 (IF (<= 0 ...) ...) -
 (<= 0 ...) -
 (+ (FIB #) ...) -
 (FIB (- N ...)) -
 (- N ...) -
 (BLOCK FIB ...) -
 (IF (<= 0 ...) ...) -
 (<= 0 ...) -
 (+ (FIB #) ...) -
 (FIB (- N ...)) -
 (- N ...) -
 (BLOCK FIB ...) -
 (IF (<= 0 ...) ...) -
 (<= 0 ...) -
 (/ 1 ...) -

Condition of type: DIVISION-BY-ZERO
#<a DIVISION-BY-ZERO>

Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at FIB. In: #<process TOP-LEVEL 0x104f16f80>.

Upvotes: 3

Related Questions