

Debugging Android native shared libraries - syngres
http://blog.dornea.nu/2015/07/01/debugging-android-native-shared-libraries/

======
nekitamo
I would like to note that IDA Pro has a very nice debug server which is a nice
alternative to GDB for Android. Also I believe they recently added the ability
to debug dalvik bytecode as well.

Gikdbg is a free alternative, which I believe is a UI wrapper around GDB.
What's interesting about it is that it works for iOS and Android:
[http://gikir.com/product.php](http://gikir.com/product.php)

It's a beta product, so it might take some work to get going, but once you do
it makes you much more productive... especially if you feel at home with
Ollydbg :)

~~~
jevinskie
Last time my coworker tried to use an older IDA's debug server on Android, it
wouldn't work. The device was API >= 14 so it required PIE executables and the
IDA debug server was not. Unfortunate. Luckily IDA 6.8 has a PIE and non-PIE
versions. I also believe that the debug server source is now included in the
SDK, so you could have supposedly rebuilt it in PIE mode yourself.

------
cjslep
As someone that works on a native-only app (using Qt's bindings), it has
bugged me _significantly_ that Android apk's absolutely cannot handle
versioned libraries nor files without the .so prefix.

For instance, bundling the "gdbserver" file that comes with Google's NDK into
the armeabi folder to have gradled up and deploy in a debug version of an apk
will not pack up "gdbserver". And if you have libtinyxml2.so with the
SOVERSION as 3.0? Good luck getting that bundled up into your apk! Recompile
without versioning! Or manually adb push it every time you reinstall your
application. [0]

OK sure you can bundle that up into your apk by skipping gradle and manually
adding and zipaligning it. But then adb will not unpack it onto the phone. So
you are stuck back at square one.

I won't even get into the modifications I've made to my NDK python script with
launching gdb. Suffice to say using gdb to debug nontrivial native android
applications is full of rough edges.

[0]
[https://code.google.com/p/android/issues/detail?id=98308](https://code.google.com/p/android/issues/detail?id=98308)

