Key point code injection method for fast locating program
Insert the log function to output debugging information.
const-string v0,"TAG"const-string v1,"info"invoke-static {v0,v1},Landroid/util/log;->v(Ljava/lang/String;Ljava/lang/String;)I
Then use Logcat to output the information:
logcat -s TAG:V
TAG is the first parameter of log and V is the rank
Stack Tracking method
By calling: New Exception ("Print stack"). Printstacktrace () to show when a function was called.
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
Then use the Logcat output information:
logcat -s System.err:V*:W
Method Profiling
Use the Android SDK to bring your own
DDMS (location: androidsdk\tools\lib\monitor-x86_64)
You can also use the functions provided by the Android SDK to implement method Profiling for a specific code snippet:
android.os.Debug.startMethodTracing("123");a();android.os.Debug.stopMethodTracing();
The code generates a trace file named 123 in the root of the SD card. Then open the file using the TraceView provided with the Android SDK.
Material:
[Original] Android app dynamic debugging technology--Take Ida for example: https://bbs.pediy.com/thread-217612.htm
Dynamic analysis of Android programs