Android--debug Stack

Source: Internet
Author: User
Tags python script

When the Android system performs a fatal error such as a panic. Usually there will be a stack of debug information to print, generally directly look at the root of the problem is not where! Record the method of my android4.2 debug stack log.


Writing is not easy, reproduced please specify the source: http://blog.csdn.net/jscese/article/details/38232667


A. DEBUG log

This is the stack message that I'm having error:

01-01 08:00:03.376 I/debug (929): R0 0000000e R1 00000000 R2 00000002 R3 0000000001-01 08:00:03.376 I/debug ( 929): R4 404cd890 R5 00000002 R6 00000000 R7 0000000e01-01 08:00:03.376 i/debug (929): R8 404CCDDC R9 40 4cd414 SL 404cd414 FP 404cd89401-01 08:00:03.376 i/debug (929): IP 00000073 sp 404ccd20 lr 4012aec1 pc 401245 CPSR 2000001001-01 08:00:03.376 I/debug (929): D0 7664206e69207961 d1 656c646e6168202001-01 08:00:03.376 i/ DEBUG (929): D2 6f69746974726150 D3 332064656464416e01-01 08:00:03.376 i/debug (929): D4 30636d6d2f306 36d d5 6c622f313030303a01-01 08:00:03.376 i/debug (929): D6 62636d6d2f6b636f D7 62636d6d2f306b6c01-01 08:00:0 3.376 I/debug (929): D8 0000000000000000 D9 000000000000000001-01 08:00:03.376 i/debug (929): D10 00000  00000000000 D11 000000000000000001-01 08:00:03.376 i/debug (929): D12 0000000000000000 D13 000000000000000001-01   08:00:03.376 I/debug(929): D14 0000000000000000 d15 000000000000000001-01 08:00:03.376 i/debug (929): D16 000000000c7f0000 D17 000000000c80000001-01 08:00:03.376 I/debug (929): D18 4163fc8780000000 d19 000000000000000001-01 08:00:03.376 I/ DEBUG (929): d20 0000000000000000 d21 000000000000000001-01 08:00:03.376 i/debug (929): D22 0000000000000 D23 000000000000000001-01 08:00:03.376 I/debug (929): D24 0000000000000000 d25 000000000000000001-01 08:00:0 3.376 I/debug (929): D26 0000000000000000 d27 000000000000000001-01 08:00:03.376 i/debug (929): D28 00000  00000000000 d29 000000000000000001-01 08:00:03.376 i/debug (929): D30 0000000000000000 d31 000000000000000001-01 08:00:03.376 I/debug (929): SCR 0000001001-01 08:00:03.380 i/debug (929): 01-01 08:00:03.380 I/debug (929  ): backtrace:01-01 08:00:03.380 I/debug (929): #00 pc 00019570/system/lib/libc.so (strlen+16) 01-01 08:00:03.380     I/debug (929):#01 pc 0001febd/system/lib/libc.so (__vfprintf+2124) 01-01 08:00:03.380 i/debug (929): #02 pc 00021303/system /lib/libc.so (vsnprintf+70) 01-01 08:00:03.380 i/debug (929): #03 pc 0000139d/system/lib/liblog.so (__android_lo  g_buf_print+44) 01-01 08:00:03.380 i/debug (929): #04 pc 0000cfd7/system/bin/vold01-01 08:00:03.380 I/DEBUG ( 929): 01-01 08:00:03.380 I/debug (929): stack:01-01 08:00:03.380 I/debug (929): 404ccce0 404cd474 01-0          1 08:00:03.380 i/debug (929): 404ccce4 40128f73/system/lib/libc.so01-01 08:00:03.380 i/debug (929):   404ccce8 404cd414 01-01 08:00:03.380 i/debug (929): 404cccec 404ccd98 01-01 08:00:03.380 i/debug (929): 404cccf0 00000000 01-01 08:00:03.380 i/debug (929): 404cccf4 404ccd98 01-01 08:00:03.3 I/debug (929): 404cccf8 00000001 01-01 08:00:03.384 i/debug (929): 404CCCFC 4001d821/sys TEM/BIN/VOLD01-01 08:00:03.384 I/debug (929): 404ccd00 0000002d 01-01 08:00:03.384 i/debug (929): 404ccd04 404CCDDC   01-01 08:00:03.384 I/debug (929): 404ccd08 404cd414 01-01 08:00:03.384 i/debug (929): 404ccd0c          FFFFFFFF 01-01 08:00:03.388 I/debug (929): 404ccd10 00000001 01-01 08:00:03.388 i/debug (929): 404ccd14 4012a667/system/lib/libc.so01-01 08:00:03.388 I/debug (929): 404ccd18 df0027ad 01-01 08:00:  03.388 I/debug (929): 404ccd1c 00000000 01-01 08:00:03.388 i/debug (929): #00 404CCD20 00000000 01-01 08:00:03.388 I/debug (929): .........   01-01 08:00:03.388 I/debug (929): #01 404CCD20 00000000 01-01 08:00:03.388 i/debug (929): 404CCD24          00000000 01-01 08:00:03.388 I/debug (929): 404ccd28 00000000 01-01 08:00:03.388 i/debug (929):  404CCD2C 00000000 01-01 08:00:03.388 i/debug (929): 404ccd3000000000 01-01 08:00:03.388 I/debug (929): 404ccd34 00000073 01-01 08:00:03.388 i/debug (929): 404ccd38 00000000 01-01 08:00:03.388 i/debug (929): 404ccd3c ffffffff 01-01 08:00:03.388 i/debug (9  ): 404ccd40 404CCDDC 01-01 08:00:03.388 i/debug (929): 404ccd44 4001d85a/system/bin/vold01-01 08:00:03.388 I/debug (929): 404ccd48 00000000 01-01 08:00:03.388 i/debug (929): 404ccd4c 000 00034 01-01 08:00:03.388 I/debug (929): 404ccd50 00000000 01-01 08:00:03.388 i/debug (929): 4 04ccd54 00000000 01-01 08:00:03.388 i/debug (929): 404ccd58 4001d824/system/bin/vold01-01 08:00:03.388 I /debug (929): 404ccd5c 00000000 01-01 08:00:03.388 i/debug (929): .......   01-01 08:00:03.388 I/debug (929): #02 404cd400 00000000 01-01 08:00:03.388 i/debug (929): 404cd404 00000000 01-01 08:00:03.388 i/dEbug (929): 404cd408 00000000 01-01 08:00:03.388 i/debug (929): 404cd40c 00000000 01-01 08:0   0:03.388 I/debug (929): 404cd410 00004000 01-01 08:00:03.388 i/debug (929): 404cd414 404cd474 01-01 08:00:03.388 I/debug (929): 404cd418 4014d498/system/lib/libc.so01-01 08:00:03.388 I/DEBUG (92 9): 404cd41c 000003ff 01-01 08:00:03.388 i/debug (929): 404cd420 ffff0208 [vectors]01-01 08:00:0 3.388 I/debug (929): 404cd424 404cd474 01-01 08:00:03.388 i/debug (929): 404cd428 000003ff 0          1-01 08:00:03.388 I/debug (929): 404cd42c 4001d578/system/bin/vold01-01 08:00:03.388 I/DEBUG (929):   404cd430 00000003 01-01 08:00:03.388 i/debug (929): 404cd434 404cd474 01-01 08:00:03.388 I/DEBUG (929): 404cd438 00000003 01-01 08:00:03.388 i/debug (929): 404cd43c 401072a3/system/lib/libl Og.so (__android_log_buf_write+186) 01-01 08:00:03.388 i/debug (929): ........  01-01 08:00:03.392 I/debug (929): 01-01 08:00:03.392 I/debug (929): Memory near R4:01-01 08:00:03.392 I/debug ( 929): 404cd870 404cdb7c 689886ea 40021d88 404cd8b4 01-01 08:00:03.392 i/debug (929): 404cd880 404CD9FC 404CD b7c 40010fdb 4001d824 01-01 08:00:03.392 i/debug (929): 404cd890 0000000e 00000000 00000000 00000000 01-01 08:00 : 03.392 I/debug (929): 404cd8a0 00000000 40584a00 40584af8 40584be8 01-01 08:00:03.392 i/debug (929): 404 Cd8b0 00000000 0000000e 000000b3 0000000e 01-01 08:00:03.392 i/debug (929): 404cd8c0 40584bb6 00000000 00000000 0 0000000 01-01 08:00:03.392 I/debug (929): 404cd8d0 401815fc 000000f9 000000c0 000000bf 01-01 08:00:03.392 I/DEBU  G (929): 404cd8e0 0000655f 40021d88 00000001 40129b39 01-01 08:00:03.392 i/debug (929): 404cd8f0 404cd968    00000000 00000000 00000000 01-01 08:00:03.392 i/debug (929): 404cd900 00004000 404cd9f0 00000000 7fffffdb 01-01 08:00:03.392 i/debug (929): 404cd910 ffff0208 689886ea 7fffff FF 689886ea 01-01 08:00:03.392 i/debug (929): 404cd920 00000000 00000000 00000000 00000000 01-01 08:00:03.392 I/ DEBUG (929): 404cd930 00000000 00000000 404cda0c 404cd9fc 01-01 08:00:03.392 i/debug (929): 404cd940 404c db7c 4057217c 40572158 40021d88 01-01 08:00:03.392 i/debug (929): 404cd950 00000001 40129aeb 404cd9cc 00000000 0 1-01 08:00:03.392 I/debug (929): 404cd960 404cd9d4 00000000 00000000 404cda60 01-01 08:00:03.392 I/DEBUG (929 ): 01-01 08:00:03.392 I/debug (929): Memory near R8:01-01 08:00:03.392 I/debug (929): 404ccdbc 00000000 000000 XX 00000000 00000000 01-01 08:00:03.392 i/debug (929): 404CCDCC 00000000 00000000 4001d824 00000034 01-01 08:00: 03.392 I/debug (929): 404CCDDC 00000000 00000000 00000000 00000000 01-01 08:00:03.392 i/debug (929): 404c CDec 00000000 00000000 00000000 00000000 01-01 08:00:03.392 i/debug (929): 404CCDFC 00000000 00000000 00000000 00000000 01-01 08:00:03.3  I/debug (929): 404cce0c 00000000 00000000 00000000 00000000 01-01 08:00:03.392 i/debug (929): 404cce1c 00000000 404cd60f 40128f73 404cd5ed 01-01 08:00:03.392 i/debug (929): 404cce2c 40128f73 404cd55c 404ccee0 000000   XX 01-01 08:00:03.392 i/debug (929): 404cce3c 404ccee0 00000002 4001d68f 00000001 01-01 08:00:03.392 I/DEBUG ( 929): 404cce4c 404ccf24 404cd55c ffffffff fffffff7 01-01 08:00:03.392 i/debug (929): 404cce5c 4012a667 404c D9DC 4012b88d 00000000 01-01 08:00:03.392 i/debug (929): 404cce6c 00000000 00000000 00000073 00000000 01-01 08:0 0:03.392 I/debug (929): 404cce7c 00000073 00000008 00000000 00000009 01-01 08:00:03.392 I/DEBUG (929): 40 4cce8c 4001d68e 00000000 00000032 00000000 01-01 08:00:03.392 i/debug (929): 404cce9c 00000000 4001d664 00000000 4014d498 01-01 08:00:03.392 I/debug (929): 404cceac 4014d4a8 00000000 40156228 00000000 01-01 08:00:03.392 i/debug (929): 01-01 08:0 0:03.392 I/debug (929): Memory near R9:01-01 08:00:03.392 I/debug (929): 404cd3f4 40021d88 00000001 4012c307 0 0000000 01-01 08:00:03.392 I/DEBUG ( 929): 404cd404 00000000 00000000 00000000 00004000 01-01 08:00:03.392 I/DEBU  G (929): 404cd414 404cd474 4014d498 000003ff ffff0208 01-01 08:00:03.392 i/debug (929): 404cd424 404cd474  000003FF 4001d578 00000003 01-01 08:00:03.392 i/debug (929): 404cd434 404cd474 00000003 401072a3 00000000 01-01     08:00:03.392 I/debug (929): 404cd444 404cd404 404cd444 00000001 4001d578 01-01 08:00:03.396 I/DEBUG (929): 404cd454 0000000d 404cd474 0000002e 40156228 01-01 08:00:03.396 i/debug (929): 404cd464 4001d578 40156228 4010 73A1 404cd890 01-01 08:00:03.396 i/debug (929): 404cd474 6563736a 64206573 6c707369 69207961 01-01 08:00:03.396 I/debug (929): 404cd484 7664206e 61682020 656c646e 74726150 01-01 08:00:03.396 i/debug (929): 404cd494 6f697469 6464416e 33206465 0000000a 01-01 08:00:03.396 I/debug (929): 404cd4a4 00000000 00000000 38663735 62353536 01-01 08:00:03.396 I/DE BUG (929): 404cd4b4 00000000 00000000 00000000 00000000 01-01 08:00:03.396 i/debug (929): 404cd4c4 000000 XX 00000000 00000000 00000000 01-01 08:00:03.396 i/debug (929): 404cd4d4 00000000 00000000 00000000 00000000 01-  08:00:03.396 I/debug (929): 404cd4e4 00000000 00000000 00000000 00000000

need to analyze the above debug, just need to extract a portion of the content and then saved to a txt text, extracts such as the following content

#00  pc 00019570  /system/lib/libc.so#01  pc 0001febd  /system/lib/libc.so#02  pc 00021303  / system/lib/libc.so#03  pc 0000139d  /system/lib/liblog.so#04  pc 0000caa9  /system/bin/vold

Saved to Error.txt, you need to be aware of the interval alignment of the saved content.


Two. Python

Need an analysis of the above extracted error.txt DEBUG information debug.py:

#!/usr/bin/python# stack symbol parserimport osimport stringimport sys#define android Product Nameandroid_product_name = ' GOTECHCN ' android_workspace = OS.GETCWD () + "/" # Addr2line tool path and Symbol Pathaddr2line_tool = android_workspace + ' PR Ebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-addr2line ' Symbol_dir = android_workspace + ' out/target/product /' + android_product_name + '/symbols ' Symbol_bin = symbol_dir + '/system/bin/' symbol_lib = symbol_dir + '/system/lib/' Clas S readlog:def __init__ (self,filename): self.logname = filename def parse (self): F = File (Self.logname , ' r ') lines = F.readlines () if lines! = []: print ' read file ok ' Else:print ' r EAD file failed ' result =[] for line in Lines:if line.find (' stack ')! = -1:print                 ' Stop search ' break elif line.find (' system ')! =-1: #print ' Find one item ' + Line Result.append (line) return ResultClass parsecontent:def __init__ (self,addr,lib): self.address = addr # PC Address  Self.exename = lib # executable or shared library def addr2line (self): cmd = Addr2line_tool + "-c-f-S -E "+ symbol_dir + self.exename +" "+ self.address #print cmd stream = os.popen (cmd) lines = Stre    Am.readlines () List = map (string.strip,lines) return list inputarg = Sys.argvif len (inputarg) < 2: print ' Please input panic log ' exit () filename = Inputarg[1]readlog = readlog (filename) inputlist = Readlog.parse () for it EM in inputlist:itemsplit = Item.split () test = Parsecontent (itemsplit[-2],itemsplit[-1]) List = Test.addr2line ( ) print "%-30s%s"% (List[1],list[0])

This Python script is provided by Google, used to analyze debug, need to be aware of the configuration of their own corresponding Android_product_name,Used to find the appropriate tool in your Android source code . My product_name for "GOTECHCN".

Addr2line_tool The path of each Android version number may also be different, you need to configure according to their own source code.

I android4.2 also need CP out/system/lib/egl/libgles_android.so to out/system/lib folder for the above script to use


Three. Parsing

After the above two steps are done. Run the debug.py and Error.txt CP to the root folder of the Android source code:

Python debug.py error.txt

According to my above error.txt can get for example the following results:

Read file okstrlen.c:52                   strlenstring.h:221                  strlenvsnprintf.c:61                vsnprintfstdio.h:490                   __android_ log_buf_printdirectvolume.cpp:291          directvolume::handlediskchanged (char const*, netlinkevent*)

This is the source of the problem and can be based on this debug




Android--debug Stack

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.