2009/9/2 Volkan YAZICI <yazicivo@...>:
> Hi,
>
> I'm trying to interface with a foreign C library from SBCL (using CFFI)
> and having some troubles while calling the foreign function. The problem
> is that the called function skips some portion of the code -- i.e. some
> printf() statements get never executed within the code, despite it works
> without a problem if I make the same simple call from a C file. I'm not
> a C guru but am suspecting some stack re-alignment related stuff. Do you
> have any ideas?
>
> To be able to spot the problem, I tried to attach the SBCL session via
> gdb but had no success because of signals. Can anybody guide me to debug
> the foreign library function while SBCL is making a call to it?
The really short version is that you want to do something like
handle X nostop noprint pass
for at least SIGSEGV, and probably a few others as well. Once that is
done you need to pick your way carefully across SIGTRAPs: both GDB and
SBCL uses them -- except on Darwin where SBCL uses SIGILL which makes
things a bit easier. If you can manage your program not to run into
errors from traps (eg. type errors from declarations), then it should
not be too horrible.
If this is too terse, please provide more details on the signal issues
you run into.
Cheers,
-- Nikodemus
|