Question

I'm trying to port a Linux C++ application to Android using the Android Native Development Kit (NDK). Thus far, I have my ported application running on an emulator on my Mac. I tried setting a break point in Eclipse in my C++ code at a particular line, but the code runs through my breakpoint without stopping. The java breakpoints on a line work fine, it is just the C++ breakpoints that seem to have no effect and the code just runs as written and returns.

How can I set a breakpoint in my C++ code so that I can step through the native code in my Android application under development in an emulator?

Was it helpful?

Solution

You can't set a C++ breakpoint while debugging Java. You need to run Debug As > Android Native Application. In Eclipse, a hittable breakpoint has a tick.

In order to debug as Android native application, your application needs to have Native Support, you need to have the CDT plugin and you shoud add NDK_DEBUG=1 in the build command.

More info here.

OTHER TIPS

I do not agree with Pau Guillamon's answer that states:

You can't set a C++ breakpoint while debugging Java.

You can set a C++ breakpoint while debugging Java. I'm using Ubuntu 12.04, where you can do this:

root#apt-get install gcj-sdk
............................
root#man gcj

To learn more, see:

  • Compiling Java with GCJ by Per Bothner
  • Java Debugging with gdb by Matt Welsh
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top