Stacktrace for C on Android

2019-04-11 15:47发布

问题:

I have C code in my Android app and would like to catch crashes and print them to a log file. I saw this post, and tried, but I can't find the execinfo lib. I'm working with Ubuntu 11.10 and using NDK for compiling to Android. Does anyone know how to find execinfo lib for NDK/ARM, or have another simple solution?

回答1:

On Android, you have some sample specials utils code allowing to see and/or dump the stack.

Implementation is in base/libs/utils/CallStack.cpp. You'll a find a tiny sample code here.