Android 调试.so库文件(2)

/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

附 panic.py:

1#!/usr/bin/python
 2# stack symbol parser
 3
 4import os
 5import string
 6import sys
 7
 8#define android product name
 9#ANDROID_PRODUCT_NAME = 'generic'
10ANDROID_PRODUCT_NAME = 'smdk6410'
11
12ANDROID_WORKSPACE = os.getcwd()+"/"
13
14# addr2line tool path and symbol path
15addr2line_tool = ANDROID_WORKSPACE + 'prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-addr2line'
16symbol_dir = ANDROID_WORKSPACE + 'out/target/product/' + ANDROID_PRODUCT_NAME +'/symbols'
17symbol_bin = symbol_dir + '/system/bin/'
18symbol_lib = symbol_dir + '/system/lib/'
19
20class ReadLog:
21    def __init__(self,filename):
22        self.logname = filename
23    def parse(self):
24        f = file(self.logname,'r')
25        lines = f.readlines()
26        if lines != []:
27            print 'read file ok'
28        else:
29            print 'read file failed'
30        result =[]
31        for line in lines:
32            if line.find('stack') != -1:
33                print 'stop search'
34                break
35            elif line.find('system') != -1:
36                #print 'find one item' + line
37                result.append(line)
38        return result
39
40class ParseContent:
41    def __init__(self,addr,lib):
42            self.address = addr # pc address
43            self.exename = lib  # executable or shared library
44    def addr2line(self):
45        cmd = addr2line_tool + " -C -f -s -e " + symbol_dir + self.exename + " " + self.address
46        #print cmd
47        stream = os.popen(cmd)
48        lines = stream.readlines();
49        list = map(string.strip,lines)
50        return list
51   
52inputarg = sys.argv
53if len(inputarg) < 2:
54    print 'Please input panic log'
55    exit()
56
57filename = inputarg[1]
58readlog = ReadLog(filename)
59inputlist = readlog.parse()
60
61for item in inputlist:
62    itemsplit = item.split()
63    test = ParseContent(itemsplit[-2],itemsplit[-1])
64    list = test.addr2line()
65    print "%-30s%s" % (list[1],list[0])
66

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwsggf.html