Debugging with GDB

To use GDB to debug recovery and the updater, we need to tweak the start up script a little so that it won't start the recovery automatically. With this change, after the system boot up, we can start it using gdbserver in the debug console. To do this, we need to make a change to the $OUT/recovery/root/init.rc script as follows:

service recovery /sbin/recovery     seclabel u:r:recovery:s0     disabled

We add the disabled option to the recovery service. After the system boot up, we can start it manually or we can execute the recovery from the command line directly.

Both AOSP and Android NDK include gdb and gdbserver, so the developers can do source-level debugging for native applications.

In AOSP environments, gdb can be found ...

Get Android System Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.