I am trying to get and save the stack trace to a file after getting SEGSEGVinside my shared library. The shared library is a plugin for a closed source product. All this works in production, and I do not have direct access to it.
My code catches a SIGSEGVsignal, prints a stack trace and exits. I have something like this:
/opt/ecelerity/libexec/site/ec_attachextensions.so [0x2aecc2019f11] / opt / ecelerity / libexec / site / ec _attachextensions.so [0x2aecc2019f11] / opt / ecelerity / libexec / site / ec _attachextensions.so [0x2aecc ecelerity / libexec / site / ec _attachextensions.so [0x2aecc201a587]
/ opt / ecelerity / sbin / ecelerity [0x501235]
/ opt / ecelerity / sbin / ecelerity (sieve_seng_execute + 0x82) [0x506d32] /opt/ecelerity/libexec/validate/sieve.so [0x2aecc2862c9e] / opt / ecelerity / sbin / ecelerity (validate_data + 0x905) 0x490 ecelerity / sbin / ecelerity (esmtp_message_factory + 0x154e) [0x46eace] / opt / ecelerity / sbin / ecelerity (schedule_event_and_dispatch + 0x6a) [0x49c59a]
The problem is that I cannot have function names and offsets inside them for a shared library. As far as I understand, I can find the function name / file name for a given address using addr2line after I find the library offset at /proc/$PID/maps.
After that I do something like this:
addr2line -e /opt/ecelerity/libexec/site/ec_attachextensions.so (LIBRARY_OFFSET_FROM_MAPS_FILE - 0x2aecc2019f11)
0x2aecc2019f11 - . , , ? , ? dladdr (dladdr , backtrace )?