Troubleshooting statically built application using backtrace.

Carmelo Amoroso carmelo73 at gmail.com
Wed May 15 07:18:28 UTC 2013


Il giorno 14/mag/2013 20:08, "ANDY KENNEDY" <ANDY.KENNEDY at adtran.com> ha
scritto:
>
> > > two applications listed a backtrace.  Only one line is printed with an
> > > address (presumably of the backtrace function call).
> > Yes, it is the calling function address.
> > You can use addr2line command to convert the address in line number.
> > Before you have to compile the application with debug information (add
> > -g compiler flag),
> > then use:
> > addr2line -e <exec_name> <address>
>
> Let's say I do that.  I don't think that resolves the issue of it not
> doing a backtrace, will it?
>
> > >
> > > It appears that, since the reference to dlopen was removed from
> > > libubacktrace/backtrace.c, that the libgcc_s.so.1 is removed from the
> > > equation entirely.  Believing this, I'm attempting to revert the
> > > changes made to that file so that we still attempt to dlopen the
> > > libgcc_s.so.1 library prior to performing the backtrace.
> > >
> > > I'll let the list know whether this works.
> > >
>
> As I reported this seg faults.
>
> This is a FULL description of what I did:
>
> # Extract the code from `man 3 backtrace` in to hello_world.c
> /opt/toolchains/powerpc-unknown-linux-uclibcgnuspe/bin/powerpc-linux-gcc \
> -static -rdynamic -o hello_world hello_world.c -lubacktrace -ldl

You are bot passing the unwind table flag
-fasynchronous-unwind-tables

> # Next, I copy over to my target (essentially this is a P1010RDB):
>
SYSROOT=$(/opt/toolchains/powerpc-unknown-linux-uclibcgnuspe/bin/powerpc-linux-gcc
-print-sysroot)
> LIBDIR=$SYSROOT/lib
> for i in ld-uClibc.so.0 libc.so.0 libgcc_s.so.1 ; do \
>         cp $LIBDIR/$i /tftpboot ; \
> done
> cp hello_world /tftpboot
> ssh <mytarget>
> tftp <all those files>
> LD_LIBRARY_PATH=./ hello_world 5
>
>
> That should produce five function calls and a backtrace through each
> (as it does on my x86_64 host).  I only get the backtrace function
> in the list.
>
> What did I do wrong?
>
> Thanks,
> Andy


More information about the uClibc mailing list