zer0stimulus
zer0stimulus

Reputation: 23616

Android: How to use ndk-gdb with a pure native executable?

I've used ndk-gdb for shared libraries loaded in JNI context. Is it possible to use it to debug pure native executables, built with BUILD_EXECUTABLE target in Android.mk?

Upvotes: 3

Views: 4903

Answers (1)

Frohnzie
Frohnzie

Reputation: 3569

You can use gdbserver to start or attach to a process.

// Start debugger and attach to a running process
adb forward tcp:5039 tcp:5039
adb shell /system/bin/gdbserver tcp:5039 --attach PID

If you correctly configure your Eclipse environment you can debug directly from Eclipse. Below are some links I found that helped me out.

General Debugging:
http://mhandroid.wordpress.com/2011/01/25/how-cc-debugging-works-on-android/

Setting up eclipse:
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/

Upvotes: 4

Related Questions