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