microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot debug C++ multiple times in a row

alexclifton4 opened this issue · comments

Environment

  • OS and version: Windows 11 Home 23H2
  • VS Code: 1.89.0
  • C/C++ extension: 1.19.9
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: GNU gdb (GDB) 7.6.1

Bug Summary and Steps to Reproduce

Bug Summary:
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.

Steps to reproduce:

  1. With the config below, press F5 to begin debugging
  2. This will work as expected, stop the program.
  3. Press F5 again to start debugging again, this will fail
  4. Observe in the cppdbg terminal the error 'No such file or directory' and that the command seems to be truncated

Debugger Configurations

launch.json:

{
    "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
                }
            ]
        }

    ]
}


### Debugger Logs

```shell
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
$

Other Extensions

No response

Additional Information

This may be related to PR 206632, where ^C is entered between debug sessions

Could you provide more details about your issue? I am unable to reproduce the bug.

  1. What is the file you are trying to debug? Does the issue persist if you update to the latest pre-release version of the extension?
  2. Could you provide the output of the C/C++: Log Diagnostics command when the issue happens?
  3. Could you provide a copy of the specific task.json file that you are using?