漂亮打印在 VS Code 中无法使用 GDB 进行 C++ 调试

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

我正在尝试在 Debian 配置下使用漂亮打印来调试 VS 代码中的 C++。

现在矢量显示如下:Vector display

我的

launch.json
文件是:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Lancer",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/examples/005_friction/mode_III_slip_weakening",
            "args": ["dumps", "100", "100"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/build/examples/005_friction/",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ] 
        }
    ],
}

我也尝试过添加

configurations

"gdb": {
          "prettyPrinting": true}

在这种情况下,我会收到错误“Property gdb is not allowed”。但我的电脑上安装了gdb。我还在 VS code 中安装了“C/C++”扩展。

最后,我尝试在调试控制台中输入

-exec -enable-pretty-printing
,但没有进一步成功。

我该怎么办?

visual-studio-code vscode-debugger pretty-print
1个回答
0
投票

我在 VSCode (debian env) 中遇到了同样的问题。跑步

apt-get install gdb
对我有用。它将安装一些额外的软件包,并在重新启动 VSCode 后问题得到解决。

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