[erlang-questions] how can I debug errors in linked-in drivers or nif loaded as shared library?

caox caox@REDACTED
Sat Dec 25 16:45:02 CET 2010


thanks a lot. I will try it.
在 2010-12-24,下午9:59, Kevin A. Smith 写道:

> I've edited the erl script which comes with the standard Erlang release to allow easy use of GDB for just such situations:
> 
> if [ ! -z "$USE_GDB" ]; then
> gdb $BINDIR/erlexec --args $BINDIR/erlexec ${1+"$@"}
> else
> exec $BINDIR/erlexec ${1+"$@"}
> fi
> 
> #exec $BINDIR/erlexec ${1+"$@"}
> 
> Define the env var "USE_GDB" before launching Erlang and you'll get a debugger prompt when your NIF/driver crashes. GDB's backtrace command is especially helpful :-)
> 
> Credit to Dave Smith @ Basho for originally suggesting this approach.
> 
> --Kevin
> 
> On Dec 24, 2010, at 4:09 AM, caox wrote:
> 
>> hi
>> 
>> 	I got a segmentation fault and a core.dump file when tested my linked-in driver. How could I debug it with gdb?
>> 	For an executable c file, we can just call 'gdb a.out core.dump'. How can I do this for a .so file loaded by erlang?
>>       Thanks.
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>> 
> 



More information about the erlang-questions mailing list