Skip to content

Extension hangs after disconnecting from external GDB server #1176

Description

@lmapii

I'm seeing a similar behavior as described in #635; the debug extension hangs after I'm trying to disconnect from an external GDB server.

Image

The exact steps that I'm performing are:

  • starting a GDB server with west gdbserver, which starts an STLink GDB server.
  • attach to the external server
  • click the "Restart" button
  • click the "Disconnect" button

With this, the debug extension still shows as active until I reload the vscode window. The external GDB server is stopped normally, debugging as such also works, and it doesn't seem to be a problem if I don't restart the target (then, the disconnect closes the debug session normally).

Expected behavior

After disconnecting, the session should be closed.

Environment (please complete the following information):

  • Cortex-Debug Version 1.12.1
  • OS: Linux 36f1283a19f2 6.12.54-linuxkit 1 SMP Tue Nov 4 21:21:47 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
  • GNU gdb (Zephyr SDK 0.17.4) 12.1
  • arm-zephyr-eabi-gcc (Zephyr SDK 0.17.4) 12.2.0
  • ST-LINK_gdbserver version: 7.12.0
{
  "configurations": [
    {
      "name": "Attach to [host.docker.internal] `west debugserver` for STM32U0",
      "cwd": "${workspaceFolder}",
      "executable": "${workspaceFolder}/deps/zephyr/samples/basic/blinky/build/zephyr/zephyr.elf",
      "request": "attach",
      "type": "cortex-debug",
      "runToEntryPoint": "main",
      "servertype": "external",
      "gdbTarget": "host.docker.internal:61234",
      "gdbPath": "/opt/toolchains/zephyr-sdk-0.17.4/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb",
      // https://github.com/Marus/cortex-debug/wiki/External-gdb-server-configuration
      "overrideResetCommands": ["monitor reset", "monitor halt"],
      "overrideRestartCommands": ["monitor reset", "monitor halt"]
    }
  ]
}

Attach text from Debug Console

This is the output from the debug console when clicking "Disconnect"

80-break-delete
-> 80^done
81-target-detach
-> =thread-exited,id="1",group-id="i1"
-> =thread-group-exited,id="i1"
-> ~"[Inferior 1 (Remote target) detached]\n"
[Inferior 1 (Remote target) detached]
-> 81^done
82-target-disconnect
-> 82^done
-gdb-exit
-> ^exit
GDB session ended. exit-code: 0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions