Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to turn off the debugger in sbcl

I'm trying to learn common lisp currently and I've been using sbcl (I hope that's a decent implementation choice.)

Coming from ruby and irb I find the automatic moved to a debugger on every mistake a little annoying at this time. Is there a way to turn it off temporarily when I'm playing around.

like image 668
nkassis Avatar asked Jun 19 '10 06:06

nkassis


2 Answers

Common Lisp has a variable *debugger-hook*, which can be bound/set to a function.

* (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}>
* 
like image 53
Rainer Joswig Avatar answered Nov 27 '22 22:11

Rainer Joswig


There is a --disable-debugger command-line option, e.g.:

$ sbcl --disable-debugger

From the man page:

By default when SBCL encounters an error, it enters the builtin debugger, allowing interactive diagnosis and possible intercession. This option disables the debugger, causing errors to print a back‐trace and exit with status 1 instead -- which is a mode of operation better suited for batch processing. See the User Manual on SB-EXT:DISABLE-DEBUGGER for details.

There are also --noinform and --noprint CL options you may find useful.

like image 37
mechanical_meat Avatar answered Nov 27 '22 20:11

mechanical_meat