Android 调试系列-Bugreport实战篇

版权声明:本文为作者原创,转载必须注明出处。
转载请注明出处:https://www.jianshu.com/p/907028bac94a

Bugreport

上一篇文章Bugreport源码篇主要是从源码角度来分析了一下系统是如何生成Bugreport的,以及Bugreport的源码实现。本篇主要从使用角度来对Bugreport中包含的内容做相关介绍。也是基于Android 8.0版本,由于Bugreport获取的内容很长,这里只能简单划分如下21块内容,简单说说各部分log的信息。
注:这里拿小米手机dump的bugreport内容来做介绍

1、系统build相关信息

========================================================
== dumpstate: 2018-11-10 00:22:54
========================================================

Build: OPM1.171019.011
Build fingerprint: 'xiaomi/tulip/tulip:8.1.0/OPM1.171019.011/8.11.9:user/release-keys'
Bootloader: unknown
Radio: 660_GEN_PACK-1.174030.1.174977.1
Network: (unknown)
Kernel: Linux version 4.4.78-perf+ (builder@mi-server) (gcc version 4.9.x 20150123 (prerelease) (GCC) ) #1 SMP PREEMPT Fri Nov 9 04:24:09 WIB 2018
Command line: ramoops_memreserve=4M rcupdate.rcu_expedited=1 console=ttyMSM0,115200,n8 androidboot.console=ttyMSM0 earlycon=msm_serial_dm,0xc170000 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 sched_enable_hmp=1 sched_enable_power_aware=1 service_locator.enable=1 swiotlb=1 androidboot.configfs=true androidboot.usbcontroller=a800000.dwc3 buildvariant=user root=/dev/mmcblk0p61 androidboot.verifiedbootstate=orange androidboot.keymaster=1  androidboot.veritymode=enforcing androidboot.bootdevice=c0c4000.sdhci androidboot.serialno=a02f873c androidboot.hwc=Global androidboot.hwversion=4.20.0 androidboot.hwlevel=0 androidboot.hwdefined=0 androidboot.baseband=sdm mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_nt36672a_tianma_fhdplus_video:config0:1:none:cfg:single_dsi androidboot.fpsensor=fpc androidboot.secureboot=0
Bugreport format version: 1.0
Dumpstate info: id=5 pid=27250 dry_run=0 args=/system/bin/dumpstate -s extra_options=

系统build信息如下:

  1. dumpstate:date
  2. Build: getprop ro.build.display.id
  3. Build fingerprint: getprop ro.build.fingerprint
  4. Bootloader: getprop ro.bootloader
  5. Radio:getprop gsm.version.baseband
  6. Network: getprop gsm.operator.alpha
  7. Kernel: dump_file /proc/version
  8. Command line: cat /proc/cmdline

系统运行时间:

------ UPTIME (uptime) ------
 00:22:55 up  4:42,  0 users,  load average: 44.10, 46.18, 42.83
------ 0.018s was the duration of 'UPTIME' ------
  1. up即为uptime:系统运行时长00:22:55
  2. idle time:系统空闲时长4:42
  3. user:用户数0
  4. load average:cup 最近1min,5min,15min的平均负载情况.这个值的标准由cpu有多少个核来决定

2、下面列举bugreport结果相关项

------ DUMPSYS MEMINFO (/system/bin/dumpsys -t 90 meminfo -a) ------
------ DUMPSYS CPUINFO (/system/bin/dumpsys -t 10 cpuinfo -a) ------
------ PROCRANK (procrank) ------
------ VIRTUAL MEMORY STATS (/proc/vmstat) ------
------ VMALLOC INFO (/proc/vmallocinfo) ------
------ SLAB INFO (/proc/slabinfo) ------
------ ZONEINFO (/proc/zoneinfo) ------
------ PAGETYPEINFO (/proc/pagetypeinfo) ------
------ BUDDYINFO (/proc/buddyinfo) ------
------ FRAGMENTATION INFO (/d/extfrag/unusable_index) ------
------ KERNEL WAKE SOURCES (/d/wakeup_sources) ------
------ KERNEL CPUFREQ (/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state) ------
------ KERNEL SYNC (/d/sync) ------
------ QSEE_LOG (cat /d/tzdbg/qsee_log) ------
------ TZ_LOG (cat /d/tzdbg/log) ------
------ PROCESSES AND THREADS (ps -A -T -Z -O pri,nice,rtprio,sched,pcy) ------
------ LIBRANK (librank) ------
------ PRINTENV (printenv) ------
------ NETSTAT (netstat -nW) ------

3、kernel log

内核log信息

------ KERNEL LOG (dmesg) ------

4、lsof、map、block process wait-channels、process times

需要root权限
Skipping '/system/xbin/su root lsof' on user build.
------ 0.000s was the duration of 'LIST OF OPEN FILES' ------
------ SHOW MAP 1 (/init) (/system/xbin/su root showmap 1) ------
------ PROCESS TIMES (pid cmd user system iowait+percentage) ------
1     /init                                          5.77    5.28    0.00

5、system log

其实调用的是logcat system和main缓冲区的log
------ SYSTEM LOG (logcat -v threadtime -v printable -v uid -d *:v) ------
--------- beginning of crash
--------- beginning of system
--------- beginning of main

6、event log

调用的是logcat events缓冲区的log
------ EVENT LOG (logcat -b events -v threadtime -v printable -v uid -d *:v) ------

7、radio log

调用的是logcat radio缓冲区的log
------ RADIO LOG (logcat -b radio -v threadtime -v printable -v uid -d *:v) ------

8、log statistics

记录了main/radio/events/system/crash/security/kernel等各个log的使用情况
------ LOG STATISTICS (logcat -b all -S) ------
size/num main               radio              events             system             crash              security           kernel             Total
Total    500424586/6305580  5790723/77563      50150183/584809    70541684/485432    4748/7             0/0                6764031/100345     633675955/7553736
Now      255769/3591        3596015/51755      259743/2887        4187060/29223      4748/7                                256047/3682        8559382/91145
Logspan  51.296(44.3%)      4:43:15.343        4:38.941           1:58:43.109(6.9%)  1:12:55.143                                              4:43:51.288
Overhead 456865             6494295            421415             5823548            5140                                  462239             14029033
...

9、vm trace

------ VM TRACES JUST NOW (/data/anr/dumptrace_EEGHQP: 2018-11-10 00:23:44) ------
----- pid 711 at 2018-11-10 00:23:31 -----
------ VM TRACES AT LAST ANR (/data/anr/anr_2018-11-09-23-50-52-579: 2018-11-09 23:51:14) ------
----- pid 31377 at 2018-11-09 23:50:54 -----

------ TOMBSTONE (/data/tombstones/tombstone_01: 2018-11-09 11:16:18) ------
若没有
*** NO TOMBSTONES to dump in /data/tombstones/

10、network

------ NETWORK DEV INFO (/proc/net/dev) ------
------ QTAGUID NETWORK INTERFACES INFO (/proc/net/xt_qtaguid/iface_stat_all) ------
------ QTAGUID NETWORK INTERFACES INFO (xt) (/proc/net/xt_qtaguid/iface_stat_fmt) ------
------ QTAGUID CTRL INFO (/proc/net/xt_qtaguid/ctrl) ------
------ QTAGUID STATS INFO (/proc/net/xt_qtaguid/stats) ------

11、last kernel log

------ LAST KMSG (/proc/last_kmsg) ------

12、ip相关

------ NETWORK INTERFACES (ip link) ------
------ IPv4 ADDRESSES (ip -4 addr show) ------
------ IPv6 ADDRESSES (ip -6 addr show) ------
------ IP RULES (ip rule show) ------
------ IP RULES v6 (ip -6 rule show) ------
------ RT_TABLES (/data/misc/net/rt_tables: 2018-11-09 23:17:14) ------
------ ROUTE TABLE IPv4 (ip -4 route show table 255) ------
------ ROUTE TABLE IPv6 (ip -6 route show table 255) ------
------ ARP CACHE (ip -4 neigh show) ------
------ IPv6 ND CACHE (ip -6 neigh show) ------
------ MULTICAST ADDRESSES (ip maddr) ------


13、中断向量表

这一块跟android6.0相比少了INTERRUPTS

------ NETWORK DIAGNOSTICS (/system/bin/dumpsys -t 10 connectivity --diag) ------

14、system property信息

------ SYSTEM PROPERTIES (getprop) ------
vold进程:管理和控制Android平台外部存储设备,包括SD插拨、挂载、卸载、格式化等;vold进程接收来自内核的外部设备消息。
------ VOLD DUMP (vdc dump) ------
------ SECURE CONTAINERS (vdc asec list) ------
------ STORAGED TASKIOINFO (storaged -u) ------
------ FILESYSTEMS & FREE SPACE (df) ------
Filesystem                                           1K-blocks    Used Available Use% Mounted on
tmpfs                                                  1895568     764   1894804   1% /dev
/dev/block/platform/soc/c0c4000.sdhci/by-name/system   2982364 2679276    255740  92% /system
/dev/block/platform/soc/c0c4000.sdhci/by-name/vendor   1999196  727564   1234608  38% /vendor
tmpfs                                                  1895568       0   1895568   0% /mnt
none                                                   1895568       0   1895568   0% /sys/fs/cgroup
/dev/block/bootdevice/by-name/cust                      822168  782032     15236  99% /cust
/dev/block/bootdevice/by-name/modem                     196528  109488     87040  56% /firmware
/dev/block/bootdevice/by-name/bluetooth                  65488     480     65008   1% /bt_firmware
/dev/block/mmcblk0p60                                   237536     504    229172   1% /cache
/dev/block/dm-0                                       52950544 3700556  49102532   8% /data
/data/media                                           52950544 3700556  49102532   8% /storage/emulated

15、last radio log

------ LAST RADIO LOG (parse_radio_log /proc/last_radio_log) ------

16、thermal log / blacklights

------ THERMAL LOG ------
battery=43000
backlight_therm=44
emmc_therm=47
pa_therm0=44
pm660_tz=47560
pm660l_tz=37000
msm_therm=49
quiet_therm=46
xo_therm=45
tsens_tz_sensor0=525
tsens_tz_sensor1=528
tsens_tz_sensor2=538
tsens_tz_sensor3=545
tsens_tz_sensor4=535
tsens_tz_sensor5=541
tsens_tz_sensor6=522
tsens_tz_sensor7=551
tsens_tz_sensor8=516
tsens_tz_sensor9=519
tsens_tz_sensor10=509
tsens_tz_sensor11=516
tsens_tz_sensor12=545
tsens_tz_sensor13=519
limits_sensor-00=0
limits_sensor-01=0
bms=43000
GLM_soc=0
LLM_cp1-=0
LLM_cp0-=0

背光信息
------ BACKLIGHTS ------
LCD brightness=*** Error dumping /sys/class/leds/lcd-backlight/brightness: Permission denied
Button brightness=*** Error dumping /sys/class/leds/button-backlight/brightness: No such file or directory
Keyboard brightness=*** Error dumping /sys/class/leds/keyboard-backlight/brightness: No such file or directory
ALS mode=*** Error dumping /sys/class/leds/lcd-backlight/als: Permission denied
LCD driver registers:
*** Error dumping /sys/class/leds/lcd-backlight/registers: Permission denied

17、Binder相关

------ BINDER FAILED TRANSACTION LOG (/sys/kernel/debug/binder/failed_transaction_log) ------
------ BINDER TRANSACTION LOG (/sys/kernel/debug/binder/transaction_log) ------
------ BINDER TRANSACTIONS (/sys/kernel/debug/binder/transactions) ------
------ BINDER STATS (/sys/kernel/debug/binder/stats) -----
------ BINDER STATE (/sys/kernel/debug/binder/state) ------
紧接着需要root,user build不会有这个log
------ DUMP VENDOR RIL LOGS (/system/xbin/su root vril-dump) ------

18、dumpsys相关

通过dumpsys -l可查看系统所有服务,不带参数的dumpsys命令会输出系统中所有的服务:每个服务开头信息如下:
========================================================
== Android Framework Services
========================================================
------ DUMPSYS (/system/bin/dumpsys -t 10 --skip meminfo cpuinfo) ------
DUMP OF SERVICE DisplayFeatureControl:
DUMP OF SERVICE DockObserver:
DUMP OF SERVICE SurfaceFlinger:
DUMP OF SERVICE
...

19、dumpsys checkin相关

dumpsys电池统计,内存、网络统计、进程、使用情况、包这些统计类信息

========================================================
== Checkins
========================================================
------ CHECKIN BATTERYSTATS (/system/bin/dumpsys -t 30 batterystats -c) ------
------ CHECKIN MEMINFO (/system/bin/dumpsys -t 30 meminfo --checkin) ------
------ CHECKIN NETSTATS (/system/bin/dumpsys -t 30 netstats --checkin) ------
------ CHECKIN PROCSTATS (/system/bin/dumpsys -t 30 procstats -c) ------
------ CHECKIN USAGESTATS (/system/bin/dumpsys -t 30 usagestats -c) ------
------ CHECKIN PACKAGE (/system/bin/dumpsys -t 30 package --checkin) ------

20、dumpsys app相关

dumpsys会收集activity信息以及service和provider信息。

========================================================
== Running Application Activities
========================================================
------ APP ACTIVITIES (/system/bin/dumpsys -t 30 activity -v all) ------
========================================================
== Running Application Services
========================================================
------ APP SERVICES (/system/bin/dumpsys -t 30 activity service all) ------
========================================================
== Running Application Providers
========================================================
------ APP PROVIDERS (/system/bin/dumpsys -t 30 activity provider all) ------

21、Dropbox相关

Dropbox会收集system server crash 和 system app crash 信息

========================================================
== Dropbox crashes
========================================================
------ DROPBOX SYSTEM SERVER CRASHES (/system/bin/dumpsys -t 30 dropbox -p system_server_crash) ------
------ DROPBOX SYSTEM APP CRASHES (/system/bin/dumpsys -t 30 dropbox -p system_app_crash) ------

总结

从上面的总结和6.0的源码对比来看,总体log的打印顺序都没有明显变化,只是增加了一些信息。开发者在根据bugreport分析问题的时候可以通过搜索关键字来快速找到有用信息,比如当你想了解meminfo信息的时候,你可以搜索DUMPSYS MEMINFO来找到各个进程所占用内存的信息。又或者当你想查询摸一个app的信息时,你可以搜索package [包名]来找到对应的app信息。总是,还需要大家多多使用,多多熟练就能快速找到你想要的信息。

参考:
http://gityuan.com/2016/06/11/bugreport-2/

你可能感兴趣的:(Android 调试系列-Bugreport实战篇)