unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* tracepoints, source breakpoints
@ 2010-09-24 15:35 Andy Wingo
  2010-09-27 13:32 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Wingo @ 2010-09-24 15:35 UTC (permalink / raw)
  To: guile-devel

Hi,

I have (re-)implemented tracepoints in Guile, which print out when a
procedure is called.

    scheme@(guile-user)> ,tracepoint resolve-module
    Trap 0: Tracepoint at #<procedure b038e0 at ice-9/boot-9.scm:2234:4 (name #:optional autoload version #:key ensure)>.
    scheme@(guile-user)> (use-modules (ice-9 popen))
    Trap 0: (#<procedure b038e0 at ice-9/boot-9.scm:2234:4 (name #:optional...> #)
    Trap 0: #<module (guile) 9fde10>
    Trap 0: (#<procedure b038e0 at ice-9/boot-9.scm:2234:4 (name #:optional...> #)
    Trap 0: #<module (guile) 9fde10>
    Trap 0: (#<procedure b038e0 at ice-9/boot-9.scm:2234:4 (name #:optional...> ...)
    Trap 0: #<directory (ice-9 popen) 12d8bd0>
    scheme@(guile-user)> (define (fibo n)
    ... (if (< n 2)
    ... 1
    ... (+ (fibo (- n 1))
    ... (fibo (- n 2)))))
    scheme@(guile-user)> ,tracepoint fibo
    Trap 1: Tracepoint at #<procedure fibo (n)>.
    scheme@(guile-user)> (fibo 4)
    Trap 1: (fibo 4)
    Trap 1: |(fibo 3)
    Trap 1: ||(fibo 2)
    Trap 1: |||(fibo 1)
    Trap 1: |||1
    Trap 1: |||(fibo 0)
    Trap 1: |||1
    Trap 1: ||2
    Trap 1: ||(fibo 1)
    Trap 1: ||1
    Trap 1: |3
    Trap 1: |(fibo 2)
    Trap 1: ||(fibo 1)
    Trap 1: ||1
    Trap 1: ||(fibo 0)
    Trap 1: ||1
    Trap 1: |2
    Trap 1: 5
    $1 = 5

Tracepoints and breakpoints are "traps", which can enabled and disabled
and listed with the "enable", "disable", "delete", and "traps" REPL
meta-commands.

I can also break at source locations now:

    scheme@(guile-user)> ,break-at-source "ice-9/boot-9.scm" 2242
    Trap 2: Breakpoint at ice-9/boot-9.scm:2242.
    scheme@(guile-user)> (resolve-module '(ice-9 popen))
    Trap 0: (#<procedure b038e0 at ice-9/boot-9.scm:2234:4 (name #:optional...> #)
    Trap 2: Breakpoint at ice-9/boot-9.scm:2242
    Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
    scheme@(guile-user) [1]> ,bt
    In ice-9/boot-9.scm:
      2242:14  0 (#<procedure b038e0 at ice-9/boot-9.scm:2234:4 (na...> ...)
    scheme@(guile-user) [1]> ,q
    Trap 0: #<directory (ice-9 popen) 12d8bd0>
    $2 = #<directory (ice-9 popen) 12d8bd0>

Here we see that tracepoints and breakpoints interoperate well.

The next step is to implement "step", "next", and "finish" commands, and
after that I'm going to stop work on the debugger, I think. There's
already a lot of documentation to update :P

Happy hacking,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tracepoints, source breakpoints
  2010-09-24 15:35 tracepoints, source breakpoints Andy Wingo
@ 2010-09-27 13:32 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2010-09-27 13:32 UTC (permalink / raw)
  To: guile-devel

Hi!

Andy Wingo <wingo@pobox.com> writes:

> Tracepoints and breakpoints are "traps", which can enabled and disabled
> and listed with the "enable", "disable", "delete", and "traps" REPL
> meta-commands.
>
> I can also break at source locations now:
>
>     scheme@(guile-user)> ,break-at-source "ice-9/boot-9.scm" 2242
>     Trap 2: Breakpoint at ice-9/boot-9.scm:2242.
>     scheme@(guile-user)> (resolve-module '(ice-9 popen))
>     Trap 0: (#<procedure b038e0 at ice-9/boot-9.scm:2234:4 (name #:optional...> #)
>     Trap 2: Breakpoint at ice-9/boot-9.scm:2242
>     Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
>     scheme@(guile-user) [1]> ,bt
>     In ice-9/boot-9.scm:
>       2242:14  0 (#<procedure b038e0 at ice-9/boot-9.scm:2234:4 (na...> ...)
>     scheme@(guile-user) [1]> ,q
>     Trap 0: #<directory (ice-9 popen) 12d8bd0>
>     $2 = #<directory (ice-9 popen) 12d8bd0>
>
> Here we see that tracepoints and breakpoints interoperate well.

Woow, excellent!  :-)

Ludo’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-27 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-24 15:35 tracepoints, source breakpoints Andy Wingo
2010-09-27 13:32 ` Ludovic Courtès

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).