Android adb bugreport detailed analysis with case

Source: Internet
Author: User
Keywords adb bugreport adb bugreport
Tags android adb bugreport bugreport adb

Get Log from Android System

Adb bugreport> bugreport.txt
Copy bugreport tothe current directory.
Bugreport contains a variety of log information, most of the log can also be obtained directly by directly running the relevant program.
Proceed as follows:
1.adb shell

2. Enter the directory of the relevant utility program 

3. Execute the relevant program 

4. Get related information
Take the output process information as an example. 

1.adbshell 2. Enter ps -P 3. You can see related process information.

Log Archive Analysis
1.bugreport
Bugreport records the log of the android startup process, as well as the system state after startup, including the process list, memory information, VM information, etc.
2.bugreport structure analysis
(1)dumpstate
MEMORY INFO
Get the log: read the file /proc/meminfo
System memory usage status
CPU INFO
Get the log: execute /system/bin/top -n 1 -d 1 -m 30 -t
System CPU usage status
PROCRANK
Get the log: execute /system/bin/procrank
Execute /system/xbin/procrank output results, check some memory usage status
VIRTUAL MEMORYSTATS
Get the log: read the file /proc/vmstat
Virtual memory allocation
The memory requested by vmalloc is located between vmalloc_start and vmalloc_end. There is no simple conversion relationship with physical addresses. Although they are logically continuous, they are not required to be contiguous physically.
VMALLOC INFO
Get the log: read the file /proc/vmallocinfo
Virtual memory allocation
SLAB INFO
Get the log: read the file /proc/slabinfo
SLAB is a memory allocator. Here is some information about the splitter.
ZONEINFO
Get the log: read the file /proc/zoneinfo
Zone info
SYSTEMLOG (need to analyze)
Get the log: execute /system/bin/logcat -v time -d *:v
Will output the Log output in the program to analyze the current state of the system
VM TRACES
Get the log: read the file /data/anr/traces.txt
Because each program is run in its own VM, this Log is some traces of the actual VM.
EVENT LOGTAGS
Get the log: read the file /etc/event-log-tags
EVENT LOG
Get the log: execute /system/bin/logcat -b events -v time -d *:v
Output some event log
RADIO LOG
Get the log: execute /system/bin/logcat -b radio -v time -d *:v
Show link status of some wireless devices, such as GSM, PHONE, STK (Satellite Tool Kit)...
NETWORK STATE
Get the log: execute /system/bin/netcfg (get the network link status)
Get the log: read the file /proc/net/route (get the routing status)
Show network links and routes
SYSTEMPROPERTIES
Get the log: reference code implementation
Show some system properties, such as Version, Services, network...
KERNEL LOG
Get the log: execute /system/bin/dmesg
Log showing Android kernel output
KERNELWAKELOCKS
Get the log: read the file /proc/wakelocks
Some records of kernel wakeup and hibernation for some programs and services
KERNELCPUFREQ
(Linux kernelCPUfreq subsystem) Clock scaling allows you to change the clockspeed of the CPUs on the fly.
This is a nicemethod to save battery power, because the lower the clock speed is,the less power the CPU consumes.
PROCESSES
Get the log: execute ps-P
Show current process
PROCESSES ANDTHREADS
Get the log: execute ps -t -p-P
Show current process and thread
LIBRANK
Get the log: execute /system/xbin/librank
Eliminate unnecessary libraries
BINDER FAILEDTRANSACTION LOG
Get the log: read the file /proc/binder/failed_transaction_log
BINDERTRANSACTION LOG
Get the log: read the file /proc/binder/transaction_log
BINDERTRANSACTIONS
Get the log: read the file /proc/binder/transactions
BINDER STATS
Get the log: read the file /proc/binder/stats
BINDER PROCESSSTATE
Get the log: read the file /proc/binder/proc/*
Some states related to bind
FILESYSTEMS
Get the log: execute /system/bin/df
Some capacity usage status of the main file (cache, sqlite, dev...)
PACKAGESETTINGS
Get the log: read the file /data/system/packages.xml
Some status of the package in the system (access rights, path...), similar to some lnk files in Windows.
PACKAGE UIDERRORS
Get the log: read the file /data/system/uiderrors.txt
Error message
KERNEL LAST KMSGLOG
Latest kernel messagelog
LAST RADIOLOG
Latest radio log
KERNEL PANICCONSOLE LOG
KERNEL PANICTHREADS LOG
Console/thread some error message log
BACKLIGHTS
Get the log: Get LCDbrightness read /sys/class/leds/lcd-backlight/brightness
Get the log: Get Buttonbrightness read /sys/class/leds/button-backlight/brightness
Get the log: Get Keyboardbrightness read /sys/class/leds/keyboard-backlight/brightness
Get the log: get ALSmode read /sys/class/leds/lcd-backlight/als
Get the log: get LCDdriver registers read /sys/class/leds/lcd-backlight/registers
Get some information about the brightness
(2) build.prop
VERSIONINFO outputs the following information
current time
Current kernel version: can read files (/proc/version)
Display current command: can read folder (/proc/cmdline) to get
Display some properties of the system build: you can read the file (/system/build.prop) to get
Output system some properties
Gsm.version.ril-impl
Gsm.version.baseband
Gsm.imei
Gsm.sim.operator.numeric
Gsm.operator.alpha
(3)dumpsys
This log can be obtained after executing /system/bin/dumpsys.
It is often found that the log output is incomplete, because the code requires that the tool only execute for up to 60ms, which may result in the log not being fully output.
You can ensure that the log is completely output by modifying the time parameter.
information:
Currently running services
DUMP OF SERVICE services-name(running)
Log Code Analysis
Site:."frameworks"base"cmds"dumpstate"
The code of the relevant Log program can be obtained from the above directory.
Log Analysis Experience
Analysis step
1. View some version information
System environment to identify the problem
2. Check the usage status of CPU/MEMORY
See if there is memory exhaustion, the background of the CPU is busy.
3. Analysis of traces
Because traces is some thread stack information output after a system error, you can quickly locate where the problem is.
4. Analysis of SYSTEM LOG
The system Log outputs various logs in detail, and can find out related logs and analyze them one by one.
Case Analysis
Let's analyze a test example I wrote, doing an infinite loop on OnCreate, so that the main thread will be locked, and an ANR error will occur after pressing the Back of the hardware.
The stack information of the program found in traces is as follows:
----- pid 20597at 2010-03-15 01:29:53 -----
Cmd line: com.android.test
DALVIK THREADS:
"main" prio=5 tid=3 TIMED_WAIT
| group="main" sCount=1 dsCount=0 s=N obj=0x2aac6240self=0xbda8
| sysTid=20597 nice=0 sched=0/0 cgrp=defaulthandle=1877232296
At java.lang.VMThread.sleep(Native Method)
At java.lang.Thread.sleep(Thread.java:1306)
At java.lang.Thread.sleep(Thread.java:1286)
At android.os.SystemClock.sleep(SystemClock.java:114)
At com.android.test.main.onCreate(main.java:20)
atandroid.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
atandroid.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
atandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
atandroid.app.ActivityThread.access$2200(ActivityThread.java:119)
atandroid.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
At android.os.Handler.dispatchMessage(Handler.java:99)
At android.os.Looper.loop(Looper.java:123)
atandroid.app.ActivityThread.main(ActivityThread.java:4363)
At java.lang.reflect.Method.invokeNative(Native Method)
At java.lang.reflect.Method.invoke(Method.java:521)
atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
atcom.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
At dalvik.system.NativeStart.main(Native Method)
"Binder Thread #2" prio=5 tid=11 NATIVE
| group="main" sCount=1 dsCount=0 s=N obj=0x2fb7c260self=0x143860
| sysTid=20601 nice=0 sched=0/0 cgrp=defaulthandle=1211376
At dalvik.system.NativeStart.run(Native Method)
"Binder Thread #1" prio=5 tid=9 NATIVE
| group="main" sCount=1 dsCount=0 s=N obj=0x2fb7c1a0self=0x14c980
| sysTid=20600 nice=0 sched=0/0 cgrp=defaulthandle=1207920
At dalvik.system.NativeStart.run(Native Method)
"Signal Catcher" daemon prio=5 tid=7 RUNNABLE
| group="system" sCount=0 dsCount=0 s=N obj=0x2fb7a1e8self=0x126cc0
| sysTid=20599 nice=0 sched=0/0 cgrp=defaulthandle=1269048
At dalvik.system.NativeStart.run(Native Method)
"HeapWorker" daemon prio=5 tid=5 VMWAIT
| group="system" sCount=1 dsCount=0 s=N obj=0x2e31daf0self=0x135c08
| sysTid=20598 nice=0 sched=0/0 cgrp=defaulthandle=1268528
At dalvik.system.NativeStart.run(Native Method)
----- end 20597 -----
The stack structure of the file is analyzed from bottom to top
(1) bottom of the stack at dalvik.system.NativeStart.run(Native Method)
The system starts a dedicated virtual machine for the current task (application)
(2) atandroid.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
Activity Services is responsible for managing the Activity in the background, it will start the activity of the test example.
(3)at com.android.test.main.onCreate(main.java:20)
Start the test program
(4) Top of the stack at java.lang.VMThread.sleep(Native Method)
The thread was sleeped, so it could not respond to the user and an ANR error occurred.
The above is an analysis of a very simple problem.
If you encounter more complicated problems, you need to analyze the SYSTEM LOG in detail.
1. For example, the network is abnormal, and the network status is output through the network link information output in the SYSTEM LOG.
2. Data transfer, network link and other time-consuming operations need to analyze the response time of the ActivityManager in the SYSTEM LOG


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.