Linux Application Debug Tutorial
Downloaded DS-5 CE as either a complete IDE or an Eclipse plugin, and installed it on your host machine (Windows, Linux or, for plugin-only installation, Mac).
Prepared your Arm-based Linux target platform using the instructions on how to build a kernel and setup a file system for your own board (see manufacturers' website).
To allow Linux application debug, you need to ensure gdbserver is present on the target (apt-get install gdbserver on Ubuntu systems).
To make use of the Remote System Explorer (RSE) that is provided within DS-5, a ssh daemon (sshd) must be running on the target.
For file transfer, RSE makes use of sftp-server, so that must be present in your embedded Linux system.
To run a graphics-intensive application like Xaos, you may need some graphics libraries, such as, gtk, cairo, pango, glib (available through apt-get).
Have built your application. The Xaos application is provided within the examples supplied with DS-5 or can alternatively be downloaded from SourceForge.
This tutorial shows how to debug the open source fractal rendering application Xaos running on Linux on an Arm Cortex-A8 processor-based development board using Arm Development Studio 5 (DS-5) Community Edition. You can also use DS-5 CE to develop Linux or Android applications on other Arm-based platforms in a similar way.
For the purposes of this tutorial, Xaos is built as a multi-threaded application.
Set up a SSH connection using the RSE, and create a debug launch configuration that uses that connection.
In the Remote Systems tab, create a New connection. Select Linux, then click Next. Enter the IP Address, and name it (for example “My BeagleBone Black”).
Click Next. Select ssh.files, then click Finish.
When you first try to connect to the target, RSE prompts you to enter the User ID and Password. The resulting properties for the connection look similar to:
Following a successful RSE connection, you can drill down into the remote target’s file system in Eclipse, and drag and drop files from host to target:
To create a debug launch configuration that uses that RSE connection, select Run -> Debug Configurations…. Create a New launch configuration and give it a name, for example, “xaos-gdbserver-example”.
In the target tree view of the Connection tab, select Generic -> Linux Application Debug -> Download and debug application.
The RSE connection made earlier is automatically used by default:
In the Files tab, enter the stripped executable to download, and the location of the unstripped executable containing the debug information to allow debug at source level.
The resulting dialog looks similar to:
DS-5 Debugger downloads the stripped executable onto the target via RSE, starts gdbserver on the target, reads the debug information from the unstripped executable, and runs to a breakpoint at main().
You can view the source, run, stop, single-step, set breakpoints, set watchpoints, view registers, view variables, view disassembly, view memory, view symbols, view the stack backtrace for each thread, and so on.
To view the graphical output from Xaos either:
- Connect an LCD screen to the board
- Redirect the graphical screen output to the XQuartz X server by setting, for example,
export DISPLAY=[host IP address]:0.0in the Environment tab of the Debug Configurations dialog.
This display uses the XQuartz X server to view the graphical output from Xaos.
That is it. You are debugging an Arm Linux application.