Troubleshooting Tips: Failed Debugging With GDB
Having problems with your GDB debugging in Eclipse? Here are some troubleshooting hints as to what's gone wrong and how to fix them.
Join the DZone community and get the full member experience.
Join For FreeThree years ago, I published “Debugging Failure: Checklist and Hints” and unfortunately, that article is one of my most popular ones: Obviously, debugging problems are very common. Debugging with GDB usually works fine, but if things are failing, then it can be hard to find the cause for it. Recently, I was asked to check some failures, so here are two more hints about what could go wrong…
For this post, I’m assuming a cross-debugging environment with Eclipse, the Eclipse GDB client, and an external GDB server (see GDB Client and Server: Unlocking GDB) with the GNU MCU Eclipse plugins (although the behavior can be very similar for other combinations).
GDB Debugger Version
As a diagnostic hint: Check the version of the debugger/GDB in the debugger console view. Verify that this version matches what you think you are using.
One common problem is that cygwin or other toolchains are installed and have changed the global system path — leading to the wrong toolchain and GDB being used. Mixing different GNU versions (compiler/debugger) is always a bad thing.
Error While Launching the Command: arm-none-eabi-gdb –version
If you get that error, this basically means that the GDB has not been found and cannot be launched.
Check your global toolchain folder to see if the GDB executable really exists in that path. Below is the setting for the machine:
There is the possibility to overwrite the global setting with a setting for the workspace. I usually keep it empty (so it uses the global setting), but check that path as well:
Lastly, there is the setting for each project. If it is empty, then it uses the workspace setting. So check that project setting, too:
Also check in the debugger launch configuration to see if the settings are correct:
For the GDB client executable, you might consider directly pointing to the GDB executable to avoid any path search issues.
Global System Path Used in Eclipse
The other thing to check is the global system path used by Eclipse when it launches an executable. You can find this in the screenshot below in the workspace settings:
With this, I hope you can find the problem. Otherwise, read the articles listed in the Links section below.
Happy debugging!
Links
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments