How do you debug C ++ for Android NDK?

What are the debugging options for native code on Android? Is gdb the only debugger available? Is their integration with Visual Studio?

I looked at the Android docs and did googlesing, but not sure if I found the correct answer. I hope that some SO pro will save me from trial and error.

But if my options are gdb or printf, I will move on to Mono for Android!

Decision! WinGDB is available for Android. Debugging with Visual Studio!

+4
source share
3 answers

I have not tried this myself, but this blog post explains how to get NDK debugging working in Visual Studio.

In addition, I thought a lot about NDK debugging at work, and I did not see any mention of using a debugger other than gdb (but please do not consider this a fact, this is just from my experience). I was able to successfully debug the NDK through Eclipse, so at least you know that! If you decide to go this route, I can provide you with some links / documentation to get you started.


Edit: Finally, I took the time to format and download the documentation for debugging the NDK. This is not surprising now (in terms of formatting, etc.), but it worked for several people on all platforms. You can find it here . Hope this helps!
+5
source

I found these defs macros, but apart from that I can not say.

#include <android/log.h> #define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "libnav", __VA_ARGS__) #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , "libnav", __VA_ARGS__) #define LOGI(...) __android_log_print(ANDROID_LOG_INFO , "libnav", __VA_ARGS__) #define LOGW(...) __android_log_print(ANDROID_LOG_WARN , "libnav", __VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR , "libnav", __VA_ARGS__) #endif // ANDROID_ALOG_H 

UPDATE

Apparently you can use DDD either as a plugin for eclipse, like on Code Maemo

or run under Cygwin, you will find useful links in Debugging Android NDK under windows

In addition, there are some very useful plugins.

CDT plugin for eclipse

Sequoya Plugin

Installation and configuration of the stack is described in detail in How to debug native code with Android

0
source

For more information, I like this solution, which shows how to use graphical gdb derivatives like cgdb (http://cgdb.github.com/) and ddd (http://www.gnu.org/software/ddd/ ): http://mhandroid.wordpress.com/2011/01/23/using-cgdb-with-ndk-debug-and-cgdb-tutorial/

0
source

All Articles