User:Blassey/Notes/Android: Difference between revisions

Jump to navigation Jump to search
Line 32: Line 32:
With the patch on {{bug|578496}} you can have the logging directed to the android logs and as such only need:
With the patch on {{bug|578496}} you can have the logging directed to the android logs and as such only need:
   adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 NSPR_LOG_MODULES=all:5
   adb shell am start -a android.activity.MAIN -n org.mozilla.fennec/org.mozilla.fennec.App --es env0 NSPR_LOG_MODULES=all:5
==debugging without rooting==
with Froyo you can debug without rooting your phone. However to make this work with the nvidia gdb (which I found more reliable than the android r3 gdb) you need to modify install.sh and debug.sh.
first, change the location where install.sh copies gdbserver to somewhere writable by a non-root process. I used /data/local. Be sure to update that both in the push command and the chmod command.
second, update debug.sh with the new location of gdbserver.
finally, you'll need to add run-as $2 to the adb shell command that launches gdbserver. In the end you should have:
install.sh:
  #!/bin/sh
  mkdir lib
  adb push prebuilt/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 libblassey@big-honker:~/nvidia-gdb$
debug.sh:
  !/bin/sh
  if [ $# -ne 2 ]
  then
      echo "usage: $0 /path/to/your/library.so packagename.of.your.activity"
      echo "for example:"
      echo "  $0 /code/mydemo/libs/armeabi/libmydemo.so com.nvidia.devtech.mydemo"
      exit
  fi
 
  if [ ! -f $1 ]
  then
      echo "ERROR: That library file doesn't exist"
      exit
  fi
 
  cp $1 lib
 
  p=`adb shell ps | grep $2 | awk '{print $2}'`
  if [ "$p" = "" ];
  then
      echo "ERROR: That doesn't seem to be a running process. Please make sure your"
      echo "application has been started and that you are using the correct"
      echo "namespace argument."
      exit
  fi
 
  adb forward tcp:12345 tcp:12345
  adb shell run-as $2 /data/local/gdbserver --attach :12345 $p
Confirmed users
2,023

edits

Navigation menu