easiest way to debug crash in native library, linked by Android app?

断了今生、忘了曾经 提交于 2019-12-03 06:59:06

If your application is truly crashing in native code, I highly recommend the following:

  1. Set a java breakpoint that will be hit after your native library has been loaded but before it starts executing.
  2. Go to the terminal and launch the ndk's version of gdb (it's called "ndk-gdb"). Initially, just type "c" to continue.
  3. Back in java, continue execution.
  4. Once your app crashes, gdb will pause and you can examine the integrity of the stack in native code via the "bt" command (backtrace).

At any rate, you should be able to fully debug native code and catch problems via ndk-gdb. You can find specific documentation on the ndk's version of gdb in your local installation of the ndk (for example, on my machine it's here):

android-ndk-r6/documentation.html

Finally, here's a basic tutorial on gdb:

gdb tutorial

Hope this helps!

Use ARM CE5 Community edition tools for eclipse and can debug any native code

Try using NDK-STACK with the logcat output, it will at least tell you what file is the culprit and also the function.

https://developer.android.com/ndk/guides/ndk-stack

You can use the sequoyah project via eclipse to debug native code, it was a real pain for me to set this up and get it to work, I don't remember all the steps, but it's doable

qrtt1

I have asked something like this How to compile library with source code with NDK tools? My suggestion is deassembling with source code, then everything will be easy.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!