Comments (11)
we're looking at adding <execinfo.h>
(http://man7.org/linux/man-pages/man3/backtrace.3.html) in a future release.
from ndk.
Here is the callstack. we are getting this for ARM build. As you can see the IP of the below stack is completely wrong.
03-08 17:27:17.796 19915 20022 E FOO : ####################### EXCEPTION CALLSTACK #########################
03-08 17:27:17.799 19915 20022 E STACKTRACE: Frame:[#0] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.799 19915 20022 E STACKTRACE: Frame:[#1] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.799 19915 20022 E STACKTRACE: Frame:[#2] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#3] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#4] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#5] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#6] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#7] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#8] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#9] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#10] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#11] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#12] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#13] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#14] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#15] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.800 19915 20022 E STACKTRACE: Frame:[#16] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.801 19915 20022 E STACKTRACE: Frame:[#17] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.802 19915 20022 E STACKTRACE: Frame:[#18] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#19] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#20] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#21] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#22] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#23] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#24] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#25] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#26] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#27] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#28] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#29] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
03-08 17:27:17.803 19915 20022 E STACKTRACE: Frame:[#30] IP:[0x70902cd4] Function:[SetLastExceptionInfoForThread()]
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.
from ndk.
You don't need to backtrace yourself. debuggerd
is a built in part of android that will print a backtrace of your app when it crashes.
As for fixing the underlying bug, we need more information. What STL are you using?
androidndk.10.4.1 tool chain
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.
from ndk.
Hello,
We are using r10d only as r10e had toolchain problems.
We are currently using clang3.5. and gcc4.9 (for support toolchain)
We are using stl library located at sources\cxx-stl\gnu-libstdc++ in the NDK.
Thanks
Dipankar
from ndk.
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.
from ndk.
debuggerd is a built in part of android that will print a backtrace of your app when it crashes.
@DanAlbert does it work in release mode too? Can it work only using clang, or can also work with gcc?
Thanks.
from ndk.
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.
from ndk.
Thanks.
What does your app can be unwound
mean?
from ndk.
As long as you haven't gone out of your way to obfuscate it then it should be fine.
from ndk.
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.
from ndk.
Before <execinfo.h>
is added, maybe my small app for testing 3 backtracing methods on Android will be helpful for someone: https://github.com/alexeikh/android-ndk-backtrace-test
from ndk.
Related Issues (20)
- [BUG] Clang++ Segmentation fault when building AOSP branch android-14.0.0_r35 HOT 3
- [Bug]: error: ran out of registers during register allocation HOT 17
- Android builds with unity fail: "Library\Bee\artifacts\Android" HOT 4
- [FR] push/pop required policies in cmake toolchain file HOT 16
- [DOC] Clarification on 16k page size support for x86_64 devices HOT 3
- [DOC] `system_fonts.h` HOT 7
- [Bug]: Lambda segfaults in Clang HOT 11
- [FR] Official NDK release for Linux arm64 HOT 1
- [Bug]: fatal error: error in backend: Cannot select: 0x10ba8ace0: nxv4f32 = BUILD_VECTOR 0x133163a90, 0x1330f4800, 0x133108d20, 0x1248b9e60 HOT 6
- [BUG] Compilation Error with std::execution in C++17 HOT 3
- [BUG] CLEAR_VARS does not clear LOCAL_STRIP_MODE variable HOT 2
- [Bug]: Android NDK r27 rc2 miscompiles code with inderect gotos HOT 13
- [Bug] NDK's openmp test crashing on x86 with latest LLVM update HOT 4
- Please provide maintainable list of NDK codename-revision pairs HOT 3
- [Bug]: clang compile with -D_FORTIFY_SOURCE=2 -Dstatic= cause undefined symbol: snprintf HOT 7
- [BUG] android-ndk-r26c use -pg ld.lld: error: undefined symbol: _mcount HOT 7
- [Bug]: Compiler Crash HOT 5
- [FR] support libclang? HOT 1
- [BUG] investigate odd find_package behavior HOT 3
- [BUG] NDK 27 no longer supports passing in `CMAKE_SYSTEM_PROCESSOR` to CMake to set the arch HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndk.