IRC channel logs

2026-01-17.log

back to list of logs

<dsmith>sneek, botsnack
<sneek>:)
<ieure>Does Guile have a single-step debugger, akin to C-u C-M-x on a defun in elisp?
<ieure>Have an error I'm not understanding and the stack trace is unhelpful, stepping through the code would be illuminating.
<ieure>Well... figured out the error, but I'd still like to also understand how debuggable Guile is.
<ieure>Mm. Looks like CL `TRACE' style is supported by (system vm trace). Better, but not as good as single-step.
<sneek>mwette: Greetings :D
<mwette>sneek: botsnack
<sneek>:)
<mwette>ieure: bytecode debugging; in repl, type ,help debug
<ieure>mwette, Thank you!
<old>Code source stepping debugger is really something I miss when working with Guile
<old>I can get around most of the time with just some `pk', but really I think that this kind of tooling is critical for a programming language. I know somebody made a POC similar to Python pdb, but realy the core guile should probably make one
<civodul>old: we’ve had this debate several times at the Guix Days and online and i think old farts like me basically say “pk is all you need” :-)
<civodul>i’m simplifying but that’s the gist of it
<civodul>(the REPL does have breakpoints & co. but i rarely use it or feel a need for it)
<mwette>There seems to be a lot of infrastructure for debugging, but I think there is work remaining, like getting the source information pushed through to the running code (meta info in cps and assembler).
<mwette>I looked into this a while ago but ran out of energy to work on it.
<civodul>yeah, that too
<old>Yes. But debugging with pk is sometime not doable. Think of when using fibers for example
<civodul>(i should add that my view is not Stockholm syndrome)
<civodul>ah yes, debugging Fibers code is difficult
<civodul>as i said in my Shepherd talk last year, i miss something like “thread apply all bt”
<civodul>(among other things)
<old>also pk does not allow you to capture the arguments. For example, I have a function that raise an exception. I would very much link to somehow capture a thunk in the REPL to invoke the functions with the exact same arguments while I modify this functions
<ieure>What is "pk?" I see no reference in the Guile procedure index or ,help debug output in the REPL.
<old>I guess this could be done with call/cc, but I'm not sure how to integrate that well with the REPL
<civodul>old: i guess you get close to this with recursive REPLs
<old>ieure: I think pk was added in the manual lately. It's basically printing its arguments inside a list a returning the last value
<old>(pk 'foo 1 2 3) -| ;; (foo 1 2 3)
<old>=> 3
<ieure>Gotcha, okay, I see it: https://www.gnu.org/software/guile/manual/html_node/Simple-Debugging.html#index-pk
<ieure>Still on 3.0.9 on Guix.
<old>civodul: I would need to see that, because I never managed to do so. Coming from the C world, I'm still not familiar with the REPL workflow after all these years of Guiling
<civodul>old: did you try ,bt ,locals and all that, for instance upon an uncaught exception at the REPL?
<civodul>ieure: pk was left undocumented for ~25y :-)
<civodul>it was tribal knowledge
<civodul>we’re making progress!
<old>civodul: in my experience, locals will work after two ,stepi
<old>otherwhise I get nothing (when using breakpoint)
<old>might be different with exception not sure
<civodul>ah yes, depends on where you are in the procedure body and what level of optimization is on
<mwette>In my experience, compiling code w/ -O0 (or -O1) helps.
<old>But in the REPL, the defualt optimization ought to be something like -O0 with debug VM right?
<old>like in Geiser
<mwette>((@ (system base compile) default-optimization-level)) => 2
<mwette>you can add arg to set to zero
<mwette>((@ (system base compile) default-optimization-level) 0)
<old>yeah but the REPL has its own thing I believe
<old>But I guess I could change that in .guile
<old>optimization-level #f
<old>Dang so I guess it default to the default-optimization-level then
<old>dang it's not in the manual!
<old>optimization-level, warning-level and trace are REPL options not documented
<old>Ohh really wish compound exception were not flatten in `make-exception' :( this loose tree-structure