Three years ago I published “Debugging Failure: Check List and Hints” and unfortunately this article is one of the most popular ones: obviously debugging problems are very common. Debugging with GDB works usually fine, but if things are failing, then it can be hard to find the cause for it. Recently I have been asked to check some failures, so here are two more hints about what could go wrong…
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 behaviour 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 tool chains are installed and have changed the global system path, and the wrong toolchain and GDB gets used. Mixing different GNU versions (compiler/debugger) is always a bad thing.
💡 see the next sections about which GNU tools are used.
Error while launching 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 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 keep it usually empty (so it uses the global setting), but check that path as well:
Lastly, there is setting for each project. If it is empty, then it uses the workspace setting. So check that project setting too:
Check as well in the debugger launch configuration if the settings are correct:
For the GDB Client executable, you might consider directly to point 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 have a read in the articles listed in the Links section below.
Happy Debugging 🙂