Remotely debug programs running on the Parallella board

I am running the Parallella board in the headless mode, normally I’ll just start a VNC session and connect to the board. However, debugging programs running on Parallella board with GDB in a terminal window is really painful.

I tried installing and using DDD in the VNC session, but failed to get it working. It’s always stuck at a stage complaining that GDB is busy. That’s why I was forced to use GDBserver, instead.

Now, in order to debug an ARM program the DDD on host would need access to the binary image of the built ARM program. There are two convenient ways to make the image accessible by DDD.

The first method is to cross-build for Parallella on host and install the binaries to a directory on host. The next step would be to export that directory as an NFS share, so that the Parallela board can mount that NFS share and run the program. However, this method does not work for now since the Parallella SDK right now does not support cross-building nicely.

This leaves the second method as the only good one I can think of. The program is built native on Parallella, and the directory that contain the source tree is exported. The host mounts the directory and then has access to the images. Note that the default kernel in the Ubuntu image provided by Adapteva does not have NFS support so a customary kernel would need to be built. The detailed information on building a kernel for Parallella can be found on the forum.

I am running 32-bit Fedora as my host OS. Initially, I thought that I have to install the arm-none-eabi-gdb package as the inferior debugger under DDD. However, that’s always causing a protocol error. Until one time I inadvertently supplied the native GDB as the inferior debugger, everything suddenly works. I am still scratching my head on this. But it looks like the natively-built GDB on x86 can recognized binaries built for ARM and communicate with ARM targets correctly. Now I don’t get why the arm-none-eabi-gdb package is needed at all.

Once we can mount exported share of Parallella on the host, we are ready to kick start debugging process:

  1. On the host, mount the exported share first:

    $sudo mount -t nfs parallella:/home/linaro/Work ~/parallella

  2. On the Parallella, we can start the program to be debugged like the example below:

    $gdbserver localhost:65432 ffmpeg_g -f hevc -i str.bin -f rawvideo decoded.yuv

  3. On the host, change directory to where the binary image resides, and start DDD:

    $ddd ffmpeg_g

    Once inside the debugger console of DDD, we can connect to the GDB server running on Parallella:

    (gdb) target remote parallella:65432

    Once the connection is established, we can use DDD as usual. Once we complete the debugging session, we can detach from the server:

    (gdb) detach

If there is communication issue between the GDB client and the server, here are two links for understanding the root cause of the issue:


About jadecolour

One of the seven billion on this planet.


Fill in your details below or click an icon to log in: 徽标

You are commenting using your account. Log Out /  更改 )

Google+ photo

You are commenting using your Google+ account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )


Connecting to %s