【问题标题】:Incorrect gdb configurations for vscode?vscode 的 gdb 配置不正确?
【发布时间】:2020-08-09 11:49:35
【问题描述】:

我有一些 c 文件,按如下方式组织:

└── src
    ├── app.out
    ├── Makefile
    ├── main.c
    ├── test.c
    └── test.h

当我使用make 构建文件时,文件编译得很好。 我在 VSCode 中开发并使用 C/C++ 调试器扩展。 但是,我无法让调试器正常工作。早些时候我遇到了一些调试器无法工作的问题,因为一些链接问题? (undefined_reference 问题)。 我对 launch.json 文件进行了更多试验来配置调试器,但我就是无法让它工作。现在调试器刚刚退出,并且不会在任何断点处停止。

This is my config:
{
    "configurations": [
    {
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/src/app.out",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}/src/",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    }
    ]
}

如何配置调试器使其正常工作,即保持 bp 并且没有任何链接问题?

【问题讨论】:

    标签: c debugging linker-errors vscode-debugger


    【解决方案1】:

    我解决了。我只是忘记在 Makefile 中使用-g 生成调试符号。

    【讨论】:

      猜你喜欢
      • 2018-02-02
      • 2021-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-12
      相关资源
      最近更新 更多