Mobile/Fennec/Android/GDBNoRoot: Difference between revisions

From MozillaWiki
< Mobile‎ | Fennec‎ | Android
Jump to navigation Jump to search
(Created page with "It is possible to use gdb '''without''' root on Android 2.3+ devices! *Go to your Android NDK directory and enter /build<br> *Run this:<br> <br> mkdir lib<br>adb push prebu...")
 
No edit summary
Line 1: Line 1:
= GDB on Android without Root<br> =
It is possible to use gdb '''without''' root on Android 2.3+ devices!  
It is possible to use gdb '''without''' root on Android 2.3+ devices!  


Line 16: Line 18:
*Find your pid with<br>
*Find your pid with<br>


<br>
<br>  


adb shell ps | grep fennec<br><br>
adb shell ps | grep fennec<br><br>  


*Connect to the process on the devices with<br>
*Connect to the process on the devices with<br>


<br>
<br>  


adb shell /data/local/gdbserver :12345 --attach THE_PID_YOU_JUST_FOUND<br>
adb shell /data/local/gdbserver&nbsp;:12345 --attach THE_PID_YOU_JUST_FOUND<br>  


<br>
<br>  


*Run gdb with<br>
*Run gdb with<br>


<br>
<br>  


./prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gdb ./lib/app_process<br>
./prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gdb ./lib/app_process<br>  


<br>
<br>  


*In gdb, run this or just place it in a .gdbinit (then run just android_attach)<br>
*In gdb, run this or just place it in a .gdbinit (then run just android_attach)<br>


<br>def android_attach<br> set solib-absolute-prefix /builds/android_tools/tegra-gdb-20100902/lib/<br> set solib-search-path<br>/builds/android_tools/tegra-gdb-20100902/lib/:/builds/android_tools/tegra-gdb-20100902/lib/system/lib:/builds/mozilla-central/obj-android/dist/bin/<br> target remote localhost:12345<br>end<br>
<br>def android_attach<br> set solib-absolute-prefix /builds/android_tools/tegra-gdb-20100902/lib/<br> set solib-search-path<br>/builds/android_tools/tegra-gdb-20100902/lib/:/builds/android_tools/tegra-gdb-20100902/lib/system/lib:/builds/mozilla-central/obj-android/dist/bin/<br> target remote localhost:12345<br>end<br>  


<br>
<br>

Revision as of 00:11, 21 June 2011

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 /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