Zach Beane (xach) wrote,

disable ldb at runtime in sbcl

If sbcl suffers a low-level problem and crashes, it normally enters a low-level debugger called "ldb" and waits for you to start troubleshooting. That's not so nice if you want the application to simply crash and restart automatically and unattended.

You can disable ldb by tweaking *FEATURES* at build time, but that's a little inconvenient. So here's a way to do it at runtime, inspired by a hint from David Lichteblau:

(funcall (sb-alien:define-alien-routine 
          ("disable_lossage_handler" cl-user::disable-sbcl-ldb) 
          sb-alien:void))

Thanks to Stas Boukarev for helping me test it.

update Pierre Mai suggested a better sb-alien technique:

 (sb-alien:alien-funcall
    (sb-alien:extern-alien "disable_lossage_handler" (function sb-alien:void)))

He has more helpful info in his comment. And the original author of ldb in CMUCL also chipped in.

Tags: lisp
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded  

  • 6 comments