> On Feb 15, 2017, at 7:36 AM, Christopher Allan Webber > <cweb...@dustycloud.org> wrote: > > One thing that we see requested a lot is how to do the equivalent of: > > import pdb > pdb.set_trace() > > in python, just dumping something to "trigger" the debugger somewhere. > I seem to remember getting some arcane code to do something similar, but > maybe we can just have a simple invocation that people could put > anywhere. (Amirouche has been raising this one also I think.) >
I am playing with this. It does dump me into the debugger but the interaction is not wonderful (like pdb.set_trace()). However, this is context for working in that direction (i.e., pdb.set_trace()): mwette$ cat trapper.scm (use-modules (system repl repl)) (use-modules (system repl debug)) (define-syntax-rule (trap-here) (start-repl #:debug (make-debug (stack->vector (make-stack #t)) 0 "trap!" #t))) (define (foo) (let iter ((sum 0) (vals '(1 2 3 5 8 2))) (trap-here) (if (null? vals) sum (iter (+ sum (car vals)) (cdr vals))))) (foo) mwette$ guile GNU Guile 2.0.13 […] scheme@(guile-user)> (load "trapper.scm") […] scheme@(guile-user) [1]> ,bt […] In /Users/mwette/proj/scheme/myproj/potluck/trapper.scm: 10:4 1 (foo) In unknown file: 0 (make-stack #t) scheme@(guile-user) [1]>