On 5/14/2013 9:05 PM, ANDY KENNEDY wrote:
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
# 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?
You have to add "-fexceptions" compiler option in command line, this enable the gcc to
add frame unwind information for all functions.
I used the same test and working fine without any problems on my SH target:

root@arcidiaf:/home/filippo/bkt# gcc -static -o test-static-0.9.33 -rdynamic -fexceptions test.c -lubacktrace -ldl
root@arcidiaf:/home/filippo/bkt# ./test-static-0.9.33 3
backtrace() returned 7 addresses
[0x4003ea]
[0x400504]
[0x400548]
[0x40053e]
[0x40053e]
[0x4005be]
[0x40d3a6]

Thanks,
Andy



_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to