From: Matt Wette <matt.wette@gmail.com>
To: Amirouche <amirouche@hypermove.net>
Cc: guile-user@gnu.org
Subject: Re: Stack traces
Date: Sat, 18 Feb 2017 08:58:58 -0800 [thread overview]
Message-ID: <34F40DF4-899A-4400-A2F6-820EFB3C66FD@gmail.com> (raw)
In-Reply-To: <a7eadea9-a7fe-4044-8f67-21dc733fda9e@hypermove.net>
> On Feb 18, 2017, at 7:53 AM, Amirouche <amirouche@hypermove.net> 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
next prev parent reply other threads:[~2017-02-18 16:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.52572.1487077879.22737.guile-user@gnu.org>
2017-02-14 17:24 ` guile-user Digest, Vol 171, Issue 14 Cecil McGregor
2017-02-14 19:19 ` Christopher Allan Webber
2017-02-14 22:00 ` Amirouche
2017-02-14 22:16 ` Stack traces Ludovic Courtès
2017-02-15 15:36 ` Christopher Allan Webber
2017-02-16 1:10 ` Matt Wette
2017-02-18 0:13 ` Matt Wette
2017-02-18 15:50 ` Amirouche
2017-02-18 15:53 ` Amirouche
2017-02-18 16:58 ` Matt Wette [this message]
2017-02-18 19:59 ` Amirouche
2017-02-18 20:31 ` Matt Wette
2017-02-27 20:23 ` Andy Wingo
2017-02-27 20:40 ` Amirouche
2017-05-18 13:38 ` Christopher Allan Webber
2017-05-19 3:05 ` Matt Wette
2017-05-19 9:17 ` Andy Wingo
2017-06-10 9:58 ` Catonano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34F40DF4-899A-4400-A2F6-820EFB3C66FD@gmail.com \
--to=matt.wette@gmail.com \
--cc=amirouche@hypermove.net \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).