Skip to content

When I add a folder to the workspace and try to debug, debugging doesn't work anymore #289917

@nanbiz

Description

@nanbiz

Type: Bug

When I open my project folder (with my .vscode folder is in it) directly, I can click on Debug and it will just work. My breakpoints are there and it starts debugging and I can also see the sources when I pause etc.

But as soon as I add a folder to the workspace, the preLaunchTask still works (so it moves the files etc, the gdbserver gets started) but all of my breakpoints are gone and I can't see the sources anymore:

Image

I can see that gdb uses absolute paths so why would VSCode be confused about the location of the sources?
Feel free to tell my some commands I can run in the gdb debug console if you need more info.

I have the folllowing configuration for crosscompiling, moving and debugging on a target:

launch.json

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "Remote Debug",
			"type": "cppdbg",
			"request": "launch",
			"program": "${workspaceFolder:app}/app_binary",
			"cwd": "${workspaceFolder:app}",
			"stopAtEntry": false,
			"MIMode": "gdb",
			"miDebuggerPath": "/usr/bin/gdb",
			"miDebuggerArgs": "-x ~/.config/gdb/gdbinit",
			"miDebuggerServerAddress": "embedded-device-001:2345",
			"externalConsole": false,
			"preLaunchTask": "launch-debug-server"
		}
	]
}

tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"label": "build-embedded",
			"type": "shell",
			"command": "source /opt/sdk/environment-setup-cortexa9-linux-gnueabi && make",
			"problemMatcher": ["$gcc"],
			"group": {
				"kind": "build",
				"isDefault": true
			}
		},
		{
			"label": "stop-remote-processes",
			"type": "shell",
			"command": "ssh",
			"args": [
				"-p",
				"22011",
				"root@embedded-device-001",
				"sh -c \"pkill app_binary; pkill gdbserver; rm -f /run/app_binary\" || true"
			],
			"dependsOn": ["build-embedded"]
		},
		{
			"label": "deploy-binary",
			"type": "shell",
			"command": "scp",
			"args": [
				"-P",
				"22011",
				"${workspaceFolder:app}/app_binary",
				"root@embedded-device-001:/run/app_binary"
			],
			"dependsOn": ["stop-remote-processes"]
		},
		{
			"label": "launch-debug-server",
			"type": "shell",
			"command": "ssh",
			"args": [
				"-p",
				"22011",
				"root@embedded-device-001",
				"gdbserver :2345 /run/app_binary"
			],
			"isBackground": true,
			"dependsOn": ["deploy-binary"],
			"problemMatcher": {
				"pattern": {
					"regexp": ".",
					"file": 1
				},
				"background": {
					"activeOnStart": true,
					"beginsPattern": "Process .* created",
					"endsPattern": "Listening on port"
				}
			}
		}
	]
}

c_cpp_properties.json

{
	"version": 4,
	"configurations": [
		{
			"name": "remote-arm",
			"compilerPath": "/opt/sdk/toolchain/bin/arm-linux-gnueabi-g++",
			"intelliSenseMode": "linux-gcc-arm",
			"cStandard": "c17",
			"cppStandard": "c++23",
			"includePath": [
				"${workspaceFolder}/**"
			]
		}
	]
}

VS Code version: Code 1.108.2 (c9d7799, 2026-01-21T13:52:09.270Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Connection to 'ssh-remote+mysshserver' could not be established
Remote OS version: Linux x64 4.18.0-553.64.1.el8_10.x86_64

System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 5 135U (14 x 2688)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.46GB (13.62GB free)
Process Argv --crash-reporter-id cf002c6b-3b50-4833-80f1-a0992f9f952a
Screen Reader no
VM 0%

Connection to 'ssh-remote+mysshserver' could not be established

Item Value
Remote SSH: mysshserver
OS Linux x64 4.18.0-553.64.1.el8_10.x86_64
CPUs Intel(R) Xeon(R) Gold 6244 CPU @ 3.60GHz (32 x 4268)
Memory (System) 251.05GB (199.68GB free)
VM 0%
Extensions (27)
Extension Author (truncated) Version
output-colorizer IBM 0.1.2
remote-ssh ms- 0.120.0
remote-ssh-edit ms- 0.87.0
remote-explorer ms- 0.5.0
material-icon-theme PKi 5.31.0
python-docstring-highlighter rod 0.2.4
errorlens use 3.26.0
copilot-chat Git 0.36.2
vscode-github-actions git 0.30.0
vscode-test-explorer hbe 2.22.1
vscode-sshfs Kel 1.26.1
vscode-clangd llv 0.4.0
vscode-catch2-test-adapter mat 4.21.0
git-graph mhu 1.30.0
debugpy ms- 2025.18.0
python ms- 2026.0.0
vscode-pylance ms- 2025.10.4
vscode-python-envs ms- 1.16.0
cmake-tools ms- 1.21.36
cpptools ms- 1.29.3
test-adapter-converter ms- 0.2.1
vscode-websearchforcopilot ms- 0.1.4
sftp Nat 1.16.3
chatgpt ope 0.4.62
vscode-cpptest Par 2025.2.1
vscode-lldb vad 1.12.1
uncrustify zac 3.2.0

(1 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31436602
aj953862:31281341
82j33506:31327384
6abeh943:31336334
cloudbuttont:31379625
3efgi100_wstrepl:31403338
use-responses-api:31390855
je187915:31407605
ec5jj548:31422691
cmp-ext-treat:31426748
cp_cls_c_966_ss:31446431
c0683394:31419495
ge8j1254_inline_auto_hint_haiku:31427726
nes-autoexp-10:31446583
a5gib710:31434435
38bie571_auto:31426784
rename_enabled:31436409
7a04d226_do_not_restore_last_panel_session:31438103
anthropic_thinking_t:31432745
h_21abi904:31446851
h0hdh950:31428394
cp_cls_c_1081:31443829
copilot-nes-callisto-trt:31434412
statuswidget:31449309
ia-no-proxy-models-svc:31450091
nes-slash-models-on:31441832
nes-set-to-on:31441941
a43f0574a:31442826
ts_provider_disabled:31446105
nes-conv-2-2:31447849

Metadata

Metadata

Labels

staleIssues that have not been triaged in an appropriate amount of timetriage-needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions