From: Robert Brown <robert.brown@gm...> - 2011-08-09 16:51:45
Does anyone have a working GDB init file for debugging null
pointer dereference problems in shared libraries loaded into an
SBCL that's running on x86 Linux?
The problem only occurs if the C code is called after restarting
a saved image. The library is loaded with CFFI.
I'm currently using
handle SIGSEGV noprint nostop
handle SIGTRAP nostop pass
handle SIG35 nostop
handle SIGUSR1 nostop
but it's not perfect.
On 9 August 2011 19:51, Robert Brown <robert.brown@...> wrote:
> The problem only occurs if the C code is called after restarting
> a saved image. The library is loaded with CFFI.
I have a guess what the issue is, actually: a foreign pointer left in
the image from before saving the core.
> I'm currently using
> handle SIGSEGV noprint nostop
> handle SIGTRAP nostop pass
> handle SIG35 nostop
> handle SIGUSR1 nostop
Building SBCL with :ud2-breakpoints added to *features* via
customize-target-features.lisp makes it more GDB-friendly, as that
makes it use SIGILL for its own traps, so you are able to use GDB
breakpoints -- which also use SIGTRAP.
Then you can set a GDB breakpoint on entry to foreign code, and turn
on SIGSEGV handling in GDB.
Breaking on unhandled_sigmemoryfault() may also be useful: it's an
empty C function SBCL calls when it gets a SIGSEGV in foreign memory.