Troubleshooting Tips: Failed Debugging with GDB

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…

Error while launching command: arm-none-eabi-gdb --version

Error while launching command: arm-none-eabi-gdb –version

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

Debugger Console

Debugger Console

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

Error while launching command: arm-none-eabi-gdb --version

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:

Global Toolchain Folder

Global Toolchain Folder

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:

Workspace Toolchain Path

Workspace Toolchain Path

Lastly, there is setting for each project. If it is empty, then it uses the workspace setting. So check that project setting too:

Project Toolchain Path

Project Toolchain Path

Check as well in the debugger launch configuration if the settings are correct:

Debugger Launch Configuration

Debugger Launch Configuration

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:

System Path in Eclipse Workspace Settings

System Path in Eclipse 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 🙂

Links

Advertisements

2 thoughts on “Troubleshooting Tips: Failed Debugging with GDB

  1. hi Erich,
    I have a very weird problem. first of all I used kds with the sdk 1.3, the mcu is k64. I have written a program which works fine. however, if i make a copy of it and try to run that, it doesn’t work like to original one. or if i add just a few more codes, like do simple arithmetic with values obtained from the adc, the adc all of the sudden produces very different values. or when switch between run mode and very low power stop mode periodically, the debug console either stop working or if it works then only 3, 4 times before it stops completely.
    do you have any ideas why?
    thanks

    Like

What do you think?

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

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s