GDB Client and Server: Unlocking GDB

In case you face problems with launching GDB: Then I have a quick solution (well: workaround): kill the GDB server and or client process. The problem can show up in many way, but in general gdb is stuck or does not respond:

GDB stuck?

GDB stuck?

But it could be an error message like this too:

Error in services launch sequence
Starting J-Link GDB Server timed out.

In many cases it helps to repower the debug probe and/or target board (see “Debugging Failure: Check List and Hints“). Other than that, what helps most of the time for me is to kill the gdb client and/or gdb server tasks.

GDB Client

What happens if I press ‘debug’ in Eclipse is: Eclipse launches the gdb client. For ARM this is arm-none-eabi-gdb and in the case of Kinetis Design Studio v3.0.0 it is located here:

C:\Freescale\KDS_3.0.0\toolchain\bin\arm-none-eabi-gdb.exe

You can identify the gdb client easily in the Windows task manager:

arm-none-eabi-gdb.exe

arm-none-eabi-gdb.exe

Where to find the gdb client is configured in the Eclipse launch configuration:

GDB Client Setup

GDB Client Setup

The executable is specified with variables like ${cross_prefix}:

 ${cross_prefix}gdb${cross_suffix}

You can inspect the variables with the menu Window > Preferences > C/C++ > Build > Build Variables (make sure you enable ‘Show system variables’):

Eclipse System Build Variables

Eclipse System Build Variables

Segger J-Link GDB Server

Both gdb client and gdb server are launched from Eclipse. The gdb client then communicates with the gdb server. Which is JLinkGDBServerCL.exe in case of Segger J-Link:

JLink GDB Server

JLink GDB Server

That Segger gdb server executable can be found in Kinetis Design Studio v3.0.0 here:

C:\Freescale\KDS_3.0.0\segger\JLinkGDBServerCL.exe

This is configured in the Eclipse debug configuration:

Calling J-Link Server

Calling J-Link Server

OpenOCD GDB Server

OpenOCD works the same way:

OpenOCD gdb server

OpenOCD gdb server

The OpenOCD server binary is located here:

C:\Freescale\KDS_3.0.0\openocd\bin\openocd.exe

P&E GDB Server

Both Segger J-Link and OpenOCD server used with Eclipse are executables outside of the Eclipse plugins folder. The path to the P&E GDB server binary is not configurable in the P&E debug panel and is present inside the Eclipse plugins folder. In the case of Windows and Kinetis Design Studio v3.0.0 it is located here:

C:\Freescale\KDS_3.0.0\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_2.0.8.201504092111\win32\pegdbserver_console.exe\

Having the server inside the Eclipse plugins folder makes it possible that I can update it using the usual Eclipse updates.

The P&E GDB server can be easily identified in the process list as pegdbserver_console:

P&E GDB Server

P&E GDB Server

Summary

So if something went wrong, then usually what works is to terminate/kill gdb server and client in the Windows task manager:

  • GDB Client: arm-none-eabi-gdb
  • Segger J-Link GDB Server: JLinkGDBServerCL
  • P&E Multilink GDB Server: pegdbserver_console
  • OpenCD GDB Server: openocd

In a similar way, things work as well on Linux or Mac OS.

Happy Killing 🙂

14 thoughts on “GDB Client and Server: Unlocking GDB

  1. Hi Erich,

    Have you ever come across an example which implements GDB debugging in a custom programming environment? For example, I’m developing my own IDE as part of a visual programming package and I want to be able to start and debug the source created by my tool.

    I’m at the stage now where I can compile and program the micro-controller through a Segger J-Link however I’d like to take the next step and get debugging going.

    Hope this makes sense!
    Regards,
    Kevin

    Like

  2. Pingback: Troubleshooting Tips: Failed Debugging with GDB | MCU on Eclipse

  3. Pingback: Tutorial: MCUXpresso SDK with Linux, Part 2: Commandline Debugging with GDB | MCU on Eclipse

  4. Pingback: Eclipse JTAG Debugging the ESP32 with a SEGGER J-Link | MCU on Eclipse

  5. Pingback: Debugging Embedded Targets with pyOCD and Eclipse #Embedded @McuOnEclipse « Adafruit Industries – Makers, hackers, artists, designers and engineers!

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.