Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppressing Some SBCL Debugger Output on Break

The debugger can be programmatically invoked by executing (break). For example, the debugging banner then displays what caused the interrupt, the HELP line, the available restarts, some related info, and finally the source of the interrupt:

debugger invoked on a SIMPLE-CONDITION in thread
#<THREAD "main thread" RUNNING {10010B0523}>:
  break

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

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

#(
NODE: STATE=<NIL NIL NIL 0.0 0.0
(         )> DEPTH=0)
#(
NODE: STATE=<NIL NIL NIL 0.0 0.0
((ACTIVE GATE1) (ACTIVE GATE2) (COLOR RECEIVER1 BLUE) (COLOR RECEIVER2 RED) (COLOR TRANSMITTER1 BLUE) (COLOR TRANSMITTER2 RED) (FREE ME) (LOC CONNECTOR1 AREA5) (LOC CONNECTOR2 AREA7) (LOC ME AREA5))> DEPTH=0)
(DF-BNB1 )
   source: (BREAK)
0]

I don't understand the related info between the restarts and the source. Can this info be suppressed, as sometimes it is many lines long in my application. I've tried changing the debug & safety optimization settings, but to no effect.

like image 491
davypough Avatar asked Jan 30 '26 10:01

davypough


1 Answers

The output you are confused with is related to the place in the code where break was invoked. When I call it from the vanilla Lisp REPL (without SLIME), it displays:

(SB-INT:SIMPLE-EVAL-IN-LEXENV (BREAK) #<NULL-LEXENV>)

However, if I do something wrong in the debugger, here's what happens:

0] q
; in: PROGN (PRINT 1)
;     (PROGN Q)
; 
; caught WARNING:
;   undefined variable: COMMON-LISP-USER::Q
; 
; compilation unit finished
;   Undefined variable:
;     Q
;   caught 1 WARNING condition

debugger invoked on a UNBOUND-VARIABLE in thread
#<THREAD "main thread" RUNNING {10005204C3}>:
  The variable Q is unbound.

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

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE   ] Retry using Q.
  1: [USE-VALUE  ] Use specified value.
  2: [STORE-VALUE] Set specified value and use it.
  3: [ABORT      ] Reduce debugger level (to debug level 1).
  4:               Return from BREAK.
  5:               Exit debugger, returning to top level.

((LAMBDA (#:G498)) #<unused argument>)
   source: (PROGN Q)

You can see that the last line resembles the output you got with the line starting at source:. Actually, the output we saw consists of 3 main parts: 1. Description of the condition 2. Listing of the available restarts 3. Debug REPL prompt printed by debug-loop-fun

The last output is part of the prompt and it is generated by the invocation of:

(print-frame-call *current-frame* *debug-io* :print-frame-source t)

So, you can recompile the call providing :print-frame-source nil or try to understand why your current frame looks this way...

like image 122
Vsevolod Dyomkin Avatar answered Feb 02 '26 11:02

Vsevolod Dyomkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!