common-lisp - 如何在 Common Lisp ECL 中执行分步调试?
问题描述
我正在使用 ECL 学习 Common Lisp。我尝试参考https://malisper.me/debugging-lisp-part-1-recompilation/的调试方法,但步骤执行没有正常工作。
当我插入“(中断)”并选择“重试”时,处理首先在中断处停止。这是如上页所示的预期行为。
(defun fib (n)
(break)
(if (<= 0 n 1)
(/ 1 0)
(+ (fib (- n 1))
(fib (- n 2)))))
Break
[Condition of type SIMPLE-CONDITION]
下一次我按下 S 键时,显示以下错误消息,即使它应该已被踩。
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
这在ECL的实现中可能是个问题,但是我想知道在ECL中通常会做什么样的调试。
最好的问候, NOEU
解决方案
一种选择:STEP
在 ECL 中。用于:h
查看步进器中的命令。
> (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>.
推荐阅读
- django - Django. How to "join" two models that have foreignkeys to a third model?
- javascript - 使用特定的 div 类触发对锚标记的点击
- r - 迭代地将值附加到由循环创建的数据框中的所有记录
- c++ - C ++ fstream在while循环中获取函数陷阱
- javascript - 将带有内联注释的歌词格式化为顶部带有和弦的可读歌曲
- java - 无法解析 MainActivity 中的方法“findViewById”
- machine-learning - 使用 Cython 或 numpy 在 Python 中加速 DBSCAN 算法(从头开始)
- javascript - 如何在Javascript中将所有文本在x轴上旋转x度
- php - 如何在laravel中使用json字符串将大数据插入数据库?
- reactjs - 为什么要在 render() 方法之外定义无状态函数?