How to debug native code using gdbserver
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.
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.
精彩评论