Debugging a native C++ library in a Xamarin Android app

I'm working on a project structured like this:

Application project (Xamarin Android)
-> support library project (Xamarin Android)
->-> Native library (C++, ndk-compiled to .so)

After some changes to the support library, the application has started crashing while executing code in the native library. I would really like to get a backtrace from the other side of the managed-native frontier. I've spent most of today doing increasingly desperate things with ndk-gdb to try to get it to attach to the app. That has so far consisted of:

  1. Rebuilding the native library with NDK_DEBUG=true
  2. Copying the jni, libs, and obj directories created by the native build into [my project]/obj/Debug/android
  3. Executing ndk-debug from [my project]/obj/Debug/android

That gets me the following error message:

ERROR: Non-debuggable application installed on the target device.
Please re-install the debuggable version!

Posts I've found on StackExchange about that error are not encouraging, but they're also fairly old.

Is it possible to debug a native library called by a DLL in a Xamarin application?

I've been through this post, but have not even been able to get ndk-gdb up and running, much less finding breakpoints.

Thanks for any help.

Sign In or Register to comment.