Software Debugging Tips on Celadon

In addition the useful tools and techniques documented in the Debugging Native Android Platform Code section on the AOSP website, this article provides additional information to facilitate the software debugging on Celadon devices.

Debugging using gdb

GNU Debugger (gdb) is the most popular debugger for debug C/C++ programs on UNIX systems. You could follow below procedures to tap into a running program, and exercise control over the program to stop execution at a certain point, step through the program one line at a time, and examine variables when problems occur.

  1. If your development host does not have gdb installed, enter the following commands to install gdb tool on your Ubuntu development workstation:

    $ sudo apt-get update
    $ sudo apt-get install gdb
  2. A script is developed to establish a connection from the local gdb program to the gdbserver program running on the Celadon target device. Since the debugging process requires the program symbol tables and some shared libraries in the Celadon build tree, you need to download and save the script in the top-most Celadon source directory before initializing the build variables and selecting the Celadon build target.

    $ cd celadon
    $ curl -O
    $ chmod +x
    $ source build/
    $ lunch celadon-userdebug
  3. Reference the Build Celadon From Source section in the Getting Started Guide to build the Celadon installer image.

  4. After booting up the Intel NUC, set up an adb connection from the development host to the Intel NUC over Ethernet with the following commands prior the debugging process:

    $ adb kill-server
    # Replace the following IP addresses with yours
    $ adb connect
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    connected to
  5. Restart the adb daemon in privileged mode and re-connects to the Intel NUC:

    $ adb root
    restarting adbd as root
    $ adb connect
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    connected to
  6. Let’s say you want to debug the wireless supplicant daemon wpa_supplicant, you can invoke the script with the following command to tap into the running WPA_supplicant daemon, and start debugging the program.

    $ ./  wpa_supplicant
    Attached; pid = 3207
    Listening on port 6000
    GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
    Copyright (C) 2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    Find the GDB manual and other documentation resources online at:
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    Remote debugging from host
    /usr/local/google/buildbot/src/android/master-ndk/toolchain/gdb/gdb-7.11/gdb/gdbserver/regcache.c:264: A problem internal to GDBserver has been detected.