ARM Technical Support Knowledge Articles

What setup is needed to use DS-5 for debugging Android native (C/C++) applications and libraries?

Applies to: DS-5


Information in this knowledgebase article applies to:


What setup is needed to use DS-5 for debugging Android native (C/C++) applications and libraries?


You can use DS-5 with the Android Software Development Kit (SDK) and Native Development Kit (NDK).

To install the Android SDK and NDK please refer to Both development kits contain examples on how to get started.

Once you have your Android application running on a device, you can attach gdbserver to the process and start to debug native code with DS-5 Debugger.

To debug with DS-5 Debugger you need to:

  1. Install the Android SDK and NDK.
  2. Build the native code you want to debug with debug symbols.
  3. Start debugging your Java application on the device.
  4. Upload a copy of /system/bin/app_process from the target on to the computer that the debugger runs on. This file is needed by the debugger later on in order to find out which shared libraries are loaded by the target system. You can use the adb tool provided inside the Android SDK to transfer the file.
  5. Open a shell to the device (again this can be done with adb) and determine the process ID of the application you want to debug.
  6. Attach gdbserver to the process i.e. gdbserver --attach :port pid
  7. Setup a DS-5 debug connection to load the symbols for app_process, set the shared library search path (location of the library on the host containing debug symbols) and configure the debugger to connect only.
  8. Connect DS-5 Debugger to gdbserver. (On the android emulator you can forward the port to debug over using the adb tool. In this case connect the debugger to IP address localhost.)
  9. Now you'll have two debug connections, one Java debug connection and one DS-5 connection attached to the same process.

Note DS-5 (from 5.5) now ships with two versions of gdbserver 7.1, gdbserver-stat-7.1 and gdbserver-dyna-7.1, that enables debugging of Android applications on production devices.  gdbserver-stat-7.1 is a statically linked version of gdbserver.  gdbserver-dyna-7.1 is a version that is built to dynamically link against the libraries on the Android target. Information for rebuilding the two binaries can be found in the included README.txt.  Both gdbserver versions and README.txt can be found in <DS-5 installation path>/DS-5/arm/gdbserver/android.


Article last edited on: 2011-05-05 14:06:41

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential