Android debugging. So Library File

Source: Internet
Author: User

From: http://blog.csdn.net/netpirate/article/details/5351709

The debugging procedure is as follows:
1. Save the abnormal address information to a text file and store it in the project root directory;
2. Use panic. py to parse the file;
3/debug Based on the returned information (file name; row number; method name)Program.

Take the touch input Input Method of a third party as an example. The process is as follows:

# The English and handwriting of the input method are OK. When you operate the Chinese input method, an exception occurs and the keyboard disappears. The exception log is as follows:

02-05 06:41:19. 834 D/dalvikvm (751): trying to load lib/system/lib/libimezi. So 0x43e2a788

 

02-05 06:41:19. 874 D/dalvikvm (751): added shared lib/system/lib/libimezi. So 0x43e2a788
02-05 06:41:20. 035 I/debug (551 ): **************************************** ********
02-05 06:41:20. 035 I/debug (551): Build fingerprint: 'unknown'
02-05 06:41:20. 035 I/debug (551): PID: 751, TID: 751 >>> com. HTC. Android. CIME <
02-05 06:41:20. 045 I/debug (551): Signal 11 (SIGSEGV), fault ADDR 00000003
02-05 06:41:20. 045 I/debug (551): R0 00000000 R1 00000000 R2 807248ec R3 807248ec
02-05 06:41:20. 055 I/debug (551): R4 00252d80 R5 00000004 R6 00000001 R7 00000000
02-05 06:41:20. 055 I/debug (551): R8 beff8550 R9 41459d28 10 41459d18 FP 00000000
02-05 06:41:20. 055 I/debug (551): IP 8072430c SP beff84f0 LR 80716b4f PC 80717bce CPSR 60000030
02-05 06:41:20. 135 I/debug (551): #00 PC 00017bce/system/lib/libimezi. So
02-05 06:41:20. 135 I/debug (551): #01 PC 00010f80/system/lib/libimezi. So
02-05 06:41:20. 145 I/debug (551): Stack:
02-05 06:41:20. 155 I/debug (551): beff84b0 ad083e10
02-05 06:41:20. 155 I/debug (551): beff84b4 ad05d44f/system/lib/libdvm. So
02-05 06:41:20. 155 I/debug (551): beff84b8 ad06b8a0/system/lib/libdvm. So
02-05 06:41:20. 155 I/debug (551): beff84bc ad083e10
02-05 06:41:20. 167 I/debug (551): beff84c0 43e2aa90
02-05 06:41:20. 175 I/debug (551): beff84c4 00000003
02-05 06:41:20. 175 I/debug (551): beff84c8 00000014
02-05 06:41:20. 185 I/debug (551): beff84cc 80716b4f/system/lib/libimezi. So

# Save the exception log as a file: 20100205_ime.txt

02-05 06:41:20. 045 I/debug (551): R0 00000000 R1 00000000 R2 807248ec R3 807248ec
02-05 06:41:20. 055 I/debug (551): R4 00252d80 R5 00000004 R6 00000001 R7 00000000
02-05 06:41:20. 055 I/debug (551): R8 beff8550 R9 41459d28 10 41459d18 FP 00000000
02-05 06:41:20. 055 I/debug (551): IP 8072430c SP beff84f0 LR 80716b4f PC 80717bce CPSR 60000030
02-05 06:41:20. 135 I/debug (551): #00 PC 00017bce/system/lib/libimezi. So
02-05 06:41:20. 135 I/debug (551): #01 PC 00010f80/system/lib/libimezi. So

# Execute scripts

Xujianxiang @ wingdroid-clone :~ /Workspace/xujx/wing15 $./panic. py 20100205_ime.txt
Read File OK
/Home/xujianxiang/workspace/xujx/wing15/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-addr2line: '/home/xujianxiang/workspace/xujx/wing15/out/target/product/generic/symbols/system/lib/libimezi. so ': no such file
Traceback (most recent call last ):
File "./panic. py", line 69, in <module>
Print "%-30 S % s" % (list [1], list [0])
Indexerror: List Index out of range

# The library file is not found, because the file is third-party and is only stored in/out/target/product/generic/system/lib/libimezi. so, copy and save it to/out/target/product/generic/symbols/system/lib/libimezi. so, execute the script again

Xujianxiang @ wingdroid-clone :~ /Workspace/xujx/wing15 $./panic. py 20100205_ime.txt
Read File OK
Zi81keyd. C: 0 zi8gettabledata
Zi81keyd. C: 0 zi8initializedynamic

# An error occurred while parsing successfully. The zi8 library file is not found. The following library file is updated. The input method supports Chinese pinyin.

/System/lib/Zi/zi8datpyp_cn.z8d
/System/lib/Zi/zi8datpys_cn.z8d
/System/lib/Zi/zi8datzha_cn.z8d
/System/lib/Zi/zi8datzha_hk.z8d
/System/lib/Zi/zi8datzha_tw.z8d
/System/lib/Zi/zi8datzyp_tw.z8d
/System/lib/Zi/zi8datzys_tw.z8d

Attached panic. py:

#! /Usr/bin/Python # stack symbol parserimport osimport stringimport sys # define Android product name # android_product_name = 'generic 'Android _ product_name = 'smdk6410' Android _ workspace = OS. getcwd () + "/" # addr2line tool path and symbol pathaddr2line_tool = android_workspace + 'prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-addr2line 'symbol _ DIR = android_workspace + 'out/target/product/ '+ Andro Id_product_name + '/symbols' symbol _ bin = symbol_dir + '/system/bin/'symbol _ Lib = symbol_dir +'/system/lib/'class 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 'read 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.exe name = lib # executable or shared library def addr2line (Self ): cmd = addr2line_tool + "-C-F-s-e" + symbol_dir + self.exe name + "" + self. address # print cmd stream = OS. popen (CMD) lines = stream. 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 item in inputlist: itemsplit = item. split () test = parsecontent (itemsplit [-2], itemsplit [-1]) List = test. addr2line () print "%-30 S % s" % (list [1], list [0])

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.