title: Can I get a C++ stack trace when Android app crashes?
body: <p>Most of the errors that occur in my C++ code cause the app to simply exit, with no LogCat output whatsoever, and no message on the device. Null pointers and incorrect use of JNI often produce this result, and needless to say, it makes debugging very hard.</p>
  
  <p>Currently I can get a stack trace with the 'bt' command in ndk-gdb, but not if the crash occurs within the first 2 seconds of startup, because ndk-gdb starts the process and attaches to it after it has started. Plus, ndk-gdb is unreliable, often saying it can't find any symbols, or complaining about nonfatal "SIGILL" errors, for example.</p>
  
  <p>Is there a way to trap the error and print a stack trace, or other information when an app crashes? For example, if there was a SIGSEGV, I'd like to know which address the app was trying to access.</p>