guile-user
[Top][All Lists]
Advanced

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

Break-when [was GNU Guile 2.1.7 released (beta)]


From: Matt Wette
Subject: Break-when [was GNU Guile 2.1.7 released (beta)]
Date: Thu, 23 Feb 2017 16:52:08 -0800

> On Feb 23, 2017, at 12:04 PM, Mike Gran <address@hidden> 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$ 



reply via email to

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