Android开发中,我们也会经常遇到段错误,也就是SIGSEGV(11),这个时候libc的backtrace会打印出对应的堆栈信
息,而你看到的仅仅是一对数字,好像无从查起。
如下面这一从串断错误:
ActivityManager( 1105): Displayed activity com.android.browser/.BrowserActivity: 2460 ms (total 2460 ms)
I/DEBUG (13002): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG (13002): Build fingerprint: ‘unknown‘
I/DEBUG (13002): pid: 20363, tid: 20375 >>> com.android.browser <<<
I/DEBUG (13002): signal 11 (SIGSEGV), fault addr ffc00000
I/DEBUG (13002): r0 059fc2a0 r1 4a3bcef8 r2 e59fc2a0 r3 4a3bcc58
I/DEBUG (13002): r4 4a3bc101 r5 4ebe0a3c r6 4a3bc120 r7 012fff10
I/DEBUG (13002): r8 500de101 r9 500ee12d 10 a87dfb20 fp 4ebe58e0
I/DEBUG (13002): ip ffc00000 sp 4ebe0a30 lr 4a3bcc58 pc a862f3a0 cpsr 00000030
I/DEBUG (13002): d0 0000001100000011 d1 0000001100000011
I/DEBUG (13002): d2 0000001100000011 d3 0000001100000011
I/DEBUG (13002): d4 0000001100000011 d5 0000001100000011
I/DEBUG (13002): d6 0000001100000011 d7 4060000000000080
I/DEBUG (13002): d8 41d3d1762e40d70a d9 41d3d1762e440a3d
I/DEBUG (13002): d10 0000000000000000 d11 0000000000000000
I/DEBUG (13002): d12 0000000000000000 d13 0000000000000000
I/DEBUG (13002): d14 0000000000000000 d15 0000000000000000
I/DEBUG (13002): d16 3ff0000000000000 d17 3ff0000000000000
I/DEBUG (13002): d18 40cd268000000000 d19 3f3b9cc1b0bac000
I/DEBUG (13002): d20 3ff0000000000000 d21 8000000000000000
I/DEBUG (13002): d22 0000000000000000 d23 0000000000000000
I/DEBUG (13002): d24 3ff0000000000000 d25 0000000000000000
I/DEBUG (13002): d26 0000000000000000 d27 0000000000000000
I/DEBUG (13002): d28 0000000000000000 d29 3ff0000000000000
I/DEBUG (13002): d30 0000000000000000 d31 3ff0000000000000
I/DEBUG (13002): scr 60000013
I/DEBUG (13002):
I/DEBUG (13002): #00 pc 0032f3a0 /system/lib/libwebcore.so
I/DEBUG (13002): #01 pc 003243b0 /system/lib/libwebcore.so
I/DEBUG (13002): #02 pc 003167b2 /system/lib/libwebcore.so
I/DEBUG (13002): #03 pc 0038f2de /system/lib/libwebcore.so
I/DEBUG (13002): #04 pc 0038f416 /system/lib/libwebcore.so
I/DEBUG (13002): #05 pc 0030d392 /system/lib/libwebcore.so
I/DEBUG (13002): #06 pc 003796e2 /system/lib/libwebcore.so
I/DEBUG (13002): #07 pc 0038e36a /system/lib/libwebcore.so
I/DEBUG (13002): #08 pc 003189f0 /system/lib/libwebcore.so
I/DEBUG (13002): #09 pc 00377f82 /system/lib/libwebcore.so
I/DEBUG (13002): #10 pc 0037ae0c /system/lib/libwebcore.so
I/DEBUG (13002): #11 pc 0038e254 /system/lib/libwebcore.so
I/DEBUG (13002): #12 pc 003189f0 /system/lib/libwebcore.so
I/DEBUG (13002): #13 pc 0031cf2c /system/lib/libwebcore.so
I/DEBUG (13002): #14 pc 0038e52a /system/lib/libwebcore.so
I/DEBUG (13002): #15 pc 0038c2d0 /system/lib/libwebcore.so
I/DEBUG (13002): #16 pc 0031cf76 /system/lib/libwebcore.so
I/DEBUG (13002): #17 pc 0038e546 /system/lib/libwebcore.so
I/DEBUG (13002): #18 pc 003189f0 /system/lib/libwebcore.so
I/DEBUG (13002): #19 pc 0031ca40 /system/lib/libwebcore.so
I/DEBUG (13002): #20 pc 0038e3be /system/lib/libwebcore.so
I/DEBUG (13002): #21 pc 0038c2d0 /system/lib/libwebcore.so
I/DEBUG (13002): #22 pc 0031cf76 /system/lib/libwebcore.so
I/DEBUG (13002): #23 pc 0038e546 /system/lib/libwebcore.so
I/DEBUG (13002): #24 pc 0038c2d0 /system/lib/libwebcore.so
I/DEBUG (13002): #25 pc 00379054 /system/lib/libwebcore.so
I/DEBUG (13002): #26 pc 0031d254 /system/lib/libwebcore.so
I/DEBUG (13002): #27 pc 0030d5d6 /system/lib/libwebcore.so
I/DEBUG (13002): #28 pc 0030d7d2 /system/lib/libwebcore.so
I/DEBUG (13002): #29 pc 0031e354 /system/lib/libwebcore.so
I/DEBUG (13002): #30 pc 0034ab3c /system/lib/libwebcore.so
I/DEBUG (13002):
I/DEBUG (13002): code around pc:
I/DEBUG (13002): a862f380 469e4694 cc04f853 0e04f1a3 510cea4f
I/DEBUG (13002): a862f390 f41c0d09 bf080f00 44714249 c008f8d1
I/DEBUG (13002): a862f3a0 e000f8dc 0c1ff10e bf0842b8 2d04f853
I/DEBUG (13002): a862f3b0 0d010510 0f00f412 4249bf08 f8c2185a
I/DEBUG (13002): a862f3c0 e006c008 d1042b0c 99019b05 18426818
I/DEBUG (13002):
I/DEBUG (13002): code around lr:
I/DEBUG (13002): 4a3bcc38 e58d0000 e49d0004 e598200b e582002f
I/DEBUG (13002): 4a3bcc48 e52d0004 e3100001 0a000018 e3a03030
I/DEBUG (13002): 4a3bcc58 e59fc2a0 e002100c e59fc29c e151000c
I/DEBUG (13002): 4a3bcc68 0a000012 e59fc294 e002100c e0813003
I/DEBUG (13002): 4a3bcc78 e1a03123 e1c2200c e3530b02 ba000004
I/DEBUG (13002):
I/DEBUG (13002): stack:
I/DEBUG (13002): 4ebe09f0 50bfd848
I/DEBUG (13002): 4ebe09f4 50bfd858
I/DEBUG (13002): 4ebe09f8 50bfd834
I/DEBUG (13002): 4ebe09fc afd19a05 /system/lib/libc.so
I/DEBUG (13002): 4ebe0a00 50bd3264
I/DEBUG (13002): 4ebe0a04 a86510ef /system/lib/libwebcore.so
I/DEBUG (13002): 4ebe0a08 00000004
I/DEBUG (13002): 4ebe0a0c 50bfd854
I/DEBUG (13002): 4ebe0a10 002ece20 [heap]
I/DEBUG (13002): 4ebe0a14 4a3ba000
I/DEBUG (13002): 4ebe0a18 4ebe0a3c
I/DEBUG (13002): 4ebe0a1c 4ebe0a3c
I/DEBUG (13002): 4ebe0a20 4a3bc101
I/DEBUG (13002): 4ebe0a24 4ebe0a3c
I/DEBUG (13002): 4ebe0a28 df002777
I/DEBUG (13002): 4ebe0a2c e3a070ad
I/DEBUG (13002): #00 4ebe0a30 002ece20 [heap]
I/DEBUG (13002): 4ebe0a34 49f627d0
I/DEBUG (13002): 4ebe0a38 a87d63c0 /system/lib/libwebcore.so
I/DEBUG (13002): 4ebe0a3c 4a3bd0e7
I/DEBUG (13002): 4ebe0a40 4a3bd0b8
I/DEBUG (13002): 4ebe0a44 4a3bcc58
I/DEBUG (13002): 4ebe0a48 00000003
I/DEBUG (13002): 4ebe0a4c 00000000
I/DEBUG (13002): 4ebe0a50 00001100
I/DEBUG (13002): 4ebe0a54 0000001f
I/DEBUG (13002): 4ebe0a58 00001074
I/DEBUG (13002): 4ebe0a5c 4ebe0b04
I/DEBUG (13002): 4ebe0a60 a87d63c0 /system/lib/libwebcore.so
I/DEBUG (13002): 4ebe0a64 4ebe0acc
I/DEBUG (13002): 4ebe0a68 4a3bc101
I/DEBUG (13002): 4ebe0a6c a86243b5 /system/lib/libwebcore.so
I/DEBUG (13002): #01 4ebe0a70 4ebe0b38
I/DEBUG (13002): 4ebe0a74 00000064
I/DEBUG (13002): 4ebe0a78 003f0914 [heap]
I/DEBUG (13002): 4ebe0a7c fffffc00
I/DEBUG (13002): 4ebe0a80 50bfd834
I/DEBUG (13002): 4ebe0a84 a87d63c0 /system/lib/libwebcore.so
I/DEBUG (13002): 4ebe0a88 4ebe0b38
I/DEBUG (13002): 4ebe0a8c 4ebe0b04
I/DEBUG (13002): 4ebe0a90 4ebe0acc
I/DEBUG (13002): 4ebe0a94 a86167b7 /system/lib/libwebcore.so
我们的板子上的lib
经常被strip过了,没有了符号信息。不过我们可以通过编译时候生成的库来获取对应的符号信息。编译器也为我们提供了相应的工具:addr2line
全名为:arm-eabi-addr2line ,可在对应板子源码目录找到。
通过上面的断错误分析,位于system/lib/libwebcore.so
这个库出现了断错误,可以将其pull下来正逐行分析。命令为:arm-eabi-addr2line -f -e ~/桌面/libwebcore.so
0038f2de
这种分析法同样适用于使用jni开发的库。
转载http://terryblog.blog.51cto.com/1764499/796583