Dynamic analysis of Android programs

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.