Home:ALL Converter>having trouble debugging a C file in vscode

having trouble debugging a C file in vscode

Ask Time:2019-12-18T23:55:10         Author:DarkLeader

Json Formatter

I have a C file that I'm trying to debug but fail. I'm using vscode on windows 10. The file is quite large so I don't want to copy it here.

This is how my launch.json file looks in the .vscode folder in the folder that I'm working in:

{
    // 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": [


        {
            "name": "gcc.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "gcc.exe build active file"
        }
    ]
}

This is how my tasks.json looks like in the same .vscode folder:

{
    "tasks": [
        {
            "type": "shell",
            "label": "gcc.exe build active file",
            "command": "C:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\MinGW\\bin"
            }
        }
    ],
    "version": "2.0.0"
}

when I press the "start debugging" button the screen freezes and the program stalls and then vscode crashes

Author:DarkLeader,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59395743/having-trouble-debugging-a-c-file-in-vscode
yy