Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ private ImmutableList<String> getExtraDebugFlags(ExecutionEnvironment env) {
final var flagsBuilder = ImmutableList.<String>builder();

if (debuggerKind == BlazeDebuggerKind.BUNDLED_LLDB && !Registry.is("bazel.trim.absolute.path.disabled")) {
flagsBuilder.add("--copt=-fdebug-compilation-dir=" + WorkspaceRoot.fromProject(env.getProject()));
String workspaceRootPath = WorkspaceRoot.fromProject(env.getProject()).toString();
// Convert backslashes to forward slashes for Windows compatibility,
// particularly for tools like CMake invoked via rules_foreign_cc.
if (SystemInfo.isWindows) {
workspaceRootPath = workspaceRootPath.replace('\\', '/');
}
// Keep the single quotes around the whole copt value and double quotes around the path
// as Bazel might need them for correct parsing, especially if the path contains spaces.
flagsBuilder.add("--copt=-fdebug-compilation-dir='" + workspaceRootPath + "'");

if (SystemInfo.isMac) {
flagsBuilder.add("--linkopt=-Wl,-oso_prefix,.");
Expand Down