BBB Remote Debugging
In order to be able to debug remote the remote board needs a suitable gdbserver. There is one already onboard - or it can be downloaded using apt-get, but that one does not operate correct with the toolchain downloaded previously.
But luckily there is a suitable gdbserver included with the gnueabihf tools.
]$ scp /opt/toolchains/gnueabihf/bin/gdbserver <username>@<your BBB IP>:~/
If you set-up password-less login over SSH (see this page for details) your life will be much easier.
You can test your newly developed ARM program on your BBB.
]$ scp <path to your project>/Debug/<yourbinary> <username>@<Your BBB IP address>:~
Log on to your BBB and try
]$ ./<yourbinary>
and inspect the output.
Next thing is to set up remote debugging.
In Eclipse select the Run menu and select Debug Configurations
First mark the C/C++ Remote debugging and then click on the new button to the upper left corner of the dialogue.
You'll get a dialogue like this:
Press the New button to the right of the Connection line.
This will open a dialogue for setting up the connection to the BBB. We'll use SSH.
You can use the local IP address or any other configured for the BBB.
Returning to the main Debug Configuration dialogue you'll see that the Connection now has been filled in with the details you just provided.
Next you'll have to specify the complete path of your program to execute on the BBB. The program will be sent over the SSH connection before launching the gdbserver - so any changes made on the development host will be reflected on the binary on the BBB.
Here I just placed the binary in my home directory, but it could be anywhere suitable.
Next thing to do is to click on the Debugger tab in the top of the dialogue. In this part of the settings you'll have to specify a complete path and name of the debugger - in this case we'll use the Linaro supplied residing in /opt/toolchains/gnueabihf
Also click on the Shared libraries tab and click Add and navigate to /opt/toolchains/gnueabihf/libc/lib and add that. This will remove some error messages during debugging.
Adjust the path to the gdbserver on the BBB.
You are now ready to debug. Press the Debug button.
You're asked a password for your login on the BBB.
And the you're told what system you're debugging.
And finally the debugger launches the program that has been transfered to the remote BBB and the gdbserver is launched with the program a a parameter and you can debug you application just like any other application.
Finally, if you want the F11 key to launch the debugger rather than fiddling around with the mouse trying to find the little debug button, open menu Window->Preferences and locate the setting as showed on the figure below. Select the Always launch the previously launched application. After your initial launch of the application to debug subsequent launches can be done by hitting F11. I find that rather convenient.
This set-up has been heavily inspired by this site and the video by D. Molloy at YouTube.