-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dump native callstack programmatically in Android #50
Comments
Here is the callstack. we are getting this for ARM build. As you can see the IP of the below stack is completely wrong.
BTW, there are an easier way to get the callstack in linux by using backtrace () as part of execinfo.h, which is not supported for Android. Do you have any plan to get this header/so inplace in future version of android ? I am using clang compiler with androidndk.10.4.1 tool chain. |
You don't need to backtrace yourself. As for fixing the underlying bug, we need more information. What STL are you using?
There's no such thing. Is that an Android Studio version? Are you using NDK r11b? If you're not using r11b, that's the first thing to check. |
Hello, We are using r10d only as r10e had toolchain problems. Thanks |
Reopen if this is still present in r11b. Clang has been completely redone (we threw away the old crappy hacked about source that was in the NDK and reset to upstream), so there's a significant chance the problem will go away just by upgrading. |
@DanAlbert does it work in release mode too? Can it work only using clang, or can also work with gcc? |
As long as your app can be unwound (debuggerd will try a lot of different ways to do this), it will be unwound. Should work with essentially any binary. |
Thanks. |
As long as you haven't gone out of your way to obfuscate it then it should be fine. |
Hi there, Computing a backtrace can be very helpful in other context, rather than just for handling crashes. For example in a large code base you can record where an API is used, and put that in an associative array (key = backtrace, value = hit-count). It can be used for ad'hoc memory leak detector etc... Obviously I am not aware of the complexity of support this, but it would make the Android platform more developer friendly and comparable to other platform (this is available in Linux and macOS) to do so. |
we're looking at adding |
Before |
Hello,
I am working on adding debuggability to my app when there is a crash. I want to detect callstack when there is unhandled exception in native code and dump it into the ADB logs. For that, I am using _Unwind_Backtrace API to capture current stack trace and abi::__cxa_demangle to de-mangle it.
With this approach:
Can you please help me out how can we get the correct callstack for ARM and all builds of X86? Is this is a known bug for clang? If yes, is there a workaround I can use?
The code snippet below highlights the technique I use to get stack trace and de-mangle it:
OS Version: Android L (5.0.2)
Thanks,
Dipankar
The text was updated successfully, but these errors were encountered: