如何使用addr2line Android中 [英] How to use addr2line in Android

查看:726
本文介绍了如何使用addr2line Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我坚持我的应用程序,因为我无法调试,因为它是一个多线程的一个,崩溃,错误SIGSEGV。我从LogCat中,这给了我地址,我的本地库获得大量的信息。这将是有益的,如果我可以转换这些地址到我的code。

I am stuck with my app, as I am unable to debug as it is a multithreaded one and crashes with error SIGSEGV. I get lot of information from LogCat, which gives me addresses in my native library. It would be helpful if I could convert these addresses into my code.

没有任何人有任何想法如何使用addr2line,其提供有Android的NDK?

Does anybody have any idea how to use addr2line, which is provided with android-ndk?

推荐答案

让我们说的logcat告诉你下面的崩溃日志(这是我的一个项目):

Let's say that logcat show you the following crash log (this is from one of my projects):

I/DEBUG   (   31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (   31): Build fingerprint: 'generic/sdk/generic:2.3/GRH55/79397:eng/test-keys'
I/DEBUG   (   31): pid: 378, tid: 386  >>> com.example.gltest <<<
I/DEBUG   (   31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG   (   31):  r0 001dbdc0  r1 00000001  r2 00000000  r3 00000000
I/DEBUG   (   31):  r4 00000000  r5 40a40000  r6 4051a480  r7 42ddbee8
I/DEBUG   (   31):  r8 43661b24  r9 42ddbed0  10 42ddbebc  fp 41e462d8
I/DEBUG   (   31):  ip 00000001  sp 436619d0  lr 83a12f5d  pc 8383deb4  cpsr 20000010
I/DEBUG   (   31):          #00  pc 0003deb4  /data/data/com.example.gltest/lib/libnativemaprender.so
I/DEBUG   (   31):          #01  pc 00039b76  /data/data/com.example.gltest/lib/libnativemaprender.so
I/DEBUG   (   31):          #02  pc 00017d34  /system/lib/libdvm.so

看最后3行;这是你的调用堆栈。 PC是程序计数器,和PC的堆栈帧#00为您提供了故障发生的那个地址。这是数字传递给addr2line

Look at the last 3 lines; this is your callstack. 'pc' is the program counter, and the pc for stack frame #00 gives you the address where the crash occurred. This is the number to pass to addr2line.

我使用NDK R5,所以我使用的可执行文件位于 $ NDK /工具链/ ARM-Linux的androideabi-4.4.3 / prebuilt / Linux的-86 /仓;确保在您的 $ PATH 。使用的命令看起来像

I'm using NDK r5, so the executable I'm using is located at $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin; make sure that is in your $PATH. The command to use looks like

arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libXXX.so <address>

或者,对上面的情况:

Or, for the case above:

arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libnativemaprender.so 0003deb4

,让你崩溃的位置。

Which gives you the location of the crash.

请注意:

  • -C标志是解码C ++ code
  • 使用.so文件下 物镜/本地/ armeabi,因为这是 非剥离版本
  • The -C flag is to demangle C++ code
  • Use the .so file under obj/local/armeabi, since this is the non-stripped version

此外,使用NDK R5具有2.3 AVD的时候,它实际上是可以调试多线程code。

Also, when using NDK r5 with a 2.3 AVD, it is actually possible to debug multithreaded code.

这篇关于如何使用addr2line Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆