-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
bughelp wantedCan be fixed in the public (open source) repo.Can be fixed in the public (open source) repo.tasks/build/debugAn issue relating to tasks.json (e.g. build issues)An issue relating to tasks.json (e.g. build issues)
Description
Environment
- OS and version: Windows 11 22H2
- VS Code: 1.103.2
- C/C++ extension: 1.26.3
- GDB / LLDB version: 16.3
Bug Summary and Steps to Reproduce
Bug Summary:
After setting MSYS2 bash as the default terminal of VSCode, the command of compile and debug provided by C/C++ extension is still "cmd /c ${command}". However, in bash, "/c" is interpreted as a directory (A "c" directory in the root directory) instead of a parameter. It leads that the bash launch "cmd.exe /msys-root/c ${command}"
Steps to reproduce:
- Install MSYS2 on Windows
- Install ucrt64-binutils and ucrt64-gdb by pacman
- Set MSYS2 UCRT64 as the default terminal of VSCode
- Launch "Debug" (cppdbg) task
- See error...
The terminal will stop at "cmd.exe" in interactive mode, because "/c" parameter is interpreted as directory name by bash. The debug process failed for timeout.
A possible solution might be changing the command to "cmd //c ${command}" or just run "${command}", but I can't find anywhere to configure the command for compile and debug in C/C++ extension.
Debugger Configurations
tasks.json:
{
"type": "cppbuild",
"label": "mingw-debug",
"command": "g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
launch.json:
{
"name": "Debug",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"preLaunchTask": "mingw-debug"
}Debugger Logs
--> R (launch-2): {"type":"response","request_seq":2,"success":false,"command":"launch","message":"Unable to start debugging. Unable to establish a connection to GDB. Debug output may contain more information.","body":{"error":{"id":1005,"format":"Unable to start debugging. Unable to establish a connection to GDB. Debug output may contain more information."}},"seq":14}Other Extensions
No response
Additional Information

Metadata
Metadata
Assignees
Labels
bughelp wantedCan be fixed in the public (open source) repo.Can be fixed in the public (open source) repo.tasks/build/debugAn issue relating to tasks.json (e.g. build issues)An issue relating to tasks.json (e.g. build issues)