3

Google Play reports crashes in my NDK native Android app. These reports include a callstack.

Good so far, but I would like to know line numbers as well, not just which function it crashed in.

Example report from Google Play:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.steenriver.buggy <<<
backtrace:
  #00  pc 00000000001cf97c  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so (SoundEngineStart+1500)
  #01  pc 00000000001cc7f8  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so
  #02  pc 00000000001e42f8  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so (_Z7nfy_msgPKc+120)
  #03  pc 00000000001d657c  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so
  #04  pc 00000000001e42f8  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so (_Z7nfy_msgPKc+120)
  #05  pc 00000000001c4ae0  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so (_Z14view_touchDowniiPiPfS0_+824)
  #06  pc 00000000001465a8  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so
  #07  pc 00000000001f3d18  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so
  #08  pc 0000000000145b8c  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so (android_main+368)
  #09  pc 00000000001f3b84  /data/app/com.steenriver.buggy-1/lib/arm/libbuggy.so
  #10  pc 0000000000046eb3  /system/lib/libc.so (_ZL15__pthread_startPv+22)
  #11  pc 0000000000019acd  /system/lib/libc.so (__start_thread+6)

I would like to know which line number SoundEngineStart+1500 maps to.

I did find the utility ndk-stack but if I feed it my crash, there are no line numbers shown, and ndk-stack just passes through the crash info as-is.

My NDK binary is build in latest AndroidStudio using cmake external build. I do not use any obfuscation like proguard.

Bram
  • 7,440
  • 3
  • 52
  • 94
  • 2
    Did you give ndk-stack the path to a shared library that hasn't been stripped? If you did that and you still can't get it to work, you could try using addr2line directly (e.g. `some-abi-prefix-addr2line -Cfe unstripped-libbuggy.so 001cf97c` – Michael Apr 11 '18 at 05:36
  • @Michael That works! If you write it up I will mark it as the correct answer. In my case, the abi prefix was not req'd btw. Ubuntu's addr2line worked just fine on ARM .so file. – Bram Apr 11 '18 at 22:41

0 Answers0