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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.