Mobile/Fennec/Android/GDBNoRoot
GDB on Android without Root
It is possible to use gdb without root on Android 2.3+ devices!
- Go to your Android NDK directory and enter /build
- Run this:
mkdir lib
adb push prebuilt/linux-x86/arm-eabi-4.4.0/bin/gdbserver /data/local
adb shell chmod 755 /data/local/gdbserver
for file in $(adb shell ls /system/lib | tr "\n" " " | tr "\r" " "); do
adb pull /system/lib/$file lib
done
adb pull /system/bin/app_process lib
- Forward a port, by doing
adb forward tcp:12345 tcp:12345
- Find your pid with
adb shell ps | grep fennec
- Connect to the process on the devices with
adb shell run-as org.mozilla.fennec_unofficial /data/local/gdbserver :12345 --attach THE_PID_YOU_JUST_FOUND
- Run gdb with
./prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gdb ./lib/app_process
- In gdb, run this or just place it in a .gdbinit (then run just android_attach)
def android_attach
set solib-absolute-prefix /builds/android_tools/tegra-gdb-20100902/lib/
set solib-search-path
/builds/android_tools/tegra-gdb-20100902/lib/:/builds/android_tools/tegra-gdb-20100902/lib/system/lib:/builds/mozilla-central/obj-android/dist/bin/
target remote localhost:12345
end