Search code examples
android-ndktry-catchcoredump

How do I get crash dump in ndk. not in debug


How to get crash dump when my app crashes, it usually happens in c++ module of my apk. I found that this code in c++

try 
{
 made some crash code to test
}
catch(...)
{
 i ,catch it ,and write the info to the sd card.
}

when crash happens, the code do not enter the catch part, it crashed immediately.

Is there anything wrong? Thanks.


Solution

  • Your crash is because of segmentation fault.

    SIGSEGV crash is not caught by the try catch. SIGSEGV in C++ is considered bug and some thing needs to be done with the code to fix that rather than wrap it with try catch.

    If it is very necessary for you to catch the seg fault, you may have a look at this post. You may try it, but there is no guarantee that it will work though.