Re: Debugger : Can't see local variables when stepping
Jérôme Radix <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.general |
|---|---|
| Message-ID | <CAAyNt77Vo7YskrDpmtdr5C1=ZgOyxuVKqvhOBi7ioD3rfGNHEA@mail.gmail.com> |
Thanks Martin. It works when using (BREAK) after declaring local variables. But does that mean that stepping through code using the debugger can't show new local variables declared after (BREAK) ? How can I have my local variables automatically detected/shown when stepping through code using the debugger, like in other languages debuggers? Regards, Jérôme. Le lun. 18 mars 2024 à 11:25, eMko <[email protected]> a écrit : > Hi, > > if you put `(break)` into the `let` form, you will be able to see the > variable (tested with SBCL 2.4.1 on Windows, the Roswell build). > > (defun foo (var1) > (let ((var2 (subseq var1 0 10))) > (break) > (dotimes (i 10 (fresh-line)) > (format t "~C" (char var2 i))))) > > SLY: > > break > [Condition of type SIMPLE-CONDITION] > > Restarts: > 0: [CONTINUE] Return from BREAK. > 1: [RETRY] Retry SLY mREPL evaluation request. > 2: [*ABORT] Return to SLY's top level. > 3: [ABORT] abort thread (#<THREAD "sly-channel-1-mrepl-remote-1" RUNNING > {1001160003}>) > > Backtrace: > 0: (FOO "hello world") > Locals: > VAR1 = "hello world" > VAR2 = "hello worl" > > Hope that helps. > > Martin > > On Mon, Mar 18, 2024 at 10:25 AM Jérôme Radix <[email protected]> > wrote: > >> Hello, >> >> When using the debugger, I can't figure out how to see the value of I and >> VAR2 in my little test code, even with (debug 3) optimization setting: >> (defun foo (var1) >> (break) >> (let ((var2 (subseq var1 0 10))) >> (dotimes (i 10 (fresh-line)) >> (format t "~C" (char var2 i))))) >> >> (foo "Hello World") >> >> Here is the transcript of my session, on linux >> 5.15.146.1-microsoft-standard-WSL2: >> >> $ sbcl --no-sysinit --no-userinit >> This is SBCL 2.3.4, an implementation of ANSI Common Lisp. >> More information about SBCL is available at <http://www.sbcl.org/>. >> >> SBCL is free software, provided as is, with absolutely no warranty. >> It is mostly in the public domain; some portions are provided under >> BSD-style licenses. See the CREDITS and COPYING files in the >> distribution for more information. >> * (declaim (optimize (debug 3))) >> NIL >> * (sb-ext:describe-compiler-policy) >> Basic qualities: >> COMPILATION-SPEED = 1 >> DEBUG = 3 >> SAFETY = 1 >> SPACE = 1 >> SPEED = 1 >> INHIBIT-WARNINGS = 1 >> Dependent qualities: >> SB-C::CHECK-CONSTANT-MODIFICATION = 1 -> 1 (maybe) >> SB-C::TYPE-CHECK = 1 -> 3 (full) >> SB-C::LET-CONVERSION = 1 -> 0 (off) >> SB-C:ALIEN-FUNCALL-SAVES-FP-AND-PC = 1 -> 3 (yes) >> SB-C:VERIFY-ARG-COUNT = 1 -> 3 (yes) >> SB-C::INSERT-DEBUG-CATCH = 1 -> 3 (yes) >> SB-C::RECOGNIZE-SELF-CALLS = 1 -> 0 (no) >> SB-C::FLOAT-ACCURACY = 1 -> 3 (full) >> SB-C:INSERT-STEP-CONDITIONS = 1 -> 3 (full) >> SB-C::COMPUTE-DEBUG-FUN = 1 -> 3 (yes) >> SB-C:STORE-SOURCE-FORM = 1 -> 3 (yes) >> SB-C::PRESERVE-SINGLE-USE-DEBUG-VARIABLES = 1 -> 3 (yes) >> SB-C::PRESERVE-CONSTANTS = 1 -> 0 (no) >> SB-C:INSERT-ARRAY-BOUNDS-CHECKS = 1 -> 3 (yes) >> SB-C::AREF-TRAPPING = 1 -> 0 (no) >> SB-C::STORE-XREF-DATA = 1 -> 3 (yes) >> SB-C:STORE-COVERAGE-DATA = 1 -> 0 (no) >> SB-C:INSTRUMENT-CONSING = 1 -> 1 (no) >> SB-C::STORE-CLOSURE-DEBUG-POINTER = 1 -> 0 (no) >> * (defun foo (var1) >> (break) >> (let ((var2 (subseq var1 0 10))) >> (dotimes (i 10 (fresh-line)) >> (format t "~C" (char var2 i))))) >> FOO >> * (foo "Hello World") >> >> debugger invoked on a SIMPLE-CONDITION in thread >> #<THREAD tid=1590 "main thread" RUNNING {1001090003}>: >> 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. >> >> (FOO "Hello World") >> source: (BREAK) >> 0] start >> ; Evaluating call: >> ; (SUBSEQ VAR1 0 10) >> ; With arguments: >> ; "Hello World" >> ; 0 >> ; 10 >> >> 1] step >> ; (SUBSEQ VAR1 0 10) => "Hello Worl" >> ; Evaluating call: >> ; (+ I 1) >> ; With unknown arguments >> H >> 0] step >> ; Evaluating call: >> ; (+ I 1) >> ; With unknown arguments >> e >> 0] L >> VAR1 = "Hello World" >> >> ==> I want to see the value of I and VAR2. What am I doing wrong ? >> I've tried several combinations of (declaim (optimize (debug 3) (space 0) >> (safety 3) (speed 0))) with no difference in behavior. >> >> Thanks for your help. >> >> Regards, >> Jérôme. >> _______________________________________________ >> Sbcl-help mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/sbcl-help >> > _______________________________________________ Sbcl-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sbcl-help