当前位置:   article > 正文

MTK AEE_EXP调试方法及user版本打开方案

aee_exp

一、AEE介绍

AEE (Android Exception Engine)是安卓的一个异常捕获和调试信息生成机制。

手机发生错误(异常重启/卡死)时生成db文件(一种被加密过的二进制文件)用来保存和记录异常发生时候的全部内存信息,经过调试和仿真这些信息,能够追踪到异常的缘由。

二、调试方法

2.1 获取AEE DB文件

当系统发生异常时,AEE会自动将异常的现场以DB的格式保存到/data/vendor/aee_exp路径下,通过echo c > /proc/sysrq-trigger发出内核panic重启,同时会触发aee保存db文件再次开机后将文件捞出,文件夹如下,解压后使用

AEEdebug方法范例包资源-CSDN文库

2.2 安装GAT工具并解析文件

下载工具并安装到对应的机器上,工具请找MTK索要,这里不方便上传

打开工具后的界面如下:

导入对应的DEC文件夹,并点击start,开始解析DB文件

解析完成后会出现如下界面,可以点击basic info查看基本的崩溃信息和现场,如果想看问题的堆栈并且进行GDB调试,可以导入vmlinux

设置vmlinux,下载对应问题版本的内核vmlinux并放到DEC文件夹下,设置对应的路径,这样就可以查看问题堆栈及进行GDB调试了

例如:

1.通过what happen查看错误类型

2.通过crucial info查看崩溃的线程及堆栈信息

3.DB files中查看崩溃线程的详细信息


4.进一步查看detail.txt中的open files,发现工具打开了大量的txt文件没有close,导致fd泄露

三、User版本下如果获取AEE_EXP文件

1.User版本上打开aee三方应用的监控及aee文件dump,包括JE,NE,ANR,FE等

  1. diff --git a/device/mediateksample/xxxxx/device.mk b/device/mediateksample/tb8788p1_64_bsp/device.mk
  2. index 843eb4f..a5f7e2a 100755
  3. --- a/device/mediateksample/xxxxx/device.mk
  4. +++ b/device/mediateksample/xxxxx/device.mk
  5. +AEE_DEBUG_SUPPORT ?= true
  6. +ifeq ($(strip $(AEE_DEBUG_SUPPORT)),true)
  7. +PRODUCT_PROPERTY_OVERRIDES += \
  8. + persist.vendor.anr.dumpthr=1 \
  9. + persist.vendor.mtk.aee.filter=0 \
  10. + persist.vendor.mtk.aee.mode=3 \
  11. + ro.vendor.aee.enforcingr=no
  12. +endif

文件列表如下:

db.02.NE.zip

db.01.JE.zip

db.00.ANR.zip

2. 1中打开后,FE文件会dump到/data/vendor/aee_exp中,其他的Exception会生成到/data/aee_exp中,如果logserver要拷贝文件,需要添加selinux权限

  1. diff --git a/device/mediatek/sepolicy/bsp/non_plat/system_app.te b/device/mediatek/sepolicy/bsp/non_plat/system_app.te
  2. index 5d1c4c3..1e65f11 100644
  3. --- a/device/mediatek/sepolicy/bsp/non_plat/system_app.te
  4. +++ b/device/mediatek/sepolicy/bsp/non_plat/system_app.te
  5. @@ -222,3 +222,6 @@ allow system_app abc_data_file:file { read getattr open create map write setattr
  6. allow system_app abc_data_file:dir { open getattr read search write setattr add_name remove_name };
  7. allow system_app vendor_data_file:file { read getattr open create map write setattr unlink };
  8. allow system_app vendor_data_file:dir { open getattr read search write setattr add_name remove_name rmdir };
  9. +#meituan add for aee_exp
  10. +allow system_app aee_exp_vendor_file:dir { read search getattr open };
  11. +allow system_app aee_exp_vendor_file:file { read getattr open };

如下实现,user版本下已经测试通过:

  1. Path sourceDir1 = Paths.get("/data/aee_exp/");
  2. Path sourceDir2 = Paths.get("/data/vendor/aee_exp/");
  3. Path targetDir1 = Paths.get("/sdcard/mtlog/aee_log/");
  4. Path targetDir2 = Paths.get("/sdcard/mtlog/aee_log_fe/");
  5. executeCopy(sourceDir1,targetDir1);
  6. executeCopy(sourceDir2,targetDir2);
  7. private void executeCopy(Path sourceDir, Path targetDir) {
  8. try {
  9. copyDirectory(sourceDir, targetDir);
  10. Log.i(TAG,"拷贝完成");
  11. } catch (IOException e) {
  12. e.printStackTrace();
  13. }
  14. }
  15. public static void copyDirectory(Path sourceDir, Path targetDir) throws IOException {
  16. Files.walkFileTree(sourceDir, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE,
  17. new SimpleFileVisitor<Path>() {
  18. @Override
  19. public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
  20. Path targetPath = targetDir.resolve(sourceDir.relativize(dir));
  21. Files.createDirectories(targetPath);
  22. return FileVisitResult.CONTINUE;
  23. }
  24. @Override
  25. public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
  26. Path targetPath = targetDir.resolve(sourceDir.relativize(file));
  27. Files.copy(file, targetPath);
  28. return FileVisitResult.CONTINUE;
  29. }
  30. });
  31. }

修改patch:

user版本打开AEE及调试方法修改patch资源-CSDN文库

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/266558
推荐阅读
相关标签
  

闽ICP备14008679号