You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't get debugging in VS code when I build with Bazel. Does anyone have succeeded with this? Here is what I've tried with my executable Foo. If you have something working, it would be very appreciated if you could share how this is done.
I've created a task.js-file and a launch.js-file. I build with the specified command. The flag --compilation_mode=dbg generates .pdb-files as expected. The preLaunchTask in VS Code builds it and the program is executed. I've tried to both launch the generated Foo.exe_0.exe and the dotent.exe with Foo.exe as an argument. It starts and runs well. But it does not stop at the breakpoints.
I have tried to play around with sourceFileMap, but with no success. Is it anything wrong with my set up or is it not (yet) possible? The workaround is to build with .csproj-files with Visual Studio, then it is working, but then there is no point with Bazel really. Anyone who have any hints how to make it work?
I also ran into a similar issue.
For me using the "--sandbox_debug" flag allowed me to debug as expected. Not sure if it will solve your use case.
See #281
I don't get debugging in VS code when I build with Bazel. Does anyone have succeeded with this? Here is what I've tried with my executable Foo. If you have something working, it would be very appreciated if you could share how this is done.
I've created a task.js-file and a launch.js-file. I build with the specified command. The flag --compilation_mode=dbg generates .pdb-files as expected. The preLaunchTask in VS Code builds it and the program is executed. I've tried to both launch the generated Foo.exe_0.exe and the dotent.exe with Foo.exe as an argument. It starts and runs well. But it does not stop at the breakpoints.
I have tried to play around with sourceFileMap, but with no success. Is it anything wrong with my set up or is it not (yet) possible? The workaround is to build with .csproj-files with Visual Studio, then it is working, but then there is no point with Bazel really. Anyone who have any hints how to make it work?
task.js-file:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "./../bazelw build ///Foo/... --config=msvc64 --config=remotecache_download --compilation_mode=dbg,
"type": "shell",
"group": "build",
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
},
{
"label": "clean",
"command": "./../bazelw clean --expunge",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
},
{
"label": "run tests",
"command": "./../bazelw test ///Foo/... --config=msvc64 --config=remotecache_download --test_output=all",
"dependsOn": "build",
"type": "shell",
"group": "test",
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
}
]
}
launch.js-file:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attempt 1",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "PathOrRelativePathToParentRepo\bazel-bin\Foo\Foo.exe\Foo.exe_0.exe",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
},
{
"name": "Attempt 2",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "PathOrRelativePathToParentRepo\bazel-bin\Foo\Foo.exe\dotnet.exe",
"args": [
"PathOrRelativePathToParentRepo\bazel-bin\Foo\Foo.exe\Foo.exe"
],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"sourceFileMap":
{
"C:\build\4hga4mmj\execroot\RepoName": "PathOrRelativePathToParentRepo"
}
},
{
"name": "Built with Visual Studio - works fine - stops at breakpoints",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "PathOrRelativePathToParentRepo\Foo\bin\Debug\netcoreapp3.1\Foo.exe",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
The text was updated successfully, but these errors were encountered: