arm异常处理unwind 过程

backtrace:
#00 pc 00062928 /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so (_Unwind_VRS_Pop+84)
#01 pc 00062f64 /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so (__gnu_unwind_execute+240)
#02 pc 00063230 /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so (__gnu_unwind_frame+52)
#03 pc 0001e74d /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so
#04 pc 00008d1f /system/lib/libc_malloc_debug_leak.so (_Unwind_Backtrace+166)
#05 pc 00006047 /system/lib/libc_malloc_debug_leak.so
#06 pc 00006ac1 /system/lib/libc_malloc_debug_leak.so (leak_malloc+84)
#07 pc 0001ee5b /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so (_Znwj+22)
#08 pc 00048993 /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so
#09 pc 00048d07 /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so
#10 pc 00010141 /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so
#11 pc 000101cd /data/app/com.ss.android.article.news-1/lib/arm/libuserinfo.so
#12 pc 00002465 /system/bin/linker (__dl__ZN6soinfo13call_functionEPKcPFvvE+48)
#13 pc 0000252f /system/bin/linker (__dl__ZN6soinfo10call_arrayEPKcPPFvvEjb+134)
#14 pc 000026f5 /system/bin/linker (__dl__ZN6soinfo17call_constructorsEv+160)
#15 pc 00006115 /system/bin/linker (__dl__Z9do_dlopenPKciPK17android_dlextinfo+224)
#16 pc 00001c95 /system/bin/linker (__dl_dlopen+20)
#17 pc 0025b13b /system/lib/libart.so (_ZN3art9JavaVMExt17LoadNativeLibraryEP7_JNIEnvRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEP8_jobjectPS9_+650)
#18 pc 002d13d7 /system/lib/libart.so (_ZN3artL18Runtime_nativeLoadEP7_JNIEnvP7_jclassP8_jstringP8_jobjectS5_+194)
#19 pc 7351a105 /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x1ed5000)

先看#04 pc 00008d1f /system/lib/libc_malloc_debug_leak.so (_Unwind_Backtrace+166)

00008d1f 这个地址,使用readelf -a libc_malloc_debug_leak.so, 导出libc_malloc_debug_leak.so 各section信息

找到.ARM.exidx section ,readelf把.ARM.exidx 和.ARM.extab解析好的信息合并在一起展示

Unwind section ‘.ARM.exidx’ at offset 0x21a98 contains 234 entries:

找到表项里面地址最接近00008d1f 且小于00008d1f的表项(就是00008d1f所在函数对另的unwind 信息)


_Unwind_Backtrace: ARM.exidx
 0x8c78: @0x22284
Compact model index: 1
0xb2 0xb6 0x04 vsp = vsp + 2780
0xaf pop {r4, r5, r6, r7, r8, r9, r10, r11, r14}
0xb0 finish
0xb0 finish

objdump -S libc_malloc_debug_leak.so

我这里找到的表项目是0x8c78, 可以用objdump验证

00008c78 <_Unwind_Backtrace>: (伪代码用户回溯上级栈)
8c78: e92d 4ff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
8c7c: f5ad 6d2d sub.w sp, sp, #2768 ; 0xad0
8c80: b083 sub sp, #12
8c82: 460c mov r4, r1
8c84: 4605 mov r5, r0

0x8c78处正是_Unwind_Backtrace 函数。

Compact model index: 1 表示arm兼容模式, 所以0x22284 是对应在.ARM.extab*的地址(相对elf偏移)

在这里插入图片描述

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值