androidcrashandengineaddr2line

How do I use addr2line for Android?


My code (a game using AndEngine with PhysicsBox2DExtension on Android) is crashing and it has been suggested that I use addr2line, but I have absolutely not idea how to do it and the many "tutorials" I've looked at are extraordinarily vague. Perhaps someone could give me step by step instructions?

I'm using Windows 7 and Eclipse Indigo. I've downloaded Android NDK r8 and saved it to C:\Program Files (x86)\Android NDK\android-ndk-r8. My project is saved to C:\Users\Reese\workspace\TestGFX5.

The stacktrace:

07-06 13:25:27.469: I/DEBUG(19582):          #00  pc 00011f74  /system/lib/libc.so
07-06 13:25:27.473: I/DEBUG(19582):          #01  pc 0001921e  /system/lib/libc.so
07-06 13:25:27.473: I/DEBUG(19582):          #02  pc 00026558  /data/data/com.prattia.webs.testgfx5/lib/libandenginephysicsbox2dextension.so
07-06 13:25:27.473: I/DEBUG(19582):          #03  pc 00013e7c  /data/data/com.prattia.webs.testgfx5/lib/libandenginephysicsbox2dextension.so
07-06 13:25:27.473: I/DEBUG(19582):          #04  pc 00016e34  /system/lib/libdvm.so

Beyond that, I'm lost. Help please?


Solution

  • Use ndk-stack instead. Save your native log crash in a file, says log.txt and then use

    $NDK_HOME/ndk-stack -sym $PROJECT_HOME/obj/local/armeabi -dump log.txt
    

    of course, your native library has to be compiled with the debug symbols.

    From the doc:

    'ndk-stack' is a simple tool that allows you to filter stack traces as they appear in the output of 'adb logcat' and replace any address inside a shared library with the corresponding "source-file : line-number" values.