skip to Main Content

I’m using visual studio code (1.93.1) along with GDB debugger (15.1) and g++ compiler (14.2.0) on windows.
Whenever I use a breakpoint and try to click the step-over button, the debugger stops working, but doesn’t terminate (there’s a gif explaining what happens below)
for context here’s my tasks.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\msys64\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:

{
    "configurations": [
        {
            "name": "C/C++: g++.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:/msys64/mingw64/bin/gdb.exe",
            "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
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ],
    "version": "2.0.0"
}

gif

I’ve tried reinstalling the compiler and debugger multiple times with no success, everything in the debugger works except for this functionality.

2

Answers


  1. In my experience this can sometimes happen in the event of a Segfault. Is it possible that you are accessing freed memory or attempting to dereference some null value? I don’t have experience with VSCode debugging, but in other IDE’s I have had this happen frequently (using GDB ).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search