Let's make our application crash to see how to read a crash dump:
Simulate a fatal bug in
jni/com_packtpub_store_Store.cpp
:#include "com_packtpub_store_Store.h" JNIEXPORT jint JNICALL Java_com_packtpub_store_Store_getCount (JNIEnv* pEnv, jobject pObject) { pEnv = 0; return pEnv->CallIntMethod(0, 0); }
Open the LogCat view in Eclipse, select the All Messages (no filter) option, and then run the application. A crash dump appears in the logs. This is not pretty! If you look carefully through it, you should find a
backtrace
section with a snapshot of the call-stack at the moment the application crashed. However, it does not give the line of code involved:From a command-line prompt, go to the project directory. Find the line of code implied in the crash by running NDK-Stack with
logcat
as the input. NDK-Stack needs theobj
files corresponding to the device ABI on which the application crashed, for example:cd <projet directory>...