-
Notifications
You must be signed in to change notification settings - Fork 642
Description
最近发现一个问题,就是Android 15上发生崩溃时,只能抓到一条堆栈信息:
#00 pc 000000000008246c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160)
而同样的APK在Android 10上却能抓到完整的崩溃信息,排查下来发现原来是与CFA相关
打印cfa_op_ext为0x2d,直接走到了goto err
xCrash/xcrash_lib/src/main/cpp/xcrash_dumper/xcd_dwarf.c
Lines 1191 to 1192 in 86dea4f
default: // illegal | |
goto err; |
查看Android源码,0x2d在aarch64时已经被使用
https://cs.android.com/android/platform/superproject/+/android-latest-release:system/unwinding/libunwindstack/DwarfCfa.cpp;l=734-740
https://github.com/iqiyi/xCrash/blob/86dea4fa0cdbae68b63e9b34436fa20b51244d11/xcrash_lib/src/main/cpp/xcrash_dumper/xcd_dwarf.c#L211C1-L212C1
应修改为
#if defined(__aarch64__)
/* 0x2d */ {0, {DW_EH_PE_omit, DW_EH_PE_omit}},
#else
/* 0x2d */ {1, {DW_EH_PE_omit, DW_EH_PE_omit}},
#endif
其他与DWARF_LOCATION_PSEUDO_REGISTER
相关的部分,应该不需要移植,只需要将0x2d放开即可。
具体详情请参考,Android12提交记录:https://android.googlesource.com/platform/system/unwinding/+/96787c940a90fa569b8cc966c0ca655f0c26e31c%5E%21/#F0