VS Code 中没有连接到 Gdb 调试器(错误)

问题描述 投票:0回答:1

问题是 VS Code 不允许我编译的程序在终端中显示输出,并显示“没有连接到 gdb 调试器”。 我使用vs code有一段时间了,这是第一次发生这种情况。 程序构建成功,但调试器不起作用。

我使用 VS Code 一段时间了,这是第一次发生这种情况。我没有做任何可能导致此类问题的事情,我对此感到非常困惑。

enter image description here

这是我的 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": "E:/my64/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"
}

这是我的task.json 文件

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

(我知道这里存在这些问题,但他们的解决方案并没有被证明是有益的,所以我需要直接帮助。)

c++ gdb vscode-debugger
1个回答
0
投票

嗯,所以我重新安装了 C++ 的调试器扩展,现在看起来工作正常。问题可能出在扩展中。它只是由于某些我不知道的原因而崩溃了。

© www.soinside.com 2019 - 2024. All rights reserved.