gpt4 book ai didi

visual-studio-code - 使用 Ubuntu 在 Visual Studio Code 中使用 Bazel 进行调试

转载 作者:行者123 更新时间:2023-12-04 14:19:17 25 4
gpt4 key购买 nike

我读了 this Bazel VS Code 教程。

目前,我在我的系统上复制教程时遇到问题。
我正在使用 Ubuntu 18.04 和 bazel 0.27.0 和 Visual Studio Code(版本 1.35.1)

我的文件:

任务.json:

{
"version": "2.0.0",
"tasks": [
{
"label": "Build Example (Debug)",
"type": "shell",
"command": "bazel build :example -c dbg",
"linux": {
"command": "bazel build :example -c dbg --spawn_strategy=standalone",
},
"group": {
"kind": "build",
"isDefault": true
},
}
]
}

我的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": "Example",
"type": "cppdbg",
"request": "launch",
"preLaunchTask": "Build Example (Debug)",
"program": "${workspaceFolder}/bazel-out/k8-dbg/bin/example",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/bazel-out/k8-dbg/bin/example.runfiles/__main__/",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"sourceFileMap": {
"/home/newton/.cache/bazel/_bazel_newton/7a12d285425fc99da0ce87e2a08f2f36/execroot/__main__/": "${workspaceFolder}"
}
}
]
}

以下截图左下角显示尝试开始调试时报错:“无法读取文件(错误:找不到文件...”

Error reported by VSCode

我正在寻找有关如何解决此问题并使其发挥作用的任何建议。

最佳答案

this .

这是我的配置:
tasks.json

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "bazel build --compilation_mode=dbg //...",
"group": {
"kind": "build",
"isDefault": true
},
}
]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "ExampleMihai",
"preLaunchTask": "build",
"type": "cppdbg",
"request": "launch",
"program": "/home/mihai/.cache/bazel/_bazel_mihai/89c1625b12241e64b746e0e58fdc7159/execroot/__main__/bazel-out/k8-dbg/bin/unit/test_static_string",
"args": [],
"stopAtEntry": false,
"cwd": "/home/mihai/git/containers",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
},
]
}

关于visual-studio-code - 使用 Ubuntu 在 Visual Studio Code 中使用 Bazel 进行调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56734812/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com