debugging - 如何在 sbcl 中关闭调试器

标签 debugging lisp common-lisp sbcl

我目前正在尝试学习 common lisp,并且我一直在使用 sbcl(我希望这是一个不错的实现选择。)

我来自 ruby​​ 和 irb,我发现在每次错误时自动移动到调试器在这个时候有点烦人。有没有办法在我玩的时候暂时关闭它。

最佳答案

Common Lisp 有一个变量 *debugger-hook* ,它可以绑定(bind)/设置为一个函数。

* (aref "123" 10)

debugger invoked on a SB-INT:INVALID-ARRAY-INDEX-ERROR:
  Index 10 out of bounds for (SIMPLE-ARRAY CHARACTER
                              (3)), should be nonnegative and <3.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-INT:INVALID-ARRAY-INDEX-ERROR "123" 10 3 NIL)
0] 0

* (defun debug-ignore (c h) (declare (ignore h)) (print c) (abort))

DEBUG-IGNORE
* (setf *debugger-hook* #'debug-ignore)

#<FUNCTION DEBUG-IGNORE>
* (aref "123" 10)

#<SB-INT:INVALID-ARRAY-INDEX-ERROR {1002A661D1}>
* 

关于debugging - 如何在 sbcl 中关闭调试器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3074586/

相关文章:

android - 如何在 android 上调试纯 native 代码?

c - 段错误以及如何使用 union 类型

list - 方案匹配元素

list - 普通口齿不清 : Removing elements with the same cdr

lisp - 为什么 AND 是 common lisp 中的一个宏

lisp - 如何访问函数返回的多个值(例如,cl :parse-integer)?

objective-c - 崩溃日志中的 "Application Specific Backtrace"是什么?

c++ - 调试器无法匹配库中的源代码或步骤代码

function - 为什么许多 lisp 函数名称都像 "foo"、 "foo-1"、 "foo-2"等?

macros - 为什么 SBCL eval 函数会丢失它运行的 macrolet?