Email or username:

Password:

Forgot your password?
Top-level
Ramin Honary
> "Trying to figure out how to work with #guile #scheme in #gdb (gnu debugger) today for the most part of the day. Investigating sigsegv error in the scheme project of mine. Found no examples."

@shegeley you should probably install the developer build of Guile, something like "guile-3.0-dev" in the Debian (and derivative) Linux repositories.

Then what I do is actually run the whole Guile interpreter in GDB. Here is a script I use, I call it "gdb-guile.sh":

#! /bin/sh
gdb \
  -ex 'handle SIGXCPU nostop' \
  -ex 'handle SIGPWR nostop' \
  -ex 'run' \
  --args \
    guile "${@}";

To run it, I simply type

./gdb-guile.sh my-program.scm --args=to --my=program

If you use Emacs and Geiser, you can try setting the "geiser-guile-binary" variable to the full path of "gdb-guile.sh", I ususally set it in my ".dir-locals.el".

7 comments
Grigory Shepelev

@ramin_hal9001 thanks a lot. will try today or tomorrow morning

Grigory Shepelev

@ramin_hal9001 I wonder if I can do that with guile-ares?

I'd like to plug something like:

-- args \
guile -L ./src -e "((@ (nrepl\ server) run-nrepl-server) #:port 7888)" (if that's a good idea)
but it expects file.

Grigory Shepelev

@ramin_hal9001 and how do you "switch" between gdb and guile when it's running in ddb?

Grigory Shepelev

@ramin_hal9001 I don't understand why it won't load symbols

Ramin Honary
> "I don't understand why it won't load symbols"

@shegeley do you mean GDB will not load the debugging symbols for your C program? I assume your are building a dynamically linked library with the GCC "-fPIC -shared" options?

So I don't think ".so" files contain debug symbols unless you also pass the "-ggdb" option. I can't remember well, but I think it is something like:

gcc -fPIC -shared -ggdb my-library.c -o my-library.so

Here is the relevant section of the GCC manual.

Grigory Shepelev

@ramin_hal9001 no. i mean how to I run gcc with guile script and get symbols for it in a sigsegv backtrace

Ramin Honary
> "i mean how to I run gcc with guile script and get symbols for it in a sigsegv backtrace"

@shegeley you should make sure that the ".so" files being loaded by Guile have their debugging symbols available. If for example you are linking against "libgtk-3.so" and the crash occurs in this file, the symbol table is probably not available unless you install those from your package manager, or build the whole Gtk3 library yourself with the "-g" flag included in your "CC_FLAGS" environment setting when running the "./configure" autoconf script for Gtk.

I am pretty sure you can accomplish this with the Guix package manager, but I am not sure exactly how.

> "i mean how to I run gcc with guile script and get symbols for it in a sigsegv backtrace"

@shegeley you should make sure that the ".so" files being loaded by Guile have their debugging symbols available. If for example you are linking against "libgtk-3.so" and the crash occurs in this file, the symbol table is probably not available unless you install those from your package manager, or build the whole Gtk3 library yourself with the "-g" flag included in your "CC_FLAGS" environment setting when running the "

Go Up