Stepping through the Android native code with GDB

Source: Internet
Author: User

Reprint: http://www.360doc.com/content/12/1228/11/9462341_256747689.shtml

The following is an example of GDB debugging Rild, to illustrate how to debug the native process.

Description

#cmd indicates that the command runs on the Android device console $cmd indicates that the command runs on the Linux PC Console (gdb) cmd, indicating that the command runs on the GDB console

1. Debugging a running Rild

#ps | grep rild

Get the Rild process Rild-pid

#gdbserver: 5039--attach rild-pid

Or debug a new rild process

#gdbserver: 5039 Rild

2. Set the forwarding port with ADB

$ADB forward tcp:5039 tcp:5039

3. Under Android's platform directory

$prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gdbout/target/product/saarbmg1/symbols/system/bin/ Rild

4. Setting the symbol table

(GDB) Set Solib-absolute-prefix/home/loginname/android-platform/out/target/product/saarbmg1/symbols (GDB) set Solib-search-path/home/loginname/android-platform/out/target/product/saarbmg1/symbols/system/lib

5. Connect to GDB Server

(GDB) Target remote:5039 (GDB) shared

You can debug it later.

The following is a common gdb debug command

  

So how do you debug the native code for Android apps like browser WebKit? The answer is yes, the author successfully single-Step debugging WebKit code.

Stepping through the Android native code with GDB

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.