1. Launch the emulator from the android build system.
- 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.
- $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.
4. Launch the GDB server on the device.
- #system/bin/gdbserver :5039 --attach pid
5. On your workstation, forward port 5039 to the device with adb:
- $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.
- $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:
- (gdb) set solib-absolute-prefix /absolute-source-path/out/target/product/generic/symbols
- (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:
- (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:
10. Set the break point and run the program by GDB command.
阅读(1849) | 评论(0) | 转发(0) |