Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Troubleshooting Tips: Failed Debugging With GDB

DZone's Guide to

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.

· IoT Zone ·
Free Resource

Three 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…

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

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

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

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 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

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

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:

Global Toolchain Folder

Global toolchain folder

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:

Workspace Toolchain Path

Workspace toolchain path

Lastly, there is the 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

Also check in the debugger launch configuration to see if the settings are correct:

Debugger Launch Configuration

Debugger launch configuration

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:

System Path in Eclipse Workspace Settings

System path in Eclipse workspace settings

With this, I hope you can find the problem. Otherwise, read the articles listed in the Links section below.

Happy debugging!

Links

Topics:
iot ,debugging ,gdb debugger ,troubleshooting ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}