Debugging an Android NDK application with NDK GDB
Android NDK introduces a shell script named ndk-gdb
to help
one to launch a debugging session to debug the native code.
Getting ready
The project must meet the following requirements in order to debug it with ndk-gdb
:
The application is built with the
ndk-build
command.AndroidManifest.xml
has theandroid:debuggable
attribute of the<application>
element set totrue
. This indicates that the application is debuggable even when it is running on a device in the user mode.The application should be running on Android 2.2 or higher.
Please read the Building Android NDK Application at Eclipse recipe before going through this one.
How to do it...
The following steps create a sample Android project and debug it using NDK GDB.
Create an Android application named
HelloNDKGDB
. Set the package name ascookbook.chapter3
. Create an activity namedHelloNDKGDBActivity
. Please refer to the Loading native libraries and registering native methods recipe of Chapter...