標籤:read ash 利用 com ons 通過 int rac str
快速定位程式關鍵點代碼注入法
插入log函數,輸出調試資訊。
const-string v0,"TAG"const-string v1,"info"invoke-static {v0,v1},Landroid/util/log;->v(Ljava/lang/String;Ljava/lang/String;)I
然後使用logcat 輸出資訊:
logcat -s TAG:V
TAG 為 log 的第一個參數,V為等級
棧跟蹤法
通過調用:new Exception("Print stack").printStackTrace();來顯示某個函數是什麼時候被調用的。
new-instance v0,Ljava/lang/Exception;const-string v1,"print stack"invoke-direct {v0,v1},Ljava/lang/Exception;-><init>(Ljava/lang/String;)Vinvoke-virtual {v0},Ljava/lang/Exception;->printStackTrace()V
然後利用 logcat 輸出資訊:
logcat -s System.err:V*:W
Method Profiling
利用Android SDK 內建的
DDMS(位置:AndroidSDK\tools\lib\monitor-x86_64)
也可以利用Android SDK 提供的函數,實現特定程式碼片段的Method Profiling:
android.os.Debug.startMethodTracing("123");a();android.os.Debug.stopMethodTracing();
該代碼會在sd卡的根目錄產生名123的trace檔案。然後利用Android sdk 提供的 traceview 開啟該檔案.
質料:
[原創]安卓APP動態調試技術--以IDA為例:https://bbs.pediy.com/thread-217612.htm
動態分析Android程式