android addr2line使用

一般碰到NE的异常需要通过addr2line把异常地址转成code文件和行号。

1.进入到prebuilts/gcc/linux-x86/arm/cit-arm-linux-androideabi-4.8目录,

2.把libunwind.so从\out\target\product\XXX\symbols下面去找到该库文件,并把该so拷贝到cit-arm-linux-androideabi-4.8目录。注意:这个so一定要是出问题的版本的so,即使是同个项目不同软件,都不能代替。

 3. 执行如下命令addr2line -e libunwind.so 0000e3ac

 

则可以把

// #00 pc 0000e3ac /system/lib/libunwind.so 
// #01 pc 000109f7 /system/lib/libunwind.so (_Uelf32_memory_read+178) 
// #02 pc 0000d803 /system/lib/libunwind.so 
// #03 pc 000030db /system/lib/libunwind.so (unw_map_local_create+42) 
// #04 pc 00009ca9 /system/lib/libbacktrace.so (_ZN14UnwindMapLocal5BuildEv+4) 
// #05 pc 00009d8f /system/lib/libbacktrace.so (_ZN12BacktraceMap6CreateEib+138) 
// #06 pc 0033b721 /system/lib/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEb+164) 
// #07 pc 0033b61f /system/lib/libart.so (_ZN3art10ThreadList14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+574) 
// #08 pc 00320a8d /system/lib/libart.so (_ZN3art7Runtime14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+228) 
// #09 pc 003252f7 /system/lib/libart.so (_ZN3art13SignalCatcher13HandleSigQuitEv+1394) 
// #10 pc 00324465 /system/lib/libart.so (_ZN3art13SignalCatcher3RunEPv+336) 
// #11 pc 00047fa3 /system/lib/libc.so (_ZL15__pthread_startPv+22) 
// #12 pc 00019a0d /system/lib/libc.so (__start_thread+6) 

 

用addr2line后得出:

/proc/self/cwd/external/libunwind/src/arm/Ginit.c:199 
/proc/self/cwd/external/libunwind/src/elfxx.c:75 
/proc/self/cwd/external/libunwind/src/elfxx.h:106 
/proc/self/cwd/external/libunwind/src/mi/Lmap.c:70 (discriminator 1) 
/proc/self/cwd/system/core/libbacktrace/UnwindMap.cpp:127 
/proc/self/cwd/system/core/libbacktrace/UnwindMap.cpp:157 
/proc/self/cwd/art/runtime/thread_list.cc:195 (discriminator 4) 
/proc/self/cwd/art/runtime/thread_list.cc:144 
/proc/self/cwd/art/runtime/runtime.cc:1411 
/proc/self/cwd/art/runtime/signal_catcher.cc:144 
/proc/self/cwd/art/runtime/signal_catcher.cc:215 
/proc/self/cwd/bionic/libc/bionic/pthread_create.cpp:198 (discriminator 1) 
/proc/self/cwd/bionic/libc/bionic/clone.cpp:41 (discriminator 1) 

你可能感兴趣的:(Android)