microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.45k stars 1.53k forks source link

Program sometimes freezes when quickly using the "Step over (F10)" button while debugging #12502

Open boasbakker opened 1 month ago

boasbakker commented 1 month ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: When debugging a C++ program in Visual Studio Code using the Run and Debug button, the program sometimes freezes when quickly using the "Step over (F10)" button. This happens more often on slower computers, and happens more often when clicking the button in quick succession, or when holding the F10 button.

Steps to reproduce:

  1. Create a C++ program made out of several lines of code, I used a main function with "int x = 0;" and then 128 lines of "x++;", but this happens with any program. Default compiler flags can be used.
  2. Set a breakpoint for the first line.
  3. Hold the F10 button.
  4. The program will sometimes freeze at soms point. On slower machines this will happen almost every time, on faster machines it it rare.

Schermopname van 24-07-24 19:38:12.webm

Debugger Configurations

Default configuration:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Launch.json (after testing with debugger logs)
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [],
    "logging": {
        "trace": true,
        "traceResponse": true,
        "engineLogging": true
    }
}

Debugger Logs

There is no output in the Debug Console when the program freezes after enabling the logging for the debugger adapter.

Other Extensions

Issue persists without any other extensions installed.

Additional Information

No response

sean-mcmanus commented 1 month ago

This might be a duplicate of https://github.com/microsoft/vscode-cpptools/issues/9988

boasbakker commented 1 month ago

This might be a duplicate of #9988

Probably not, since in this case I am only using 1 thread, and the step over function is very fast in most cases but sometimes it hangs indefinitely (as shown in the video), for longer than 3 minutes.

github-actions[bot] commented 3 weeks ago

Thank you for reporting this issue. We’ll let you know if we need more information to investigate it. Additionally, if you're working with GDB/LLDB, please note that the code is open source at https://github.com/microsoft/MIEngine/wiki/Contributing-Code . Your contributions are always welcome and appreciated.