microsoft / vscode-cpptools

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

My debugger isn't hitting any breakpoints, and my file is being compiled with the -g flag. #8834

Open sean-mcmanus opened 2 years ago

sean-mcmanus commented 2 years ago

My debugger isn't hitting any breakpoints, and my file is being compiled with the -g flag.

tasks.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe arquivo de build ativo",
            "command": "C:\\MinGW\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$g++"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Tarefa gerada pelo Depurador."
        }
    ],
    "version": "2.0.0"
}

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - Criar e depurar o arquivo ativo",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "C:/MinGW/bin",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Habilitar a reformatação automática para gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Definir Tipo de Desmontagem como Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe arquivo de build ativo"
        }
    ]
}

The build is finished successfully, and then this is executed in the integrated terminal: image but I can't type anything.

I would really appreciate any help on this, It's so frustrating being unable to properly debug my C++ programs...

Originally posted by @gabrielbergoc in https://github.com/microsoft/vscode-cpptools/issues/6128#issuecomment-1033807992

sean-mcmanus commented 2 years ago

What version of VS Code and the C/C++ extension are you using?

elahehrashedi commented 2 years ago

@gabrielbergoc please change your problem matcher from g++ to gcc. Your build task is working (i.e. build is completed) but when launching, this is causing a problem.