backtrace, corkscrew, unwind, CallStack. Does anything work?..

1,974 views
Skip to first unread message

pps

unread,
Dec 7, 2013, 11:33:26 PM12/7/13
to andro...@googlegroups.com
or it's all made to entertain me? :)
There is so many of them (in source code of android, or in gcc), it looks like there are multiple different libbacktrace's exist.
Considering that native debugging is virtually nonexistent on Android (it feels like it's 5 years behind WinRT in terms of development tools), some kind of backtracing is very important for my project.
So, what's the definite way to get it working? I had it partially working using unwind.h api from android NDK, but it gives me only addresses that I need to resolve separately.

all that corkscrew is nonsense. I have like 50 different android phones and I had to test like 10 of them before I found one that has corkscrew. I tried to take corkscrew builds from elsewhere but they do not load on production phones.

My goal is to include whatever giant beast into my source code, but to get freaking backtraces working properly without dependency on what's available on the phone (e.g. if it has or not libcorkscrew or anything like that).
Can you please recommend what kind of lib I'd need to include into my project?
here are some bits that I found so far:
aosp/system/core/libbacktrace
aosp/system/core/libcorkscrew
aosp/external/libunwind
https://github.com/mirrors/gcc/tree/master/libbacktrace
https://github.com/xroche/coffeecatch (uses corkscrew or unwind)

please, advise, what I need to get it build and running in my project. Any special instructions on how to deploy my app if I get backtraces working? I guess it should be unstripped build to get it working, right?
has there been done something that works?

a1

unread,
Dec 8, 2013, 4:36:16 AM12/8/13
to andro...@googlegroups.com
or it's all made to entertain me? :)
 
I don't know what is your usage scenario but my app (https://play.google.com/store/apps/details?id=com.bytestorm.artflow) uses breakpad (https://code.google.com/p/google-breakpad/) for native crash reporting. It's a bit of work to integrate dump_sysm into build system (especially windows based one) but other than that it works great.

--
Bart

pps

unread,
Dec 9, 2013, 9:37:18 PM12/9/13
to andro...@googlegroups.com
It's not as much for crashes, as for instrumentation of the code. Basically, I want to be able at any point in time take a backtrace of a functions and log it.

David Turner

unread,
Dec 10, 2013, 6:04:47 AM12/10/13
to andro...@googlegroups.com
First, I would recommend forgetting about using libcorkscrew, it's been written for the platform and needs some patching before you can build and use it with the NDK. Also, the idea of linking against non-NDK-official system libraries is crazy :-)

An unwinding library only deals with traversing the call-frame stack, and will thus only generate a list of addresses.
libgcc.a provides its own unwinding library, external/libunwind/ is an alternative implementation to be used with Clang / LLVM. Whatever version you use should not matter (as long as you include the proper <unwind.h>, which should expose the same interface, and link to the corresponding library).

libbacktrace will use the unwinding library to symbolize the stack trace. However, it needs access to DWARF entries in your binary.
By default, these are not available on binaries installed to the device (e.g. ndk-build places stripped binaries under libs/$ABI/, to be used in your final .apk, and keeps the debug versions under obj/local/$ABI/, to be used by ndk-gdb et al).

There is also ndk-stack that can symbolize stack traces on the host, or simply calling arm-linux-androideabi-addr2line

If you want to log back traces, I'd recommend writing the addresses in your log, then symbolizing them on the host later.



--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/groups/opt_out.

Vladimir Kunschikov

unread,
Dec 10, 2013, 7:45:48 AM12/10/13
to andro...@googlegroups.com
Best choices:  CallStack class in  the C++, libcorkscrew  in the plain C.
Reply all
Reply to author
Forward
0 new messages