ST-Util: GDB Server Quit Unexpectedly (Both Cortex-Debug 1.4.4 as 1.5.1)

See original GitHub issue

Setup

  • VSCode 1.67.2
  • Windows_NT x64 10.0.22000
  • st-util Release 1.7.0 (from https://github.com/stlink-org/stlink)
  • ARM Toolchain arm-none-eabi 11.2.2022.02
  • Tested both Cortex-Debug v1.4.4 (stable) and v1.5.1 (pre-release)

Problem Error during launch of debugging. The code also does not get loaded in flash of the MCU, although I can see some comunication happening with the ST-Link. Same issue when using stutil as stlink servertype. Error: ST-Util: GDB Server Quit Unexpectedly. See gdb-server output for more details. Flashing and running using st-flash works fine. Debugging through STM32CubeIDE as well. I’ve attached as much information as possible. All help here is appreciated!

Launch Config

"configuration": {
    "name": "STlink debug launch",
    "cwd": "C:\\Users\\user\\Desktop\\Nucleo-F030-test",
    "executable": "C:/Users\\user\\Desktop\\Nucleo-F030-test\\build\\Nucleo-F030-test.elf",
    "request": "launch",
    "type": "cortex-debug",
    "servertype": "stutil",
    "device": "STM32F030R8",
    "interface": "swd",
    "runToEntryPoint": "main",
    "preLaunchTask": "Compile using make",
    "svdFile": "C:\\Users\\user\\Desktop\\Nucleo-F030-test/.vscode/STM32F0x0.svd",
    "swoConfig": {
        "source": "probe",
        "decoders": []
    },
    "showDevDebugOutput": "raw",
    "__configurationTarget": 5,
    "gdbServerConsolePort": 55878,
    "pvtAvoidPorts": [],
    "chainedConfigurations": {
        "enabled": false
    },
    "debuggerArgs": [],
    "rttConfig": {
        "enabled": false,
        "decoders": []
    },
    "graphConfig": [],
    "preLaunchCommands": [],
    "postLaunchCommands": [],
    "preAttachCommands": [],
    "postAttachCommands": [],
    "preRestartCommands": [],
    "postRestartCommands": [],
    "serverpath": "C:\\Program Files (x86)\\stlink\\stlink-1.7.0-x86_64-w64-mingw32\\bin\\st-util.exe",
    "toolchainPath": "C:\\Program Files (x86)\\Arm GNU Toolchain arm-none-eabi\\11.2 2022.02\\bin",
    "toolchainPrefix": "arm-none-eabi",
    "gdbPath": "C:\\Program Files (x86)\\Arm GNU Toolchain arm-none-eabi\\11.2 2022.02\\bin\\arm-none-eabi-gdb.exe",
    "objdumpPath": null,
    "extensionPath": "c:/Users/user/.vscode/extensions/marus25.cortex-debug-1.5.1",
    "registerUseNaturalFormat": true,
    "variableUseNaturalFormat": true,
    "pvtVersion": "1.5.1",
    "__sessionId": "a246a0cc-31f5-46c7-8c54-2a28c5ee96c1"
}

Terminal output

[2022-06-04T22:59:10.300Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Program Files (x86)\\stlink\\stlink-1.7.0-x86_64-w64-mingw32\\bin\\st-util.exe" -p 50000 --no-reset
st-util
2022-06-05T00:59:10 INFO common.c: F0xx: 8 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
2022-06-05T00:59:10 INFO gdb-server.c: Listening at *:50000...
[2022-06-04T22:59:12.768Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

Debug console

Click to toggle contents of `Debug console`
Reading symbols from c:/program files (x86)\arm gnu toolchain arm-none-eabi\11.2 2022.02\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p C:/Users\user\Desktop\Nucleo-F030-test\build\Nucleo-F030-test.elf
Launching GDB: "C:\\Program Files (x86)\\Arm GNU Toolchain arm-none-eabi\\11.2 2022.02\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "C:/Users\\user\\Desktop\\Nucleo-F030-test\\build\\Nucleo-F030-test.elf"
1-gdb-version
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"cortex-debug","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"nl","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsHitConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsConditionalBreakpoints":true,"supportsLogPoints":true,"supportsFunctionBreakpoints":true,"supportsEvaluateForHovers":true,"supportsSetVariable":true,"supportsRestartRequest":true,"supportsGotoTargetsRequest":true,"supportSuspendDebuggee":true,"supportTerminateDebuggee":true,"supportsDataBreakpoints":true,"supportsDisassembleRequest":true,"supportsSteppingGranularity":true,"supportsInstructionBreakpoints":true,"supportsReadMemoryRequest":true}}
From client: launch({"name":"STlink debug launch","cwd":"C:\\Users\\user\\Desktop\\Nucleo-F030-test","executable":"C:/Users\\user\\Desktop\\Nucleo-F030-test\\build\\Nucleo-F030-test.elf","request":"launch","type":"cortex-debug","servertype":"stutil","device":"STM32F030R8","interface":"swd","runToEntryPoint":"main","preLaunchTask":"Compile using make","svdFile":"C:\\Users\\user\\Desktop\\Nucleo-F030-test/.vscode/STM32F0x0.svd","swoConfig":{"source":"probe","decoders":[]},"showDevDebugOutput":"vscode","__configurationTarget":5,"gdbServerConsolePort":55878,"pvtAvoidPorts":[],"chainedConfigurations":{"enabled":false},"debuggerArgs":[],"rttConfig":{"enabled":false,"decoders":[]},"graphConfig":[],"preLaunchCommands":[],"postLaunchCommands":[],"preAttachCommands":[],"postAttachCommands":[],"preRestartCommands":[],"postRestartCommands":[],"serverpath":"C:\\Program Files (x86)\\stlink\\stlink-1.7.0-x86_64-w64-mingw32\\bin\\st-util.exe","toolchainPath":"C:\\Program Files (x86)\\Arm GNU Toolchain arm-none-eabi\\11.2 2022.02\\bin","toolchainPrefix":"arm-none-eabi","gdbPath":"C:\\Program Files (x86)\\Arm GNU Toolchain arm-none-eabi\\11.2 2022.02\\bin\\arm-none-eabi-gdb.exe","objdumpPath":null,"extensionPath":"c:/Users/user/.vscode/extensions/marus25.cortex-debug-1.5.1","registerUseNaturalFormat":true,"variableUseNaturalFormat":true,"pvtVersion":"1.5.1","__sessionId":"a246a0cc-31f5-46c7-8c54-2a28c5ee96c1"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Cortex-Debug: VSCode debugger extension version 1.5.1 git(89a84bd). Usaage info: https://github.com/Marus/cortex-debug#usage"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"\"configuration\": {\n    \"name\": \"STlink debug launch\",\n    \"cwd\": \"C:\\\\Users\\\\user\\\\Desktop\\\\Nucleo-F030-test\",\n    \"executable\": \"C:/Users\\\\user\\\\Desktop\\\\Nucleo-F030-test\\\\build\\\\Nucleo-F030-test.elf\",\n    \"request\": \"launch\",\n    \"type\": \"cortex-debug\",\n    \"servertype\": \"stutil\",\n    \"device\": \"STM32F030R8\",\n    \"interface\": \"swd\",\n    \"runToEntryPoint\": \"main\",\n    \"preLaunchTask\": \"Compile using make\",\n    \"svdFile\": \"C:\\\\Users\\\\user\\\\Desktop\\\\Nucleo-F030-test/.vscode/STM32F0x0.svd\",\n    \"swoConfig\": {\n        \"source\": \"probe\",\n        \"decoders\": []\n    },\n    \"showDevDebugOutput\": \"raw\",\n    \"__configurationTarget\": 5,\n    \"gdbServerConsolePort\": 55878,\n    \"pvtAvoidPorts\": [],\n    \"chainedConfigurations\": {\n        \"enabled\": false\n    },\n    \"debuggerArgs\": [],\n    \"rttConfig\": {\n        \"enabled\": false,\n        \"decoders\": []\n    },\n    \"graphConfig\": [],\n    \"preLaunchCommands\": [],\n    \"postLaunchCommands\": [],\n    \"preAttachCommands\": [],\n    \"postAttachCommands\": [],\n    \"preRestartCommands\": [],\n    \"postRestartCommands\": [],\n    \"serverpath\": \"C:\\\\Program Files (x86)\\\\stlink\\\\stlink-1.7.0-x86_64-w64-mingw32\\\\bin\\\\st-util.exe\",\n    \"toolchainPath\": \"C:\\\\Program Files (x86)\\\\Arm GNU Toolchain arm-no[...]
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from C:\\Program Files (x86)\\Arm GNU Toolchain arm-none-eabi\\11.2 2022.02\\bin\\arm-none-eabi-objdump.exe --syms -C -h -w C:/Users\\user\\Desktop\\Nucleo-F030-test\\build\\Nucleo-F030-test.elf\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from c:/program files (x86)\\arm gnu toolchain arm-none-eabi\\11.2 2022.02\\bin\\arm-none-eabi-nm.exe --defined-only -S -l -C -p C:/Users\\user\\Desktop\\Nucleo-F030-test\\build\\Nucleo-F030-test.elf\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Launching GDB: \"C:\\\\Program Files (x86)\\\\Arm GNU Toolchain arm-none-eabi\\\\11.2 2022.02\\\\bin\\\\arm-none-eabi-gdb.exe\" -q --interpreter=mi2 \"C:/Users\\\\user\\\\Desktop\\\\Nucleo-F030-test\\\\build\\\\Nucleo-F030-test.elf\"\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"1-gdb-version\n"}}
To client: {"seq":0,"type":"event","event":"custom-event-ports-allocated","body":{"info":[50000]}}
To client: {"seq":0,"type":"event","event":"custom-event-ports-done","body":{}}
Launching gdb-server: "C:\\Program Files (x86)\\stlink\\stlink-1.7.0-x86_64-w64-mingw32\\bin\\st-util.exe" -p 50000 --no-reset
    Please check TERMINAL tab (gdb-server) for output from C:\Program Files (x86)\stlink\stlink-1.7.0-x86_64-w64-mingw32\bin\st-util.exe
Finished reading symbols from nm: Time: 151 ms
Finished reading symbols from objdump: Time: 159 ms
ST-Util: GDB Server Quit Unexpectedly. See gdb-server output for more details.
To client: {"seq":0,"type":"response","request_seq":2,"command":"launch","success":false,"message":"ST-Util: GDB Server Quit Unexpectedly. See gdb-server output for more details.","body":{"error":{"id":103,"format":"ST-Util: GDB Server Quit Unexpectedly. See gdb-server output for more details.","showUser":true}}}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13

github_iconTop GitHub Comments

2reactions
mildan99commented, Jun 5, 2022

Hello, I encountered the same issue, but it turned out that gdb in latest ARM Toolchain is busted. After replacing it with gdb binary from prev release everything working ok.

0reactions
BrentVerhaegencommented, Jun 5, 2022

Thanks @mildan99, that was indeed the issue! I had the (latest) GNU ARM Embedded Toolchain rev. 11.2 2022.02 installed. Now installed GNU ARM Embedded Toolchain rev. 10 2021.07 and everything is working as it should.

Thanks again to both @haneefdm and @mildan99 for your help 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenOCD: GDB Server Quit Unexpectedly. VSCode ... - GitHub
My main OS is Arch but I tried with Ubuntu and I had the same problem. This is the output when I try...
Read more >
ST-Util GDB Server Quit Unexpectedly. See ... - ST Community
Hi,. I'm want to do a step by step debug of the project "https://github.com/aws/amazon-freertos"/(varient), I have installed VM on windows ...
Read more >
OpenOCD GDB Server Quit Unexpectedly ... - Daisy Forums
Hi all, I am trying to write some code on the daisypod. I managed to wrangle the DSP effect “multieffect” examples and build...
Read more >
Problem understanding cortex-debug configurations in Visual ...
My GDB server would be OpenOCD and my client is the arm-none-eabi-gdb utility if I get this right from the debug console. I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found