Debugging an Android NDK application with CGDB

CGDB is a terminal-based lightweight interface to the GNU debugger gdb. It provides a split screen view, which displays the source code along with the debug information. This recipe discusses how to debug Android application with cgdb.

Getting ready

The following instructions install cgdb on different operating systems:

  • If you're using Ubuntu, you can use the following command to install cgdb:
    $ sudo apt-get install cgdb
    

    Alternatively, you can download the source code from http://cgdb.github.com/, and perform the following instructions to install cgdb:

    $ ./configure --prefix=/usr/local
    $ make
    $ sudo make install
    

    Note that cgdb requires libreadline and ncurses development libraries.

  • If you're using Windows, ...

Get Android Native Development Kit Cookbook 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.