-
Hello,I have a cpp project and build with bazel,when I set breakpoint ,the point turns grey immediately;but I can use command lldb to debug my bazel build binary and set breakpoint correctly.
My bazel build command is "bazel build --repo_env=CC=clang --copt="-g" --strip=never -c dbg --sandbox_debug //source:main"
Any help will be appreciate. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 6 replies
-
Bazel replaces the actual source location with "/proc/self/cwd" in order to achieve repeatable builds. Edit: |
Beta Was this translation helpful? Give feedback.
-
@vadimcn I have similar troubles with Bazel. But this solution doesn't help. Even adding {"stopAtEntry": true} doesn't pause the execution on start. I'm trying to run one of the UnitTests and it have very strange path to the executable. Could it be trouble with path or should stopAtEntry be hit even with wrong paths inside "sourceMap"? |
Beta Was this translation helpful? Give feedback.
-
I had to do: |
Beta Was this translation helpful? Give feedback.
-
On macOS, in addition to the |
Beta Was this translation helpful? Give feedback.
-
The following works for both {
"version": "0.2.0",
"configurations": [
{
"type": "cppdbg",
"request": "launch",
"name": "Launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bazel-bin/main",
"args": [],
"sourceFileMap": {
"proc/self/cwd": "{workspaceFolder}",
".": "${workspaceFolder}"
}
},
{
"type": "lldb",
"request": "launch",
"name": "Launch LLDB",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bazel-bin/main",
"args": [],
"sourceMap": {
"proc/self/cwd": "{workspaceFolder}",
".": "${workspaceFolder}"
}
}
]
} |
Beta Was this translation helpful? Give feedback.
Bazel replaces the actual source location with "/proc/self/cwd" in order to achieve repeatable builds.
You'll need to add
"sourceMap": { "/proc/self/cwd": "${workspaceFolder}" }
to your launch configuration.Edit:
"sourceMap": { ".": "${workspaceFolder}" }
on OSX and Windows.