How to Use GDB to debug Android WebKit kernel code

Source: Internet
Author: User

How to Use GDB to debug the android WebKit KernelCode

Sweet Potato

Thanks to the help of the script, it is very easy to use GDB to debug native code in emulator. For example, I used GDB + gdbserver to debug WebKit.

1. Find the corresponding GDB in your toolchain. On the simulator, It is arm-Eabi-GDB. Under prebuild, add its directory to the path.

Export Path = $ android_src/prebuilt/linux-x86/tootlchain/arm-eabi-4.4.0/bin: $ path

Or directly add ~ /. Bashrc

2. Execute the configuration script.

CD $ android_src

Source build/envsetup. Sh

3. Start the simulator and run the browser

L gdbclient app _ process: 5039 Browser

Now we can see that GDB is successfully started (although there is warning). Now we can use the gdb command you are familiar.

See

15 ldmdf SP! {R4, R7}

Currentlanguage: auto; current ASM

4. Set breakpoints

Bframeloaderclientandroid. cpp: 868

5. Execute

C

6. Visit a website and you will see the gdb breakpoint. Enjoy it!

Building this environment on target is a little more complicated, because target compiles the release library out of space considerations and has a prelink process, modify the map file to put down the debug library of WebCore.

Building this environment on target is a little more complicated, because target compiles the release library out of space considerations and has a prelink process, modify the map file to put down the debug library of WebCore.

The following lab environment is my HTC magic + cm6.0

1. If the $ android_src root directory does not contain buildspec. mk, perform the following operations. If yes, ignore this step.

MV build/buildspec. mk. Default build/buildspec. mk

2. Modify buildspec. mk and add the following lines

Debug_module_libwebcore: = true
Debug_module_libxml2: = true
Target_custom_debug_cflags: =-O0-mlong-CILS

"Additional_build_properties + = debugging. DB. uid = 100000

Lmka bacon compilation, prelink failed

Prelink maperror: Library libwebcore. So @ 0xa8300000 is too big at 10644851 bytes, it runs3304819 bytes into librarylibexpat. So @ 0xa8a00000!

It can be seen that libwebcore has a space of 3 m out of the border. In fact, it is not enough for me to add 3 m, it is a little more than 3 m, so we need to add 4 m

3. Modify $ android_src/build/CORE/prelink-linux-arm.map (back up before change)

Search libwebcore. So and find

Libsqlite. So 0xa8b00000 #[~ 2 m]

Libexpat. So 0xa8a00000 #[~ 1 m]

Libwebcore. So 0xa8300000 #[~ 7 m]

Add libwebcore. So to 11 m, that is

Libsqlite. So 0xa8f00000 #[~ 2 m]

Libexpat. So 0xa8e00000 #[~ 1 m]

Libwebcore. So 0xa8300000 #[~ 11 m]

 

The. So parameter on libsqlite. So must also be changed. Ignore it here. There is a small workload. We can modify Android. mk to disable prelink on the Internet. I tried it and did not succeed, so I honestly changed the map file of this prelink.

The rest is the same as emulator.

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.