This question can be decomposed into multiple smaller problems. The end result would be to be able to set a breakpoint in the C/C++ NFC implementation of a Galaxy Nexus (Android 4.1) device using a debugger such as gdb to examine it's internal state.
- Is it possible to replace the libraries on a Galaxy Nexus devices with ones that contain debugging symbols?
- Is it possible to use gdb to debug the C/C++ implementation of an Android device?
- Is it possible to cross-compile the NFC implementation of Android?
- Are there any examples of somebody trying something similar maybe with another library?
Update: Rooting the device and compiling Jellybean went well overall with some minor errors. In fact there are some very nice flags in the libnfc makefile which enable extensive output while communicating.
However there there is still a debugging problem. To debug libnfc (external/libnfc-nxp) i must attach myself to the process using the library which most likely is the Nfc Manager (packages/apps/Nfc). To debug an application i have to set the debuggable flag.
If i rebuild the Nfc Manager the signature does not match the one already installed on the device which means adb install -r <file>
won't work. adb uninstall com.android.nfc
doesn't work either. Using the hard way of simply deleting the apk from /system/app
creates the error INSTALL_FAILED_SHARED_USER_INCOMPATIBLE
when i try to install the new one. At this point Nfc didn't work at all anymore and i had to reflash the stock image.
Any other ideas how to debug the libnfc library?