无法在 Ubuntu 16.04 上找到 printf.c

Unable find printf.c on Ubuntu 16.04

我最近切换到 Ubuntu 16.04。我在 Ubuntu 上使用 vscode 作为 IDE。我配置了其他语言,但我无法为 C/C++ 配置。我创建了 c_cpp_properties.json, launch.json & tasks.json。当我开始编译任何给定的代码时,当拟合函数像 printfmalloc 时它会给出错误。 错误信息:

Unable to open 'printf.c': File not found (file:///build/glibc-Cl5G7W/glibc-2.23/stdio-common/printf.c).

我该如何解决这个问题?

launch.json

{
// 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": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/test.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "build"
    }
]
}

tasks.json

{
"version": "2.0.0",
"tasks": [
    {
        "label": "build",
        "type": "shell",
        "command": "gcc",
        "args": [
            "-g",
            "pointer_revision.c",
            "-o",
            "test.exe"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]
}

c_cpp_properties.json

{
      "configurations": {
        "name": "Linux",
        "includePath": [
            "${workspaceFolder}",
            "/usr/include/x86_64-linux-gnu/5/include",
            "/usr/local/include",
            "/usr/include/x86_64-linux-gnu/5/include-fixed",
            "/usr/include/x86_64-linux-gnu",
            "/usr/include"
        ],
        "defines": [],
        "intelliSenseMode": "clang-x64",
        "browse": {
            "path": [
               "${workspaceFolder}",
                "/usr/include/x86_64-linux-gnu/5/include",
                "/usr/local/include",
                "/usr/include/x86_64-linux-gnu/5/include-fixed",
                "/usr/include/x86_64-linux-gnu",
                "/usr/include"
            ],
            "limitSymbolsToIncludedHeaders": true,
            "databaseFilename": ""
        },
        "compilerPath": "/usr/bin/gcc"
    }
}
不幸的是,

Debian 和 Ubuntu 没有将源代码作为调试包的一部分提供。据我所知,也没有计划将资源作为 dbgsym packages 的一部分发布。

相比之下,Fedora 及其下游发行版具有广泛的基础架构来准备可用的源文件以进行调试。这样做并非易事,因为它需要重写 DWARF 数据中的文件路径,从构建树位置到安装位置。但它对调试确实很有帮助,并为整个发行版提供了很好的自由软件风格。