Open
Description
Environment
- OS and version: Windows 11
- VS Code: 1.100.2
- C/C++ extension: [email protected]
- OS and version of remote machine (if applicable):
- GDB / LLDB version: GNU gdb (GDB) 16.2
Bug Summary and Steps to Reproduce
Bug Summary:
The program launched by debugger seems not able to use wsl.
Same as #13110, manually executing the program in the same/other integrated terminal works, external works.
Access is denied.
Error code: Wsl/Service/E_ACCESSDENIED
Steps to reproduce:
- Open a folder
- Create code:
- F5 choose detected task "C/C++: g++.exe build active file", auto-generated a tasks.json under ./.vscode
- Open redirected outputs
Code:
#include <bits/stdc++.h>
using namespace std;
void closePipe(FILE *pipe)
{
if (pipe)
{
pclose(pipe);
}
}
int main(int argc, char *args[])
{
auto pipe = popen("wsl --shell-type none -- ls . 1>pipe1 2>&1", "r");
closePipe(pipe);
auto pipe2 = popen("wsl --shell-type none -- ls . 1>pipe2 2>&1", "r");
closePipe(pipe2);
auto pipe3 = popen("dir . 1>pipe3 2>&1", "r");
closePipe(pipe3);
return 0;
}
Debugger Configurations
tasks.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "D:\\Build_Tool_Lib\\x86_64-15.1.0-release-win32-seh-msvcrt-rt_v12-rev0\\mingw64\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}",
"externalConsole": false,
"cwd": "${fileDirname}",
"MIMode": "gdb",
"miDebuggerPath": "D:\\Build_Tool_Lib\\x86_64-15.1.0-release-win32-seh-msvcrt-rt_v12-rev0\\mingw64\\bin\\gdb.exe",
"logging": {
"engineLogging": true,
"trace": true,
"traceResponse": true
}
}
]
}
Debugger Logs
C/C++ outputs:
Launch configuration:
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "C:\\Users\\rabbit\\Desktop\\CPPTools/Hello",
"externalConsole": false,
"cwd": "C:\\Users\\rabbit\\Desktop\\CPPTools",
"MIMode": "gdb",
"miDebuggerPath": "D:\\Build_Tool_Lib\\x86_64-15.1.0-release-win32-seh-msvcrt-rt_v12-rev0\\mingw64\\bin\\gdb.exe",
"logging": {
"engineLogging": true,
"trace": true,
"traceResponse": true
},
"__configurationTarget": 6
}
Other Extensions
No response
Additional Information
No response