android NE 分析

1:使用mtk  工具解析aee_exp,找到发生NE 进程信息如:

pid: 5832, tid: 5840, name: AudioOut_15  >>> /system/bin/audioserver <<<


2:确定版本信息,需要aee_exp 与out\target\product\A31\symbols  编译生成的是同一次的


3:使用gat 工具  Backtrace decode 解析异常堆栈

backtrace  文件选择aee_exp  中 __exp_main.txt                                  symbols 选择上边sysmbols目录

会生成__exp_main.txt .decode.txt 解析的文件与函数及行信息。


4:根据__exp_main.txt .decode.txt判断调用关系是否正确,有可能 symbols 与aee_exp 代码不是同一次编译的。


5:使用Trace32 simulator 加载 NE 的lib


trace32 下载 http://www.lauterbach.com/frames.html?manual.html


6:打开coredump
M、N相同
M版本 ENG load 默认开启
 
M版本Userdebug load:

adb shell aee -d coreon

adb shell aee -d directon

adb reboot


使用user 版本,烧录userdebug 版本boot img root ,这个时候如果出现unknow coreon  或 unknow  directon ,需要将/system/build.prop  下ro.build.type=user 改为userdebug 在reboot 手机,再运行adb shell aee -d coreon      adb shell aee -d directon


等手机重启后再执行以下命令

adb shell setprop persist.libc.debug.malloc 15

adb shell setprop persist.libc.debug15.prog /system/bin/surfaceflinger

adb shell setprop persist.debug15.config 0x4a003024

adb reboot

5.   手机再次重启后,开始复现问题。




M版本 USER load:
1)open alps/bionic/linker/debugger.cpp, and modify code in debuggerd_init
__LIBC_HIDDEN__ void debuggerd_init() {
struct sigaction action;
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_sigaction = debuggerd_signal_handler;
action.sa_flags = SA_RESTART | SA_SIGINFO;
#if 0
// Use the alternate signal stack if available so we can catch stack overflows.
action.sa_flags |= SA_ONSTACK;

sigaction(SIGABRT, &action, nullptr);
sigaction(SIGBUS, &action, nullptr);
sigaction(SIGFPE, &action, nullptr);
sigaction(SIGILL, &action, nullptr);
sigaction(SIGPIPE, &action, nullptr);
sigaction(SIGSEGV, &action, nullptr);
#if defined(SIGSTKFLT)
sigaction(SIGSTKFLT, &action, nullptr);
#endif
sigaction(SIGTRAP, &action, nullptr);
#endif
}
2)rebuild load
3)need enable root permission first
adb shell setprop persist.aee.core.dump enable
adb shell setprop persist.aee.core.direct enable
adb reboot



memory map (2293 entries):
--->Fault address falls at 00000020 before any mapped regions

你可能感兴趣的:(android)