guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack traces


From: Amirouche
Subject: Re: Stack traces
Date: Sat, 18 Feb 2017 20:59:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0



Le 18/02/2017 à 17:58, Matt Wette a écrit :
On Feb 18, 2017, at 7:53 AM, Amirouche <address@hidden> wrote:
Le 18/02/2017 à 16:50, Amirouche a écrit :
Le 18/02/2017 à 01:13, Matt Wette a écrit :
(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)
It looks like that. Except `iter` should be defined in the namespace of the 
REPL.
Maybe iter is complicated, but at least sum and vals.
Hmm.   The procedure “foo” without the "(trap-here)” is just a simple program 
(using named let) that I want to debug.
So I add the “(trap-here)” to get into the debugger at that spot in the 
program, like I would add “pdb.set_trace()” in python.

Matt


How do you access variables in the REPL?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]