Chinaunix首页 | 论坛 | 博客
  • 博客访问: 95261
  • 博文数量: 21
  • 博客积分: 451
  • 博客等级: 一等列兵
  • 技术积分: 215
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-03 20:46
个人简介

记录技术旅程

文章分类

全部博文(21)

文章存档

2014年(3)

2011年(18)

我的朋友

分类: C/C++

2011-08-22 12:56:02

1. Launch the emulator from the android build system.
  1. emulator -partition-size 512
The GDB need the symbol lib to debug, so we need launch the emulator from the android build system instead of the android SDK system. The emulator detects that you are working from the android build system by looking at the ANDROID_PRODUCT_OUT variable in your environment.
  1. $export ANDROID_PRODUCT_OUT=/absolute-source-path/mydroid/out/target/product/generic
2. Launch the Browser from emulator. Then the Browser is running.

3. Because the browser is running, the browser process id is required by GDB.
  1. $adb shell
  2. #ps
4. Launch the GDB server on the device.
  1. #system/bin/gdbserver :5039 --attach pid
5. On your workstation, forward port 5039 to the device with adb:
  1. $adb forward tcp:5039 tcp:5039
The data transited by PC's 5039 port  will be redirect to the device's 5039 port. 

6.  Launch the latest GDB client.
  1. $prebuild/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gdb out/target/product/generic/symbols/system/bin/app_process
7. In gdb, Tell gdb where to find the shared libraries that will get loaded:
  1. (gdb) set solib-absolute-prefix /absolute-source-path/out/target/product/generic/symbols
  2. (gdb) set solib-search-path /absolute-source-path/out/target/product/generic/symbols/system/lib
8. Connect to the device by issuing the GDB command:
  1. (gdb) target remote :5039
The :5039 tells gdb to connect to the localhost port 5039, which is bridged to the device by adb.

9. You may need to inspire gdb to load some symbols by typing:
  1. (gdb) shared
10. Set the break point and run the program by GDB command.


阅读(1796) | 评论(0) | 转发(0) |
0

上一篇:Debug Android with GDB.

下一篇:#define 总结

给主人留下些什么吧!~~