Hi guys,
I'm looking at using libunwind to work around the perennial lack of backtrace on uclibc MIPS. To test it out on the embedded system in question I knocked together a simple application consisting of a couple of recursive functions before calling the show_backtrace example code featured on the website documentation.
Unfortunately the show_backtrace is unable to show anything useful, unw_step exits with -UNW_ENOINFO. Cranking up the debug levels gives me the following (the full code attached):
Backtracing 00400b10
>_ULmips_init_local: (cursor=0x7fe1a668)
>_ULmips_step: (cursor=0x7fe1a668)
>get_rs_cache: acquiring lock
>_ULmips_dwarf_find_proc_info: looking for IP=0x400927
>_ULmips_dwarf_callback: checking ./main, base=0x0)
>_ULmips_dwarf_callback: checking ../lib//libunwind.so.8, base=0x770cd000)
>_ULmips_dwarf_callback: checking ../lib//libunwind-mips.so.8, base=0x77045000)
>_ULmips_dwarf_callback: checking /lib/libgcc_s.so.1, base=0x7700e000)
>_ULmips_dwarf_callback: checking /lib/libc.so.0, base=0x76f54000)
>_ULmips_dwarf_callback: checking /lib/ld-uClibc.so.0, base=0x77142000)
>_ULmips_dwarf_find_proc_info: IP=0x400927 not found
>put_rs_cache: unmasking signals/interrupts and releasing lock
>_ULmips_dwarf_step: returning -10
"Backtracing" is the result of a __builtin_return_address(0) and is correct from my examination of the disassembly.
Other than it not working. What really concerns me is the value for IP being unaligned to a word boundary and that it doesn't correspond to an actual instruction (I performed a objdump -d on the executable and crossed referenced against the proc/maps file to sanity check).
Compile line: mipsel-linux-uclibc-gcc -g -fPIC -Ilibunwind/include -Llibunwind/src/.libs -lunwind -lunwind-mips -Wall -W -D_REENTRANT -fPIE -O0 -fno-inline -fno-omit-frame-pointer -o main main.c
Thanks in advance.