Can we specify a custom debug exe, arm-none-eabi-gdb

I’m trying to access debugger RTOS functionality within the PIO GUI debugger.

I can get the functionality to work outside of PIO by enabling rtos support within the JLinkGDBServer and using the arm-none-eabi-gdb debugger from the command line.

With these I can execute the “info threads” gdb command and see the various tasks within my app. With the default PIO debugger I only see the currently executing task.
This appears to be due to functionality within both the debugger client and server.

I see how I should be able add the “rtos” support to the JLinkGDBServer via the appropriate platform.py file by adding the following to the server arguments:

“-rtos GDBServer/RTOSPlugin_FreeRTO”,

What I do not see is how I can get PlatformIO to use the “arm-none-eabi-gdb” debugger rather than it’s default.
Is this possible within PlatformIO or is this a VSCode configuration?

my basic platformio.ini

platform = nordicnrf52
board = wiscore_rak4631
framework = arduino
upload_protocol = jlink
debug_tool = jlink

arm-none-eabi-gdb is always the GDB client for ARM platforms (and the respective x-gdb for other architectures). PlatformIO does not ever use a different GDB client.

The executable usually resides in <home directory>/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gdb.

Why change it? If you need arm-none-eabi-gdb of a different version you should be using platform_packages to replace the toolchain-gccarmnoneeabi package.

Thanks for the quick come back, Yup, user error.

I was looking for arm-none-eabi-gdb in the list of running processes (Linux). I did see piogdb but not the arm debugger and jumped to a bad conclusion. I did run “show version” from the debug view and see you are, of course, correct, should have done that before.

So, the correct debugger is being used. I also failed to notice that my adding the -rtos option to the JLinkGDBServer was not being taken properly.
In the debug view I’m seeing:

SEGGER J-Link GDB Server V7.20
Command Line Version
JLinkARM.dll V7.20 (DLL compiled Apr 28 2021 17:38:26)
WARNING: Unknown command line parameter -rtos /home/leroy/.platformio/packages/tool-jlink/GDBServer/RTOSPlugin_FreeRTOS found.
Command line: -singlerun -rtos /home/leroy/.platformio/packages/tool-jlink/GDBServer/RTOSPlugin_FreeRTOS -if SWD -select USB -device nRF52840_xxAA -port 2331

I can copy the output from ps after starting the debug process shown above and all is well, so, I have something else to try to run down.
My command line version:

/home/leroy/.platformio/packages/tool-jlink/JLinkGDBServerCLExe -singlerun -rtos /home/leroy/.platformio/packages/tool-jlink/GDBServer/RTOSPlugin_FreeRTOS -if SWD -select USB -device nRF52840_xxAA -port 2331

How are you injecting this parameter? As two seperate string entries in the array, right? Looks like it was packed to one here.

Yup, Another user error:

I did not specify the -rtos option correctly in the platform.py file.
Had the option and arg configured as a single item:

“-rtos /home/leroy/.platformio/packages/tool-jlink/GDBServer/RTOSPlugin_FreeRTOS”,

Should have been separate delimited items:

“-rtos”, “/home/leroy/.platformio/packages/tool-jlink/GDBServer/RTOSPlugin_FreeRTOS”

Works great

Thanks maxgerhardt

As a improvement tip, If you want to make it more general you should construct the path dynamically using the analogue to

With respect to tool-jlink, so e.g. change

to

    "arguments": [
        "-singlerun",
        "-if", "SWD",
        "-select", "USB",
        "-device", debug.get("jlink_device"),
        "-rtos", join(platform.get_package_dir("tool-jlink"), "GDBServer","RTOSPlugin_FreeRTOS")
        "-port", "2331"
    ],  

I see the idea, that would be better There are a couple issues with the added line,
join() appears to need to be : os.path.join()

for: platform.get_package_dir

AttributeError: module ‘platform’ has no attribute ‘get_package_dir’

Tried a couple things for this one, but I’m not a python guy

This seems to work, but I will defer to those more in the know.

“-rtos”, os.path.join(“$PACKAGE_DIR/GDBServer”,“RTOSPlugin_FreeRTOS”),

This version also seems to work ok, for me at least (Linux)

“-rtos”, “GDBServer/RTOSPlugin_FreeRTOS”,