Android dual-debugger (GDB + jdb) for application debugging

Source: Internet
Author: User

Address: http://blog.csdn.net/ariesjzj/article/details/7402832

In AndroidProgramMost of them are written in Java and run in Dalvik, but they are mixed with native C Code (for example, from JNI calls or from the Android operating system itself ). This causes the control flow to jump between the Java and C contexts during program execution. We usually use GDB to call the C program and jdb to call the Java program, therefore, we can use the dual-debugger method to debug applications in Android.

 

Step 1: Use the wait for debugger feature (http://blog.csdn.net/ariesjzj/article/details/7393573) in Dev tools to stop the program as soon as it is started so that we can set breakpoints. You can also manuallyCodeWaitfordebugger ().

Step 2 set GDB (http://blog.csdn.net/ariesjzj/article/details/7375048), GDB should be stopped in a wait function after startup, then you can set a breakpoint or something, after the input

(GDB) cont

Run the program. Otherwise, the jdb cannot attach.

Step 3 set jdb (http://blog.csdn.net/ariesjzj/article/details/7399249), after jdb is started and attach is successful, the application starts to run (if wait for debugger is set in front ). Then, both debuggers can control the configuration. Of course, just like using both the software debugger and hardware debugger, the program won't run unless both of them run.

Related Article

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.