[erlang-questions] debug erlang core dumps with gdb

Caragea Silviu <>
Tue Sep 13 11:50:08 CEST 2016


Hello,

I'm using the last erlang package from Erlang Solution (19.0 - seems 19.0.3
is available only if you are using esl-erlang) and I want to debug a
generated core dump with GDB.

The issue I facing is that the beam.smp seems is not including debugging
symbols.

I inspired myself from:
https://www.erlang-solutions.com/blog/how-to-analyse-a-beam-core-dump.html

I changed a nif library I have to generate a crash.

when I run :

gdb my_project/rel/myapp/erts-8.0/bin/beam.smp
core.2_scheduler.14306.silviu-desktop.1473754498 -d
/home/silviu/Desktop/otp_src_19.0/erts/emulator

I get this warning first:

Reading symbols from my_project/rel/myapp/erts-8.0/bin/beam.smp ...(no
debugging symbols found)...done.

Then when I type backtrace:

#0  memset () at ../sysdeps/x86_64/memset.S:78
#1  0x00007ffa712a75cc in fill_window () from
/home/silviu/Desktop/my_project/rel/myapp/lib/ezlib-1.0/priv/ezlib_nif.so
#2  0x00007ffa712a7f20 in deflate_slow () from
/home/silviu/Desktop/my_project/rel/myapp/lib/ezlib-1.0/priv/ezlib_nif.so
#3  0x00007ffa712a8fd0 in deflate () from
/home/silviu/Desktop/my_project/rel/myapp/lib/ezlib-1.0/priv/ezlib_nif.so
#4  0x00007ffa712a6527 in process_buffer (session=0x7ffa71700968,
data=<optimized out>, len=<optimized out>) at c_src/ezlib.cc:103
#5  0x00007ffa712a6abb in nif_zlib_process_buffer (env=0x7ffaaa13de00,
argc=<optimized out>, argv=0x7ffab03c4180) at c_src/ezlib.cc:289
#6  0x000000000044426f in process_main ()
#7  0x00000000004ce1bd in ?? ()
#8  0x00000000005f2fcb in ?? ()
#9  0x00007ffaf10a2184 in start_thread (arg=0x7ffaaa13e700) at
pthread_create.c:312
#10 0x00007ffaf0bc737d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:111

I can see the stack correctly in the ezlib nif I have but not the erlang VM
which called the nif which shows as ?? because of the leak of symbols.

There is any way to fix this ?

Also I have a second problem when I try to run in gdb:

source /home/silviu/Desktop/otp_src_19.0/erts/etc/unix/etp-commands.in

I get:

%---------------------------------------------------------------------------
% Use etp-help for a command overview and general help.
%
% To use the Erlang support module, the environment variable ROOTDIR
% must be set to the toplevel installation directory of Erlang/OTP,
% so the etp-commands file becomes:
%     $ROOTDIR/erts/etc/unix/etp-commands
% Also, erl and erlc must be in the path.
%---------------------------------------------------------------------------
etp-set-max-depth 20
etp-set-max-string-length 100
--------------- System Information ---------------
OTP release: /home/silviu/Desktop/otp_src_19.0/erts/etc/unix/
etp-commands.in:3812: Error in sourced command file:
Cannot access memory at address 0x38003931

Any idea what can be wrong ?

Silviu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160913/b782dd0a/attachment.html>


More information about the erlang-questions mailing list