2012年7月27日 星期五

[Git] 工作上常使用到的git指令


@可以看某個git check point的詳細紀錄 
git log -p -l 2afeedb08454260516db332d70e661c3ae35e216 

@git 退版 
git checkout -b GoogleReader 2afeedb08454260516db332d70e661c3ae35e216 
說明:新增一個GoogleReader的branch並還原到後面commit point的時間版本 

@建立git push rule的範本 
git config commit.template ~/git-template 

@建立新的branch 
git branch 'branch name' 
Ex. git branch working; //建立一個名字為working的branch 

@刪除branch 
git branch -D 

@只加修改過的檔案, 新增的檔案不加入 
git add -u

2012年7月21日 星期六

[Android] android debug tool - addr2line


一、目的
當程式運作遇到segmentation fault時,可以使用工具來偵測發生錯誤的位置。

二、範例如下所示
通常一旦出錯,錯誤訊息都會秀出這樣的log,只要記錄下address,就可透過addr2line偵測到程式碼哪一個function出錯。

I/DEBUG   (   31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (   31): Build fingerprint: 'generic/sdk/generic:2.3/GRH55/79397:eng/test-keys'
I/DEBUG   (   31): pid: 378, tid: 386  >>> com.example.gltest <<<
I/DEBUG   (   31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG   (   31):  r0 001dbdc0  r1 00000001  r2 00000000  r3 00000000
I/DEBUG   (   31):  r4 00000000  r5 40a40000  r6 4051a480  r7 42ddbee8
I/DEBUG   (   31):  r8 43661b24  r9 42ddbed0  10 42ddbebc  fp 41e462d8
I/DEBUG   (   31):  ip 00000001  sp 436619d0  lr 83a12f5d  pc 8383deb4  cpsr 20000010
I/DEBUG   (   31):          #00  pc 0003deb4  /data/data/com.example.gltest/lib/libnativemaprender.so
I/DEBUG   (   31):          #01  pc 00039b76  /data/data/com.example.gltest/lib/libnativemaprender.so
I/DEBUG   (   31):          #02  pc 00017d34  /system/lib/libdvm.so

三、使用指令如下

格式:arm-linux-androideabi-addr2line -Cfi -e xxx.so 123456

實際使用:arm-linux-androideabi-addr2line -C -f -e obj/local/armeabi/libnativemaprender.so 0003deb4