1

gdb has support for guile. I am trying to use the debugging capability.

Here is my attempt:

  • enter an interactive session with 'gr' command.
  • load a scheme file.
  • set a breakpoint to a procedure called create_branches.
  • finally call create_tree which calls create_branches.

I expect that calling (tree 3) would trigger the breakpoint. But it does not happen? Why?

This is stackoverflow_42404315.scm:

(define (tree n)
  (create_trunk)
  (create_branches n))

(define (create_trunk)
  1)

(define (create_branches n)
  n)

This is gdb session:

bash-3.2$ gdb
GNU gdb (GDB) 7.10
(gdb) gr
GNU Guile 2.0.12
scheme@(guile-user)> ,load "stackoverflow_42404315.scm"
scheme@(guile-user)> ,break create_branches
Trap 0: Breakpoint at #<procedure create_branches (n)>.
scheme@(guile-user)> (tree 3)
$1 = 3
scheme@(guile-user)> ,traps
  0: Breakpoint at #<procedure create_branches (n)>
KHL
  • 316
  • 2
  • 6
  • I'm not sure gdb has any effect, positive or negative, on guile breakpoints. If you run `guile` from the shell instead of from gdb, do you see the same issue? – Mark Plotnick Feb 23 '17 at 17:49
  • Thanks for the reply. If I just run guile, then I will enter a scheme interpreter with no debugging capability. – KHL Feb 23 '17 at 23:54
  • If you run `guile` and type `,help break`, does it give an error? If so, can you run `guile --version` and tell us what it says? – Mark Plotnick Feb 24 '17 at 15:07
  • scheme@(guile-user)> ,help break Usage: break PROCEDURE Break on calls to PROCEDURE. Starts a recursive prompt when PROCEDURE is called. – KHL Feb 27 '17 at 01:05
  • Good. Can you try setting the breakpoint in your program using the standalone guile? If it fails there, we can take gdb out of consideration and concentrate on just guile. Can you post a small scheme program that illustrates the bug? – Mark Plotnick Feb 27 '17 at 08:50
  • Hi Mark, thanks for the comment. I have edited my question to be more illustrative. – KHL Feb 28 '17 at 00:10
  • Sorry, I couldn't reproduce your problem on Linux (Ubuntu, using guile 2.0.12 compiled from source). The breakpoint gets triggered.. What OS are you using and where were gdb and guile downloaded from? – Mark Plotnick Feb 28 '17 at 13:22
  • I use macOS Sierra 10.12.3. Guile is built and installed using home brew. GDB is compiled from source, ftp://sourceware.org/pub/gdb/releases/ . – KHL Feb 28 '17 at 22:37
  • I reinstall guile. This time I could trigger the breakpoints! I think the problem was that I installed guile before I installed gdb with guile support. @MarkPlotnick Thanks for being here! – KHL Mar 01 '17 at 00:21

0 Answers0