I'm trying to run the debugger in VSCode using Bazel on a C++ application on MacOS 11. When I try to run this, I get the error message : "Could not load source 'testcpp.cc': 'SourceRequest' not supported". I'm not sure what I need to do to resolve this...it compiles and debugs properly on the command line. Here is my BUILD file:
package(
default_visibility = ["//visibility:public"],
)
cc_binary(
name="testcpp",
srcs=["testcpp.cc"],
)
Here is my .vscode/tasks.json file:
{
"version": "2.0.0",
"tasks": [
{
"label": "test dummy app",
"type": "shell",
"command": "bazel build -c dbg --strip=never --spawn_strategy=standalone :testcpp"
},
]
}
And here is my .vscode/launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"preLaunchTask": "test dummy app",
"request": "launch",
"program": "${workspaceFolder}/bazel-bin/testcpp",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
}
]
}
Any help would be appreciated. Thanks!
I have the same problem and the only thing I could find was on this GitHub issue: https://github.com/microsoft/vscode-cpptools/issues/3831
I wasn't able to fix mine that way (maybe because I'm using lldb instead of gdb) but it seems like you should change the current working directory to the executable's and then add the appropriate source file map as written in the last post of the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With