Skip to content

Instantly share code, notes, and snippets.

@charlieb
Created March 6, 2022 05:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlieb/a8cbcf6ee2daef2a366c41a19ff801b6 to your computer and use it in GitHub Desktop.
Save charlieb/a8cbcf6ee2daef2a366c41a19ff801b6 to your computer and use it in GitHub Desktop.
Guile immediate segfault under gdb
#include <libguile.h>
static void inner_main (void *closure, int argc, char **argv)
{
//scm_shell(argc, argv);
}
int main(int argc, char **argv) {
scm_boot_guile(argc, argv, inner_main, 0);
return 0;
}
/* Compiled on Arch Linux with: gcc $(pkg-config --cflags -libs guile-2.2) main.c -o test
$ gdb test
GNU gdb (GDB) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test...
(No debugging symbols found in test)
(gdb) r
Starting program: /home/charlieb/src/guile_test/test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7df905e in ?? () from /usr/lib/libgc.so.1
(gdb) bt
#0 0x00007ffff7df905e in ?? () from /usr/lib/libgc.so.1
#1 0x00007ffff7e08330 in GC_init () from /usr/lib/libgc.so.1
#2 0x00007ffff7eb0fb8 in ?? () from /usr/lib/libguile-2.2.so.1
#3 0x00007ffff7ebadb3 in ?? () from /usr/lib/libguile-2.2.so.1
#4 0x00007ffff7f14c21 in ?? () from /usr/lib/libguile-2.2.so.1
#5 0x00007ffff7f14d3e in ?? () from /usr/lib/libguile-2.2.so.1
#6 0x00007ffff7e03507 in GC_call_with_stack_base () from /usr/lib/libgc.so.1
#7 0x00007ffff7f14e79 in scm_with_guile () from /usr/lib/libguile-2.2.so.1
#8 0x00007ffff7ebad24 in scm_boot_guile () from /usr/lib/libguile-2.2.so.1
#9 0x0000555555555174 in main ()
Runs OK without gbd and valgrind is ok
$ valgrind test
==9688== Memcheck, a memory error detector
==9688== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==9688== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==9688== Command: test
==9688==
==9688==
==9688== HEAP SUMMARY:
==9688== in use at exit: 0 bytes in 0 blocks
==9688== total heap usage: 30 allocs, 30 frees, 4,065 bytes allocated
==9688==
==9688== All heap blocks were freed -- no leaks are possible
==9688==
==9688== For lists of detected and suppressed errors, rerun with: -s
==9688== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
*/
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment