1 抓log打印
LOGCAT 打印出debug打印如下:
I/DEBUG ( 804): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 804): Build fingerprint: 'generic/generic/generic:2.3.1/GRH78/eng.userdev-app-1.20120401.170243:eng/test-keys'
I/DEBUG ( 804): pid: 1067, tid: 1075 >>> system_server <<<
I/DEBUG ( 804): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000004
I/DEBUG ( 804): r0 00000000 r1 00000000 r2 00003057 r3 001c6f84
I/DEBUG ( 804): r4 00000000 r5 001c6f84 r6 00003057 r7 00000000
I/DEBUG ( 804): r8 00100000 r9 8021e239 10 4843a000 fp 00090e68
I/DEBUG ( 804): ip ac52f8ac sp 48539d38 lr 836125e7 pc 83611862 cpsr 40000030
I/DEBUG ( 804): #00 pc 00011862 /system/lib/libGLES_android.so
I/DEBUG ( 804): #01 pc 000125e2 /system/lib/libGLES_android.so
I/DEBUG ( 804): #02 pc 00019b6c /system/lib/libsurfaceflinger.so
I/DEBUG ( 804): #03 pc 00019f18 /system/lib/libsurfaceflinger.so
I/DEBUG ( 804): #04 pc 00026458 /system/lib/libsurfaceflinger.so
I/DEBUG ( 804): #05 pc 0001dd20 /system/lib/libutils.so
I/DEBUG ( 804): #06 pc 0001e2d0 /system/lib/libutils.so
I/DEBUG ( 804): #07 pc 0000c494 /system/lib/libc.so
I/DEBUG ( 804): #08 pc 0000c034 /system/lib/libc.so
I/DEBUG ( 804):
I/DEBUG ( 804): code around pc:
I/DEBUG ( 804): 83611840 ffa4f7ff bd101c20 00006cba 1c04b510
I/DEBUG ( 804): 83611850 ffecf7ff f7f21c20 1c20ea58 46c0bd10
I/DEBUG ( 804): 83611860 6842b510 1c044b08 d007429a 4a084907
I/DEBUG ( 804): 83611870 44792006 1c23447a ea22f7f2 4c056860
I/DEBUG ( 804): 83611880 42481901 bd104148 31415265 000058c2
I/DEBUG ( 804):
I/DEBUG ( 804): code around lr:
I/DEBUG ( 804): 836125c4 2001e002 ffacf7ff 46c0bd10 00003008
I/DEBUG ( 804): 836125d4 1c0cb570 1c1d1c16 d1092801 f7ff1c08
I/DEBUG ( 804): 836125e4 2800f93d 4836d101 68a3e067 d0012b01
I/DEBUG ( 804): 836125f4 e0624834 429e4b34 429ed03c 3b2bdc16
I/DEBUG ( 804): 83612604 d02f429e dc06429e 429e3b2f 332ed023
I/DEBUG ( 804):
I/DEBUG ( 804): stack:
I/DEBUG ( 804): 48539cf8 00100000
I/DEBUG ( 804): 48539cfc 83611b99 /system/lib/libGLES_android.so
I/DEBUG ( 804): 48539d00 001c7110
I/DEBUG ( 804): 48539d04 48539d34
I/DEBUG ( 804): 48539d08 00003033
I/DEBUG ( 804): 48539d0c 8361256f /system/lib/libGLES_android.so
I/DEBUG ( 804): 48539d10 001c7110
I/DEBUG ( 804): 48539d14 00100000
I/DEBUG ( 804): 48539d18 00000001
I/DEBUG ( 804): 48539d1c 8361288b /system/lib/libGLES_android.so
I/DEBUG ( 804): 48539d20 00100000
I/DEBUG ( 804): 48539d24 83611b99 /system/lib/libGLES_android.so
I/DEBUG ( 804): 48539d28 001c6f58
I/DEBUG ( 804): 48539d2c 48539db0
I/DEBUG ( 804): 48539d30 df002777
I/DEBUG ( 804): 48539d34 e3a070ad
I/DEBUG ( 804): #00 48539d38 00000000
I/DEBUG ( 804): 48539d3c 836125e7 /system/lib/libGLES_android.so
I/DEBUG ( 804): #01 48539d40 001c6f58
I/DEBUG ( 804): 48539d44 ac52f738
I/DEBUG ( 804): 48539d48 00000001
I/DEBUG ( 804): 48539d4c ac519b6f /system/lib/libsurfaceflinger.so
2 提出部分log存入error.txt
#00 pc 00011862 /system/lib/libGLES_android.so
#01 pc 000125e2 /system/lib/libGLES_android.so
#02 pc 00019b6c /system/lib/libsurfaceflinger.so
#03 pc 00019f18 /system/lib/libsurfaceflinger.so
#04 pc 00026458 /system/lib/libsurfaceflinger.so
#05 pc 0001dd20 /system/lib/libutils.so
#06 pc 0001e2d0 /system/lib/libutils.so
#07 pc 0000c494 /system/lib/libc.so
#08 pc 0000c034 /system/lib/libc.so
3 前辈总结出来的脚本 hy.panic.py
#!/usr/bin/python
# stack symbol parser
import os
import string
import sys
#define android product name
ANDROID_PRODUCT_NAME = 'generic'
ANDROID_WORKSPACE = os.getcwd()+"/"
# addr2line tool path and symbol path
addr2line_tool = ANDROID_WORKSPACE + 'prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/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/'
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 result
class 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 = stream.readlines();
list = map(string.strip,lines)
return list
inputarg = sys.argv
if 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 "%-30s%s" % (list[1],list[0])
4 将hy.panic.py跟error.txt放在android编译根目录,执行python hy.panic.py error.txt即可到处堆栈
python hy.panic.py error.txt
read file ok
primitives.cpp:688 _ZN7androidL13lerp_triangleEPNS_2gl15ogles_context_tEPNS0_8vertex_tES4_S4_
vertex.cpp:214 glNormal3f
DisplayHardware.cpp:167 android::DisplayHardware::init(unsigned int)
DisplayHardware.cpp:81 DisplayHardware
SurfaceFlinger.cpp:203 android::SurfaceFlinger::readyToRun()
Threads.cpp:753 android::Thread::_threadLoop(void*)
Threads.cpp:127 thread_data_t::trampoline(thread_data_t const*)
pthread.c:207 __thread_entry
pthread.c:343 pthread_create
住:以上为根据前辈的帖子总结!
http://blog.csdn.net/andyhuabing/article/category/843454/4
|