Android: Eclipse gdb error when debugging native code

Go To


I followed a couple of tutorials on line, trying to setup gdb to debug native code:

  1. Chapter 11 of the book Android NDK Beginners Guide.
  2. Video:
  3. Forum:

None of them got my debugger working completely.

I now have a specific problem by following steps, which are agreed by all the above tutorials as the correct steps to debug native code:

  1. In Eclipse, Start my JAVA debugging session and stops at the first breakpoint in my onCreate() method.
  2. In terminal, under my project folder, run ndk-build-eclipse (the copy of the original ndk-gdb without the last line about auto-connecting gdb client to server), with no obvious warning or errors.
  3. In terminal, chmod +x MY_PROJECT/obj/local/armeabi/app_process (I'm on a mac), otherwise I'll get "Cannot run MY_PROJECT/obj/local/armeabi/app_process, for unknown reason" error. This app_process is set as GDB debugger in my C++ debug configuration.
  4. In Eclipse, start my C++ debug configuration.

Then I got an error dialog say:

Error creating session
 Process Terminated
    Process Terminated
    Process Terminated
2012-04-04 19:21
by akbuildmaster
I solved the problem myself. Thanks. Please vote me up if you had the same trouble - akbuildmaster 2012-04-04 20:05


(Solved by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

Solved this myself:

I put the wrong gdb debugger in my C++ debug configuration (under Debugger tab).

  • The one should've been in there (NDK r7b): $NDKROOT/toolchains/$ARCH/prebuilt//bin/arm-linux-androideabi-gdb
  • The one I wrongly put in there: ${PROJECT_DIR}/obj/local/armeabi/app_process, which should be only put in the C/C++ Application under Main tab.

Fixing this solved my problem, and now I can debug native code using gdb in Eclipse!!

2015-01-30 19:32
by XXX