Description
Android has "dl_iterate_phdr" since API version 21, but it's explicitly disabled in backtrace-sys build.rs
So when I run the code
use backtrace::Backtrace;
fn main() {
println!("{:?}", Backtrace::new());
}
using backtrace 0.3.32
I get following output:
stack backtrace:
0: <unknown> (0xad95e4e8)
1: <unknown> (0xad95e4c6)
2: <unknown> (0xad95d7b8)
3: <unknown> (0xad95d770)
4: <unknown> (0xad95c718)
5: <unknown> (0xad95c67e)
6: <unknown> (0xad96bb22)
7: <unknown> (0xad96c77a)
8: <unknown> (0xad96c056)
9: <unknown> (0xad95c670)
10: __libc_init (0xea95978a)
This commit fixes the issue and I get proper backtrace, however this won't build for API versions < 21 /target/armv7-linux-androideabi/debug/deps/libbacktrace_sys-88b2f68ba9256347.rlib(elf.o):elf.c:function __rbt_backtrace_initialize: error: undefined reference to 'dl_iterate_phdr'
. I've not submitted a PR yet as someone's build might be broken.
I wonder if this is possible to detect the used android API version and set the build.define("HAVE_DL_ITERATE_PHDR", "1");
accordingly.
Or maybe it's fine to mention that >=21 version is only supported since it's used on CI builds?
Please advice.