microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
158.92k stars 27.79k forks source link

Cannot debug C++ multiple times in a row #212057

Closed alexclifton4 closed 1 week ago

alexclifton4 commented 1 week ago

Does this issue occur when all extensions are disabled?: Yes/No

I am able to debug my code successfully by pressing F5, but if I attempt to run it a second time, it will fail with No such file or directory in the terminal output.

This used to work as expected, but I've started experiencing this recently, so I'm wondering if it's related to this?

My launch.json is based on the sample provided, but for reference it is this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/test.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }

    ]
}

After attempting to run a second time, the terminal looks like this: Note how the second time, the start of the command seems to have been truncated

Alex@Alex_Asus MINGW64 ~/Documents/GameEngine/EngineTest
$  /usr/bin/env c:\\Users\\Alex\\.vscode\\extensions\\ms-vscode.cpptools-1.19.9-win32-x64\\debugAdapters\\bin\\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-c2axmb5z.gjq --stdout=Microsoft-MIEngine-Out-5qxnf0rp.y1x --stderr=Microsoft-MIEngine-Error-itnz0wk4.tmp --pid=Microsoft-MIEngine-Pid-iod3xchz.rmb --dbgExe=C:\\MinGW\\bin\\gdb.exe --interpreter=mi

Alex@Alex_Asus MINGW64 ~/Documents/GameEngine/EngineTest
$ ^C

Alex@Alex_Asus MINGW64 ~/Documents/GameEngine/EngineTest
$ \\ms-vscode.cpptools-1.19.9-win32-x64\\debugAdapters\\bin\\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-dob4gqtf.x31 --stdout=Microsoft-MIEngine-Out-r1qtapcf.vwn --stderr=Microsoft-MIEngine-Error-sysmwcem.542 --pid=Microsoft-MIEngine-Pid-s2l523nn.m1i --dbgExe=C:\\MinGW\\bin\\gdb.exe --interpreter=mi
bash: \ms-vscode.cpptools-1.19.9-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe: No such file or directory

Alex@Alex_Asus MINGW64 ~/Documents/GameEngine/EngineTest
$

Closing the integrated terminal and trying again works fine, but this is annoying.

VSCodeTriageBot commented 1 week ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.89.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

alexclifton4 commented 1 week ago

I've realised this is likely an issue with an extension, so I've also opened an issue here

alexclifton4 commented 1 week ago

Closing as the issue on cpptools has also been closed