title: Android NDK - Debugging a random crash with a bad callstack
body: <p>My android native application crashes randomly but frequently, and I am unable to get sufficient info out ndk-gdb. This is the message following the crash:</p>
  
  <pre><code>Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 19983]
  0x4012c6ac in memcpy () from /Users/Andreas/dev/android/obj/local/armeabi-v7a/libc.so
  </code></pre>
  
  <p>bt returns an unusable callstack:</p>
  
  <pre><code>#0  0x4012c6ac in memcpy () from /Users/Andreas/dev/android/obj/local/armeabi-v7a/libc.so
  #1  0x67337388 in ?? ()
  Cannot access memory at address 0x7
  #2  0x67337388 in ?? ()
  Cannot access memory at address 0x7
  Backtrace stopped: previous frame identical to this frame (corrupt stack?)
  </code></pre>
  
  <p>I am using NDK-r8e</p>
  
  <p>I have checked all uses of <code>memcpy()</code> in my program and they're not responsible for this (verified by making them call another memcpy-like function with a different name, and still getting the above crash with the exact signature). </p>
  
  <p>Any ideas how to get a more useable call stack, or to further debug this? Does the NDK offer any memory check functionality in case this is a memory overwrite?</p>