Open
Description
Environment
- OS and version: Ubuntu 24.04 LTS
- VS Code:
Version: 1.100.3
Commit: 258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3
Date: 2025-06-02T13:30:54.273Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.8.0-60-generic snap
- C/C++ extension: 1.25.3
- OS and version of remote machine (if applicable):
- GDB / LLDB version:
$ gdb --version
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Bug Summary and Steps to Reproduce
Bug Summary:
I am attempting to attach to a gdbserver instance from vscode. My process looks something like this:
- Start debugger which kicks off a task that launches a gdbserver instance. I am using
bazel run --run_under='gdbserver :14000
so it is not possible for me to have vscode launch gdbserver on a binary directly. - vscode will call
gdb -ex "target extended-remote :14000" -ex "info os processes" -batch
to get the remote processes - gdb will output a warning like
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
to stderr. This is not an error - the actual gdb invocation for debugging will have theset sysroot /
call. -
sees
len(stderr) !== 0
and considers the remote process query a failure.
As said above, this warning is okay. I'm not sure what the best way to fix this is.
Debugger Configurations
{
"version": "2.0.0",
"tasks": [
{
"label": "bazel-run-gdbserver",
"type": "shell",
"command": "bazel run -c dbg --run_under='gdbserver :14000' ${input:pickBazelTarget}",
"options": {
"cwd": "${workspaceFolder}"
},
"isBackground": true,
"problemMatcher": {
"background": {
"activeOnStart": true,
"beginsPattern": "^exec ${PAGER:-/usr/bin/less}.*",
"endsPattern": "^Listening on port.*",
},
"pattern": {
"regexp": "",
}
}
}
],
"inputs": [
{
"id": "pickBazelTarget",
"type": "command",
"command": "bazel.pickTarget",
"args": {
"query": "kind('cc_binary|cc_test', //...:*)",
"placeHolder": "Select Bazel target",
}
},
]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Bazel Target (Attach)",
"type": "cppdbg",
"request": "attach",
"program": "dummy_binary", // not important, we're not reading symbols from this anyway
"MIMode": "gdb",
"useExtendedRemote": true,
"miDebuggerServerAddress": ":14000",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Set local sysroot",
"text": "set sysroot /",
"ignoreFailures": true
},
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Enable break on all exceptions",
"text": "catch throw",
"ignoreFailures": true
},
{
"description": "Set search directory",
"text": "dir ${workspaceFolder}",
"ignoreFailures": true
},
{
"description": "bazel-out -> bazel/out",
"text": "set substitute-path bazel-out bazel/out",
"ignoreFailures": true
},
],
"preLaunchTask": "bazel-run-gdbserver",
}
]
}
Debugger Logs
N/A
Other Extensions
BazelBuild.vscode-bazel 0.11.0. Extension is used to help launch the helper task.
Additional Information
No response