vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Cannot debug C++ multiple times in a row

Open alexclifton4 opened this issue 1 year ago • 2 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

alexclifton4 avatar May 06 '24 11:05 alexclifton4

Related on Stack Overflow: VS Code 1.89 Cannot debug C++ multiple times in a row

starball5 avatar May 06 '24 17:05 starball5

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?

browntarik avatar May 06 '24 17:05 browntarik

I'm still experiencing this and I replicated with a hello world program, but interestingly I did a fresh install on a Windows Server VM and I couldn't replicate it there.

  1. The issue still exists with a standard hello world program in C++. I don't see the option for a pre-release version, but the extension updated to 1.20.5 and I still have the issue
Version: 1.20.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Users/Alex/Documents/test/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
    "cStandard": "c11",
    "cppStandard": "gnu++14",
    "intelliSenseMode": "windows-gcc-x86",
    "compilerPathInCppPropertiesJson": "C:\\MinGW\\bin\\gcc.exe",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "c:/Users/Alex/Documents/test/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.20.5.0
Translation Unit Mappings:
[ C:\Users\Alex\Documents\test\main.cpp - source TU]:
Translation Unit Configurations:
[ C:\Users\Alex\Documents\test\main.cpp ]:
    Process ID: 14260
    Memory Usage: 91 MB
    Compiler Path: C:\MinGW\bin\gcc.exe
    Includes:
        C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++
        C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\mingw32
        C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\backward
        C:\MinGW\lib\gcc\mingw32\6.3.0\include
        C:\MinGW\include
        C:\MinGW\lib\gcc\mingw32\6.3.0\include-fixed
        C:\MinGW\mingw32\include
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c++14
    IntelliSense Mode: windows-gcc-x86
    Other Flags:
        --g++
        --gnu_version=60300
Total Memory Usage: 91 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 1236
  1. I compiled the program on the command line, so I don't have a task.json. For my actual project I have one, but the issue exists either way

alexclifton4 avatar May 08 '24 18:05 alexclifton4

I just uninstalled vs code, deleted my Code and .vscode folders, then re-installed it and it's working as expected now, so not sure what was going on.

alexclifton4 avatar May 09 '24 19:05 alexclifton4

It looks like resetting your environment fixed your issue so I will close this issue for now. If the issue comes back again and you have clear steps to reproduce, please reopen this issue.

browntarik avatar May 09 '24 19:05 browntarik

@browntarik

I would like to note that we have an entire team of developers with this issue. Our environment is Python-centered, and it happened at the same time for all of us with the April update. Wiping VSCode installation did NOT fix the issue.

Another note is that attempts at starting the debugger hang for a while, after which we get a popup: "Timed out waiting for launcher to connect".

CETrading avatar May 15 '24 09:05 CETrading

@CETrading @browntarik I ran into this and I beat my head against the wall. I am not a vscode user so i dont have a lot of insight to the workings. However, i installed 1.89.0 like @alexclifton4 has when i ran into this. I found older versions and started working backwards. 1.88.1 had this issue. 1.87.2 DID NOT have this issue. I went foward again to 1.88.1, and the issue returned. When I went back to 1.87.2 the issue resolved again.

got older versions from this location: https://code.visualstudio.com/updates/v1_88 https://code.visualstudio.com/updates/v1_87

Seems like a regression between 1.87.1 and 1.88.2 ?

LoyalServant avatar May 20 '24 06:05 LoyalServant

@browntarik should this be re-opened?

alexclifton4 avatar May 20 '24 07:05 alexclifton4

@CETrading @LoyalServant I would encourage you to open a separate issue here: https://github.com/microsoft/vscode-cpptools/issues/new?assignees=&labels=&projects=&template=1_language-service.yml

Please include as much information as possible so that I can reproduce it on my machine. This issue will stay closed as the original poster has resolved their issue.

browntarik avatar May 20 '24 17:05 browntarik

@alexclifton4 if you raise a new issue ticket, please ping me in it with "@starball5". I'm interested to follow along.

starball5 avatar May 20 '24 17:05 starball5