Android bugreport 分析方法

文章来源:https://www.jianshu.com/p/20e1bfdf5161

作者:特立独行的佩奇

Android bugreport 概述

bugreport 是Android 系统下的一个工具,功能类似于系统的一个黑匣子;通过执行相应的命令可以获取到bugreport 包,其中包含设备日志,堆栈跟踪和其他诊断信息,可帮助您查找和修复系统错误;bugreport信息量非常之大,几乎涵盖整个系统各个层面内容,对于分析BUG是一大利器

生成 bugreport

直接 adb bugreport 生成

adb bugreport
/data/user_de/0/com.android.shell/files/bugreports/bugreport-frost-RD2A.211001.002-2022-07-26-09-29-01.zip: 1 file pulled, 0 skipped. 27.4 MB/s (23057334 bytes in 0.802s)
Bug report copied to C:\Users\86185\bugreport-frost-RD2A.211001.002-2022-07-26-09-29-01.zip

Android bugreport 内容分析

直接生成的是一个zip 包,大概有20M大小;
bugreport-xxxxx-2022-07-26-09-29-01.zip
解压后目录如下所示:

  • FS    是一个目录包含下面子目录:
    data    data下的关键信息如 tombstone,ANR,logd信息等
    proc    各个进程procfs 的dump信息
    linkerconfig    TBD

  • lshal-debug    关键HAL进程的 lshal信息

  • proto    TBD

  • bugreport-frost-RD2A.211001.002-2022-07-26-09-29-01.txt
    系统信息的关键文件,解析见下文

  • dumpstate_board.txt    执行bugreport 的dumpstate 进程信息

  • main_entry.txt    dump出的文件名

  • dumpstate_log.txt    执行dumpstate 的log 信息

  • version.txt    TBD

  • visible_windows.zip    TBD

如果发生了ANR,crash 等事件,FS下的内容是至关重要的,ANR的trace 和 tombstone 文件都可以找到,具体可以结合bugreport txt 文件分析

bugreport-xxx-211001.002-2022-07-26-09-29-01.txt

这个文件包含了system dump 的ALL info 和 dump 时间点前后的log,包含的内容为:


系统信息:
dum时间点,系统版本,内核版本,运行时间,Bootcmd

========================================================
== dumpstate: 2022-07-26 09:29:01
========================================================
Build: frost-userdebug 11 RD2A.211001.002 C3QP_R_V0.9.15.R1-0577-20220720 test-keys
Build fingerprint: 'Redmi/frost/frost:11/RD2A.211001.002/C3QP_R_V0.9.15.R1-0577-20220720:userdebug/test-keys'
Bootloader: unknown
Radio: MPSS.HA.1.0.c2-00414-QTANG2_LWG_PACK-1,MPSS.HA.1.0.c2-00414-QTANG2_LWG_PACK-1
Network: ,
Module Metadata version: 30
Kernel: Linux version 5.4.191-jgki-debug+ (scm@SS-AIMM02) (Android (6443078 based on r383902) clang version 11.0.1 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b782172ed13bee898b79), LLD 11.0.1 (/buildbot/tmp/tmp6_m7QH b397f81060ce6d701042b782172ed13bee898b79)) #1 SMP PREEMPT Wed Jul 20 02:28:27 CST 2022
Command line: security=selinux androidboot.hardware=jlq iommu.strict=0 firmware_class.path=/etc/firmware swiotlb=2048 rcu_nocbs=0-7 kpti=off rcupdate.rcu_expedited=1 earlycon=uart8250,mmio32,0x3450F000 console=jlqttyS1,115200n8 no_console_suspend loglevel=7 page_owner=on printk.devkmsg=on buildvariant=userdebug  androidboot.verifiedbootstate=orange androidboot.vbmeta.device=PARTUUID=7db6ac55-ecb5-4e02-80da-4d335b973332 androidboot.vbmeta.avb_version=1.0 androidboot.vbmeta.device_state=unlocked androidboot.secureboot=0 androidboot.vbmeta.hash_alg=sha256 androidboot.vbmeta.size=7168 androidboot.vbmeta.digest=9d001b15f4485a96b573fa13c001ac965a9cd10f43c5734ee92815b91827a401 androidboot.veritymode=disabled androidboot.bootdevice=34458000.sdhci androidboot.boot_devices=0.soc/34458000.sdhci androidboot.serialno=d4081bbb androidboot.sysdump=1 androidboot.cpuid=0x2124a4815baaeebd2102628ed64fc07400000000000000000000000000000000 androidboot.bootreason=0 androidboot.baseband=msm androidboot.hwname=frost androidboot.hwc=Global androidboot.hwversion=1.21.0 androidboot.hwlevel=1 androidboot.product.hardware.sku=c3qpa panel_cfg=xiaomi C3QP 35 02 0a hd+ video dsi panel,display_init=1 androidboot.slot_suffix=_a rootwait ro init=\init androidboot.dtbo_idx=6,9,15  androidboot.dtb_idx=0 androidboot.force_normal_boot=1
Uptime: up 0 weeks, 6 days, 6 hours, 1 minute
Bugreport format version: 2.0
Dumpstate info: id=2 pid=20089 dry_run=0 args=/system/bin/dumpstate -S -d -z bugreport_mode=

dumpsys 信息

  • dumpsys SurfaceFlinger
    关键字:
    DUMP OF SERVICE CRITICAL SurfaceFlinger:
    was the duration of dumpsys SurfaceFlinger

  • dumpsys activity activities
    关键字:
    ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
    was the duration of dumpsys activity

  • dumpsys cpuinfo
    关键字:
    was the duration of dumpsys cpuinfo

  • dumpsys input
    关键字:
    was the duration of dumpsys input

  • dumpsys notification
    关键字:
    was the duration of dumpsys notification

  • dumpsys power
    关键字:
    was the duration of dumpsys power

  • dumpsys sensorservice
    关键字:
    was the duration of dumpsys sensorservice

  • dumpsys window lastanr
    关键字:
    WINDOW MANAGER LAST ANR (dumpsys window lastanr)

  • dumpsys window policy
    关键字:
    WINDOW MANAGER POLICY STATE (dumpsys window policy)

  • dumpsys window animator
    关键字:
    WINDOW MANAGER ANIMATOR STATE (dumpsys window animator)

  • dumpsys window sessions
    关键字:
    WINDOW MANAGER SESSIONS (dumpsys window sessions)

  • dumpsys window displays
    关键字:
    WINDOW MANAGER DISPLAY CONTENTS (dumpsys window displays)

  • dumpsys window tokens
    关键字:
    WINDOW MANAGER TOKENS (dumpsys window tokens)

  • dumpsys window windows
    关键字:
    WINDOW MANAGER WINDOWS (dumpsys window windows)

  • dumpsys window trace
    关键字:
    WINDOW MANAGER TRACE (dumpsys window trace)

  • dumpsys window logging
    关键字:
    WINDOW MANAGER LOGGING (dumpsys window logging)

  • dumpsys window refresh
    关键字:
    WINDOW MANAGER HIGH REFRESH RATE BLACKLIST (dumpsys window refresh)

  • dumpsys window constants
    关键字:
    WINDOW MANAGER CONSTANTS (dumpsys window constants):

logcat 信息

关键字:
system log:
------ SYSTEM LOG (logcat -v threadtime -v printable -v uid -d *:v) ------
------ was the duration of 'SYSTEM LOG' ------

event log:
------ EVENT LOG (logcat -b events -v threadtime -v printable -v uid -d *:v) ------
------ was the duration of 'EVENT LOG' ------

stat log:
------ STATS LOG (logcat -b stats -v threadtime -v printable -v uid -d *:v) ------
------ was the duration of 'STATS LOG' ------

radio log:
------ RADIO LOG (logcat -b radio -v threadtime -v printable -v uid -d *:v) ------
------   was the duration of 'RADIO LOG' ------

last log:
------ LAST LOGCAT (logcat -L -b all -v threadtime -v printable -v uid -d *:v) ------

chkbugreport 工具

因为bugreport 中包含了太多的信息,查找分类信息很困难,所以有分析bugreport txt文件的开源工具 chkbugreport;作用是分析析处理手机上生成的bugreport,并且为开发者提取尽可能多的有用数据;

28fb1eb5374a80dcb52a7f48c0ef2667.png

推荐阅读:

关于我

一篇文章带你了解Android 最新Camera框架

独家 | Android Camera 面试流程、经验分享

视频课程上架啦 | Android Camera开发入门

深圳上班,

从事Android Camera相关软件开发工作,

公众号记录生活和工作的点滴。

d4e42e2d2281918be4577e61a8392b8c.png

《Android Camera开发入门》视频课程已经上架了,可以加我微信咨询,目前针对星球成员免费开放,也欢迎加入“小驰成长圈”星球84bd905da85c46b6b6ce90d56ae1e801.png

视频课程上架啦 | Android Camera开发入门

315b84b88534d95540e23c19d1b0bb1b.jpeg

觉得不错,点个赞呗 c30eabfa875a47d544106e15f0bdaadb.png

posted @ 2024-02-01 08:03  小驰行动派  阅读(388)  评论(0编辑  收藏  举报  来源