[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Stack traces
From: |
Matt Wette |
Subject: |
Re: Stack traces |
Date: |
Fri, 17 Feb 2017 16:13:45 -0800 |
> On Feb 15, 2017, at 7:36 AM, Christopher Allan Webber <address@hidden> 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]>
- Re: guile-user Digest, Vol 171, Issue 14, Cecil McGregor, 2017/02/14
- Re: guile-user Digest, Vol 171, Issue 14, Christopher Allan Webber, 2017/02/14
- Re: guile-user Digest, Vol 171, Issue 14, Amirouche, 2017/02/14
- Stack traces, Ludovic Courtès, 2017/02/14
- Re: Stack traces, Christopher Allan Webber, 2017/02/15
- Re: Stack traces, Matt Wette, 2017/02/15
- Re: Stack traces,
Matt Wette <=
- Re: Stack traces, Amirouche, 2017/02/18
- Re: Stack traces, Amirouche, 2017/02/18
- Re: Stack traces, Matt Wette, 2017/02/18
- Re: Stack traces, Amirouche, 2017/02/18
- Re: Stack traces, Matt Wette, 2017/02/18
- Re: Stack traces, Andy Wingo, 2017/02/27
- Re: Stack traces, Amirouche, 2017/02/27