This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hey On Fri, Mar 23, 2012 at 10:24 AM, Alan Modra <amodra@gmail.com> wrote: > On Fri, Mar 23, 2012 at 08:47:25AM +0100, Vincent Torri wrote: >> Is there a way to get the frames with libbfd? > > No. ?It's not hard to write for one ABI. ?For example, see > glibc/debug/backtrace.c. I have modified the code a bit to create a shared lib and a test program (see attached archive). All the tests below are done in linux (arch: i686, in case it's important) i've tested a bit, using addr2line with the addresses that the glibc code returns. It's not perfect, it even depends on the optimization flag I pass. In the test program (it's actually the backtrace test program of glibc) , there are 2 functions: compress() (which calls the backtrace function) and main() which calls compare() If I pass no optimization flag: 1) the line returned by addr2line with the first address is the line where the backtrace function is called, so it's good. 2) the line returned by addr2line with the second address is *not* the line where the compress() function is called (compress() is called 2 line below.) If I pass -O2: 1) the line returned by addr2line with the first address is *not* the line where the backtrace function is called (backtrace() is called 1 line below.) 2) the line returned by addr2line with the second address is the line where the compress() function is called, so it's good. Is it normal to not get the correct lines ? Vincent
Attachment:
bt.tar.bz2
Description: BZip2 compressed data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |