libbacktrace
libbacktrace copied to clipboard
Libbacktrace doesn't work on Linux ARM-32 bits
When I try to use libbacktrace on Linux 32-bits I get an empty backtrace.
See the following example program: http://ix.io/4Jf4
Build it like:
curl http://ix.io/4Jf4 > testbt.c
gcc -c testbt.c -o testbt.o
gcc testbt.o /path/to/libbacktrace.a -o testbt
And then execute it.
On Debian/arm64 (64-bits) you get this:
$ ./testbt
At main() call into bt()
At bt() call backtrace_print
0xaaaac1df1333 ???
???:0
0xaaaac1df13b7 ???
???:0
0xffffb6d6be17 __libc_start_main
../csu/libc-start.c:308
0xaaaac1df1077 ???
???:0
At bt() call backtrace_simple
aaaac1df1363 bt ??:0
aaaac1df13b7 main ??:0
ffffb6d6be17 __libc_start_main ../csu/libc-start.c:308
aaaac1df1077 ?? ??:0
Program end
So far, so good
However, on Debian/armhf (ARM 32-bits) you get this:
$ ./testbt
At main() call into bt()
At bt() call backtrace_print
At bt() call backtrace_simple
Program end
So it prints nothing.
Some info about my test environment in case it is useful:
- I'm testing with the very last version of libbacktrace as of today (9ae4f4ae4481b1e69d38ed810980d33103544613)
- I'm building libbacktrace from source and linking with this last version for testing this
- I tested this on Debian version bullseye
- To discard that is a 32-bit pointer issue I tested this on Intel 32-bits (i686) on an Ubuntu-18.04 32-bits container and there it worked as expected.
- I also tested this on the last version of Yocto as of today (Yocto Mickledore) and I can reproduce the issue there on an ARM-32 build
- I tested to run the libbacktrace testsuite with
make checkand it passes fine (also it passes on ARM-32 bits)
Does it help if you run gcc -c -g testbt.c -o testbt.o? I added the -g option.
I just tested to add the -g option and unfortunately it doesn't help.
This is the info about the testbt binary that gets built, just in case is useful.
$ file testbt
testbt: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=ff2046b946518a75d05e88704a33c7429a1d991d, for GNU/Linux 3.2.0, with debug_info, not stripped
$ ldd testbt
linux-vdso.so.1 (0xf7907000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xf7887000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xf7788000)
/lib/ld-linux-armhf.so.3 (0xf78df000)