134
edits
(Add Debugging with gdb) |
(Make setting up gdb debugging easier) |
||
Line 175: | Line 175: | ||
== Debugging with gdb == | == Debugging with gdb == | ||
The images included with the SDK for emulation are [http://www.yaffs.net/ yaffs2] images and require some work to mount and extract files from. An alternative is to just copy the necessary files from your device via adb pull. /system/bin/linker is referred to by absolute path so setting solib-absolute-prefix in gdb will be necessary for it to be found. Other files can be placed anywhere as long as they can be found in solib-search-path. | |||
In short, find a directory to put some libraries, make sure adb is in your path, and paste this into your terminal: | |||
adb pull /system/bin/linker . && | |||
mkdir -p system/bin && | |||
mv linker system/bin && | |||
for LIB in libc.so libm.so libstdc++.so liblog.so libz.so libGLESv1_CM.so | |||
do | |||
adb pull /system/lib/$LIB . | |||
done | |||
Alternately, unpack the system image of your device somewhere. (eg. signed-dream_devphone_userdebug-ota-14721.zip) | |||
* Forward a port for gdb between your device and computer using adb. Any port you can open should work. 1234 is used here. | * Forward a port for gdb between your device and computer using adb. Any port you can open should work. 1234 is used here. | ||
Line 198: | Line 207: | ||
There is absolutely no warranty for GDB. Type "show warranty" for details. | There is absolutely no warranty for GDB. Type "show warranty" for details. | ||
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-elf-linux"... | This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-elf-linux"... | ||
* Configure solib-absolute-prefix. This will point to the directory where you unpacked your system image | * Configure solib-absolute-prefix. This will point to the directory where you unpacked your system image or where you copied the libraries. | ||
** (Host gdb) set solib-absolute-prefix /home/user/android/sysimg | ** (Host gdb) set solib-absolute-prefix /home/user/android/sysimg | ||
* Configure solib-search-path. This needs to point to the directories you need debugging symbols from | * Configure solib-search-path. This needs to point to the directories you need debugging symbols from - /system/lib or where ever you copied the libraries. | ||
** (Host gdb) set solib-search-path /home/user/android/sysimg/system/lib:/home/user/android/moz-build/dist/bin | ** (Host gdb) set solib-search-path /home/user/android/sysimg/system/lib:/home/user/android/moz-build/dist/bin | ||
* Connect to gdbserver | * Connect to gdbserver |
edits