Previous: Debugger Banner, Up: Debugger Entry


4.1.2 Debugger Invokation

The debugger is invoked when:

When the debugger is invoked by a condition, ANSI mandates that the value of *debugger-hook*, if any, be called with two arguments: the condition that caused the debugger to be invoked and the previous value of *debugger-hook*. When this happens, *debugger-hook* is bound to NIL to prevent recursive errors. However, ANSI also mandates that *debugger-hook* not be invoked when the debugger is to be entered by the break function. For users who wish to provide an alternate debugger interface (and thus catch break entries into the debugger), SBCL provides sb-ext:*invoke-debugger-hook*, which is invoked during any entry into the debugger.

— Variable: sb-ext:*invoke-debugger-hook*

This is either nil or a designator for a function of two arguments, to be run when the debugger is about to be entered. The function is run with *invoke-debugger-hook* bound to nil to minimize recursive errors, and receives as arguments the condition that triggered debugger entry and the previous value of *invoke-debugger-hook*

This mechanism is an sbcl extension similar to the standard *debugger-hook*. In contrast to *debugger-hook*, it is observed by invoke-debugger even when called by break.