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:
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:
Where to find the gdb client is configured in the Eclipse launch configuration:
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’):
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:
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:
OpenOCD GDB Server
OpenOCD works the same way:
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:
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 🙂
Yeah, P&E GDB Server is notorious in Linux, I kill it all the time, just go to terminal and run ‘top’, get the pid and ‘kill pid’
LikeLike
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
LikeLike
Hi Kevin,
GDB comes with the GDB MI (Machine Interface) which you could use as communication between your IDE and the GDB debugger: https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html
I hope this helps,
Erich
LikeLike
Hi Erich,
Thanks for your reply, I’ll investigate the GDB MI.
On a slight side note, do you think this could be something that you could work with: kck.st/1S0HyUp
Kind regards,
Kevin
LikeLike
Hi Kevin,
if it is a NXP/Freescale ARM M4: yes!
Erich
LikeLike
Hi Erich,
Its an NXP/FSL K22
Kind regards,
Kevin
LikeLike
Hi Kevin,
I’m in 🙂
Erich
LikeLike
Hi Erich,
That’s fabulous, thank you for your support. Should you have any questions, please don’t hesitate to ask. Likewise, if you know anyone who may also be interested, please get them on board.
Kind regards,
Kevin
LikeLike
Hi Kevin,
just did 🙂
Erich
LikeLike
Fantastic, thank you ever so much! 🙂
LikeLike
Pingback: Troubleshooting Tips: Failed Debugging with GDB | MCU on Eclipse
Pingback: Tutorial: MCUXpresso SDK with Linux, Part 2: Commandline Debugging with GDB | MCU on Eclipse
Pingback: Eclipse JTAG Debugging the ESP32 with a SEGGER J-Link | MCU on Eclipse