I set up debugging in Eclipse for native code using the Android NDK (on Windows XP, with Cygwin) to the point where I can set breakpoints in both Java and native code, and the debugger will correctly break them. My problem is that when you go through your own code, I often get segmentation / SIGILL errors that do not occur when continuing through the breakpoint.
- My application is being debugged as defined in AndroidManifest.xml
- I changed (NDK) /build/core/build-binary.mk so that it does not remove debugging characters when
APP_OPTIM is defined as debug, which is in the Application.mk file in my jni directory - I defined
LOCAL_CFLAGS := -g -O0 in the Android.mk file, and I also tried each of these flags separately
I read that this problem is related to the generated optimized code, but disabling optimization with -O0 does not affect my problem. I also came across using the NDK_BUILD=1 flag when creating, but the debuggable=true definition in AndroidManifest.xml seems to have the same effect.
I tried this both on the emulator (running 2.3.3) and on the device (running 2.2 - surprisingly there were no problems with the streams that I expected), with similar results (although, if I remember correctly, the failures occurred at different points code).
Does anyone have an idea of ββthe possible fixes / steps that I could try and / or was able to successfully execute my own code without problems?
Thank you very much
Edit: This has never really been resolved, but for those who want to take a look at my guide for debugging NDKs, you can find it.
Edit 2: The answers I received to this question appeared when new versions of NDK appeared, and this question may now be superfluous. My guide can still work, but I haven't used NDK for a while, so I can't vouch for its correctness. I accepted the answer that I have, since all three basically say the same thing, and this was the first to be presented.
android debugging eclipse android-ndk
President Evil May 05 '11 at 14:46 2011-05-05 14:46
source share