unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: guile-devel <guile-devel@gnu.org>, guile-user@gnu.org
Subject: Break-when [was GNU Guile 2.1.7 released (beta)]
Date: Thu, 23 Feb 2017 16:52:08 -0800	[thread overview]
Message-ID: <9137232F-0A6A-4E77-B14F-C1367F5AA72E@gmail.com> (raw)
In-Reply-To: <1253648402.3519089.1487880266545@mail.yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]


> On Feb 23, 2017, at 12:04 PM, Mike Gran <spk121@yahoo.com> wrote:
> 
> * Some helper funcs for debugging.  For example, I just found
>  out (after a decade) that Guile comes with its own pk.  Also,
>  a "break REPL here when condition is true" procedure would
>  be great.  I've sometimes rolled my own with ",break acos" and
>  adding (acos 0.0) for the location in question.
> 

I am playing with this.  Now reading through system/repl/* and system/vm/* to understand the debugger.

Try

(use-modules (system repl repl))
(use-modules (system repl debug))

(define-syntax-rule (trap-here-0)
  (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-0)
    (cond
     ((null? vals) sum)
     (else (iter (+ sum (car vals)) (cdr vals))))))

(foo)

I have added some debugger commands: 
,loc - show current location
,qq - really quit (calls primitive-exit)

scheme@(guile-user) [1]> ,loc
      (let iter ((sum 0) (vals '(1 2 3 5 8 2)))
*       (trap-here-0)
        (cond
scheme@(guile-user) [1]> ,qq
mwette$ 


[-- Attachment #2: Type: text/html, Size: 7432 bytes --]

  parent reply	other threads:[~2017-02-24  0:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18 10:31 GNU Guile 2.1.7 released (beta) Andy Wingo
2017-02-18 14:34 ` GNU Guile 2.1.7 released (beta), SOCK_NONBLOCK Matt Wette
2017-02-21 20:58   ` Andy Wingo
2017-02-18 17:40 ` GNU Guile 2.1.7 released (beta) Matt Wette
2017-02-18 17:48 ` Matt Wette
2017-02-23 18:54 ` Andy Wingo
2017-02-23 20:04   ` Mike Gran
2017-02-23 21:06     ` Andy Wingo
2017-02-24  0:52     ` Matt Wette [this message]
2017-02-24 14:02   ` Andy Wingo
2017-02-24 17:46   ` Arne Babenhauserheide
2017-02-26 17:57     ` Andy Wingo
2017-02-27 19:32       ` Mike Gran
2017-02-27 20:30         ` Andy Wingo
2017-02-27 23:00       ` Thomas Morley
2017-02-28  8:31         ` Andy Wingo
2017-03-05 16:54           ` Thomas Morley
2017-03-01 18:04       ` Arne Babenhauserheide
2017-02-28  0:04   ` David Pirotte
2017-02-28  1:49     ` Daniel Llorens
2017-03-02 20:54       ` David Pirotte

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=9137232F-0A6A-4E77-B14F-C1367F5AA72E@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=guile-devel@gnu.org \
    --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).