Can't see symbols from Erlang NIF library in core file

Attila Rajmund Nohl attila.r.nohl@REDACTED
Tue Jul 20 19:37:58 CEST 2021


I'm working on an Erlang wrapper over a 3rd party C library on Ubuntu
Linux on x86, so I'm creating a NIF. Sometimes my code (I think)
crashes, resulting in a core file. Unfortunately the stacktrace is not
really helpful:

(gdb) bt
#0  0x00007fc22229968a in ?? ()
#1  0x0000000060e816d8 in ?? ()
#2  0x0000000007cd48b0 in ?? ()
#3  0x00007fc228031410 in ?? ()
#4  0x00007fc228040b80 in ?? ()
#5  0x00007fc228040c50 in ?? ()
#6  0x00007fc22223de0b in ?? ()
#7  0x0000000000000000 in ?? ()

even though I built my NIF .so file with debug info:

ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically
linked, BuildID[sha1]=b70dd1f2450f5c0e9980c8396aaad2e1cd29024c, with
debug_info, not stripped

The beam binary also has debug info:

ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/,
BuildID[sha1]=e0a5dba6507b8c2b333faebc89fbc6ea2f7263b9, for GNU/Linux
3.2.0, with debug_info, not stripped

However, info sharedlibrary doesn't show neither the NIF nor the 3rd party lib:

(gdb) info sharedlibrary
>From                To                  Syms Read   Shared Object Library
0x00007fc28942ed50  0x00007fc289432004  Yes
0x00007fc289429220  0x00007fc28942a179  Yes
0x00007fc2892e83c0  0x00007fc28938ef18  Yes
0x00007fc2892b76a0  0x00007fc2892c517c  Yes
0x00007fc28928dae0  0x00007fc28929d4d5  Yes
0x00007fc2890b9630  0x00007fc28922e20d  Yes
0x00007fc289657100  0x00007fc289679674  Yes (*)     /lib64/
0x00007fc24459c040  0x00007fc2445ab8ad  Yes
0x00007fc2239e3000  0x00007fc223b7c800  Yes (*)
0x00007fc2896500e0  0x00007fc28965028c  Yes
0x00007fc289649380  0x00007fc28964bc1c  Yes
0x00007fc289638720  0x00007fc28963bd70  Yes

I found an answer at stackoverflow
( mentioning that "The
Erlang VM doesn't load NIF libraries with global symbols exposed".
Could this be the reason why I don't see the symbols? Is there a way
to tell gdb to look up symbols from my .so file?

More information about the erlang-questions mailing list