chapter8--Dynamic Debug Android Program

Source: Internet
Author: User

DDMS

DDMS (Dalvik debug Monitor Server) is a tool for dynamic debugging (I do not know if the Android L will rename--!). DDMS provides file browsing, Logcat, Method profiling and other functions.

Locating critical Code1. Code Injection Method

Use Apktool decompile to get Smali, find the onclick (), such as to find the program registration code, read carefully after the registration code and user input function

invoke-virtual {v1, v0},ljava/lang/string;->equalsignorecase (ljava/lang/string;) Z

Move=result v3

IF-EQZ v3,: cond_2

Then add LOG.V () to output the V0 register:

Const-string v3, "SN"

invoke-static {v3, v0},landroid/util/log;->v (ljava/lang/string; ljava/lang/string;) I

Then use Apktool to pack, sign,

Output SN with "adb logcat-s sn:v".

2. Stack tracing method

Code injection mates Logcat useful but need to read a lot of disassembly code to find "output points".

The stack tracing method also belongs to the injection category.

For example, to find a toast when it was called, do not have to read too much disassembly code, but to locate the toast, and then after this section to join

New Exception ("Print Trace"). Printstacktrace ();

The correspondence Smali is not written in the book.

Then package the signature to run,

In cmd input "adb logcat-s system.err:v *w"

The java.lang.Exception print trace is output as a stack

It then outputs all the methods that were called during the execution of the program boot to Printstacktrace ().

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.