用gdb调试webkit
参考:http://source.android.com/porting/debugging_gdb.html, 直接看这一段Detailed Instructions
启动模拟器
$emulator
进入device
$adb shell
从模拟器点击启动Browser
看看它的process id是多少
#ps
记住你要的pid
启动gdbserver, 指定在哪个prot上监听client,指定调试哪个进程
#gdbserver :5039 --attach pid
开始cient端的工作
On your workstation, forward port 5039 to the device with adb: 不知道怎么翻译
打开一个新的终端
$adb forward tcp:5039 tcp:5039
$cd ~/mydroid
找一个最新版本的arm-eabi-gdb
$find -name arm-eabi-gdb
记住path
启动gdbclient
$/home/peipei/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-gdb /home/peipei/mydroid/out/target/product/generic/symbols/system/bin/app_process
In gdb, Tell gdb where to find the shared libraries that will get loaded:
(gdb)set solib-absolute-prefix /home/peipei/mydroid/out/target/product/generic/symbols
(gdb)set solib-search-path /home/peipei/mydroid/out/target/product/generic/symbols/system/lib
小心,路径别写错,如果错了,gdb是不会告诉你的。
另外,要注意,两个路径都要指向symbols目录。
Connect to the device by issuing the gdb command:
(gdb)target remote :5039
The :5039 tells gdb to connect to the localhost port 5039, which is bridged to the device by adb.
You may need to inspire gdb to load some symbols by typing:
(gdb)shared