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.

3
  • 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. Commented Jul 12, 2011 at 1:25
  • Thanks for the reply. gdbserver is in sdcard/<myfolder>. 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? Commented Jul 12, 2011 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 :) Commented Jul 13, 2011 at 22:45

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.