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-questio...@erlang.org
If I remember correctly, you should use the path to the erl binary in
place of 'a.out'.
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