This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
trying to characterize the circumstances under which backtrace() works reliably
- From: Britton Kerin <britton dot kerin at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 17 Mar 2016 14:56:28 -0800
- Subject: trying to characterize the circumstances under which backtrace() works reliably
- Authentication-results: sourceware.org; auth=none
I'm working on a very tiny little source lib intended to make
debugging C using instrumentation a bit easier. It's just a wrapper
around dladdr(), backtrace(), nm, and addr2line that tries to make it
easy to see the backtrace or what a function pointer actually points
to.
It mostly works great, but I'd like to be able to characterize as
precisely as possible the compilation options that are needed or
allowed for it to work correctly. I believe I've got it mostly sorted
out for pointer lookups (dladdr() + nm) but backtrace (backtrace() +
addr2line) not so much. I get some inconsistent line number behavior
(other email). I wonder how effective addr2line --inlines option is
at figuring things out is the presence of inlining.
Is there any good source on this anywhere, beyond what's in the
backtrace() and addr2line man pages?
Thanks,
Britton