## Script to patch up diff reated by `repo diff` if [ -z "$1" ] || [ ! -e "$1" ]; then echo "Usages: $0 <repo_diff_file>"; exit 0; fi rm -fr _tmp_splits* cat $1 | csplit -qf '' -b "_tmp_splits.%d.diff" - '/^project.*\/$/' '{*}' working_dir=`pwd` for proj_diff in `ls _tmp_splits.*.diff` do chg_dir=`cat $proj_diff | grep '^project.*\/$' | cut -d " " -f 2` echo "FILE: $proj_diff $chg_dir" if [ -e $chg_dir ]; then ( cd $chg_dir; \ cat $working_dir/$proj_diff | grep -v '^project.*\/$' | patch -Np1;); else echo "$0: Project directory $chg_dir don't exists."; fi done
Saturday, June 17, 2017
How to apply a patch made by repo diff?
Source: https://groups.google.com/forum/#!topic/repo-discuss/43juvD1qGIQ
Android 調試.so庫文件
資料來源: http://www.blogjava.net/anymobile/articles/314685.html
作者:徐建祥(netpirate@gmail.com)
日期:2010/03/06
網址:http://www.anymobile.org
調試步驟如下:
1/ 將異常的地址信息存到文本文件,並存放在項目根目錄;
2/ 使用panic.py解析該文件;
3/ 根據返回的信息(文件名;行號;方法名)調試程序。
以操作第三方的Touch input 輸入法為例,過程如下:
# 該輸入法的英文和手寫OK,操作中文輸入法時,出現異常,軟鍵盤消失,異常日誌如下
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
# 保存異常日誌,存為文件: 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
# 執行腳本
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 "%-30s%s" % (list[1],list[0])
IndexError: list index out of range
# 沒找到庫文件,因為這個文件是第三方的,只存放在/out/target/product/generic/system/lib /libimezi.so,拷貝一份存到/out/target/product/generic/symbols/system/lib /libimezi.so,再次執行腳本
xujianxiang@wingdroid-clone:~/workspace/xujx/wing15$ ./panic.py 20100205_ime.txt
read file ok
zi81keyd.c:0 Zi8GetTableData
zi81keyd.c:0 Zi8InitializeDynamic
# 成功解析異常,沒有zi8庫文件所致,更新如下庫文件,輸入法支持中文拼音。
/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:
作者:徐建祥(netpirate@gmail.com)
日期:2010/03/06
網址:http://www.anymobile.org
調試步驟如下:
1/ 將異常的地址信息存到文本文件,並存放在項目根目錄;
2/ 使用panic.py解析該文件;
3/ 根據返回的信息(文件名;行號;方法名)調試程序。
以操作第三方的Touch input 輸入法為例,過程如下:
# 該輸入法的英文和手寫OK,操作中文輸入法時,出現異常,軟鍵盤消失,異常日誌如下
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
# 保存異常日誌,存為文件: 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
# 執行腳本
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 "%-30s%s" % (list[1],list[0])
IndexError: list index out of range
# 沒找到庫文件,因為這個文件是第三方的,只存放在/out/target/product/generic/system/lib /libimezi.so,拷貝一份存到/out/target/product/generic/symbols/system/lib /libimezi.so,再次執行腳本
xujianxiang@wingdroid-clone:~/workspace/xujx/wing15$ ./panic.py 20100205_ime.txt
read file ok
zi81keyd.c:0 Zi8GetTableData
zi81keyd.c:0 Zi8InitializeDynamic
# 成功解析異常,沒有zi8庫文件所致,更新如下庫文件,輸入法支持中文拼音。
/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:
#!/usr/bin/python # stack symbol parser import os import string import sys #define android product name #ANDROID_PRODUCT_NAME = 'generic' ANDROID_PRODUCT_NAME = 'smdk6410' 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])
Subscribe to:
Posts (Atom)