1

I have followed the instructions for debugging native code found here: http://www.eweek.com/c/a/Linux-and-Open-Source/How-to-Set-Up-Android-Platform-Development-and-Debugging/

To do this, you have to launch gdbserver from an adb shell. I have copied gdbserver to the target filesystem, but can't make it executable (chmod gives permissions errors or 'bad mode' errors).

Do I need to root my device to start gdbserver? (How??) Do I need to copy gdbserver manually? Is there an easier way to do this? This is turning into a black hole of productivity. All I want to do is debug my jni code...

TIA for any help.

lest
  • 11
  • 1
  • 2
  • sounds like you do need to root the handset to be able su and chmod the permissions... alternatively, try copying the gdbserver to /sdcard and give it 755 permissions. – t0mm13b Jul 12 '11 at 01:25
  • Thanks for the reply. gdbserver is in sdcard/. I tried chmod but get 'operation not permitted'. Re: rooting the box (Motorola Xoom), I see lots of posts how to do it, but it looks like all the utilities (1 clickRoot,Xoom one Click, et al) have all been pulled from public sites. Any suggestions on how I can root this device without turning it into a paperweight? – lest Jul 12 '11 at 19:21
  • for starters, rooting does not imply turning it into a paperweight. The only true way of getting a handset to be a paperweight is, flashing the firmware on it and halfway through it, pull the battery - that's guaranteed! Not so with rooting, due to fear and fud being spread. Rooting means, to get su binary working on the handset, normally by exploiting a payload into the adb program to gain root privileges. That is all. As for trying to root your handset, you might get better chance by heading over to xda.com and/or try modaco.com, and search there :) – t0mm13b Jul 13 '11 at 22:45

1 Answers1

1

First of all, /sdcard is mounted with 'noexec' option. Thus, you cannot execute any executable file from /sdcard. You have to put gdbserver to an another file system, like /data/local/tmp.

Second, if you are developing it as an Android application, gdbserver requires proper permission to attach the target process for debug. There are two ways for that. Using run-as or getting root.

Please take a look at Running ndk-gdb with package not found error on motorola phone.

Community
  • 1
  • 1
Kazuki Sakamoto
  • 13,929
  • 2
  • 34
  • 96