Using an empty string for remap_path_prefix breaks debug info on macOS. Remapping to empty string causes paths to become relative paths, which is not supported in all situations for all binary info on all platforms (e.g. OSO stabs in debug info on macOS). For more background on exactly how this breaks debug info, see rust-lang/rust#132143.
Default value for construct_arguments, see:
Remapping of pwd here:
|
rustc_flags.add("--remap-path-prefix=${{pwd}}={}".format(remap_path_prefix)) |
This can be fixed in rules_rust by not using an empty string for remapping here, at least on macOS, or for all platforms.
In terms of prior art here...
rules_swift uses . for remapping instead:
https://github.com/bazelbuild/rules_swift/blob/321bf2611163f562884545cbb7b183988bb4f367/swift/internal/feature_names.bzl#L62-L65
https://github.com/bazelbuild/rules_swift/blob/321bf2611163f562884545cbb7b183988bb4f367/tools/worker/swift_runner.cc#L293-L297
rules_go does as well:
https://github.com/bazel-contrib/rules_go/blob/1172e60b3fdb3c1b1f6efc781eda9819533375ac/go/tools/builders/cgo2.go#L330-L333
Bazel appears to use /proc/self/cwd at times, but outside of linux you need to manually remap this when debugging, with e.g.
(lldb) settings set target.source-map /proc/self/cwd <...>
Not sure which of these approaches would be best, or who would be the best to consult on this, but I think moving to one of the above is a good path forward.
Using an empty string for remap_path_prefix breaks debug info on macOS. Remapping to empty string causes paths to become relative paths, which is not supported in all situations for all binary info on all platforms (e.g. OSO stabs in debug info on macOS). For more background on exactly how this breaks debug info, see rust-lang/rust#132143.
Default value for
construct_arguments, see:rules_rust/rust/private/rustc.bzl
Line 832 in 0cb272d
Remapping of
pwdhere:rules_rust/rust/private/rustc.bzl
Line 995 in 0cb272d
This can be fixed in
rules_rustby not using an empty string for remapping here, at least on macOS, or for all platforms.In terms of prior art here...
rules_swift uses
.for remapping instead:https://github.com/bazelbuild/rules_swift/blob/321bf2611163f562884545cbb7b183988bb4f367/swift/internal/feature_names.bzl#L62-L65
https://github.com/bazelbuild/rules_swift/blob/321bf2611163f562884545cbb7b183988bb4f367/tools/worker/swift_runner.cc#L293-L297
rules_go does as well:
https://github.com/bazel-contrib/rules_go/blob/1172e60b3fdb3c1b1f6efc781eda9819533375ac/go/tools/builders/cgo2.go#L330-L333
Bazel appears to use
/proc/self/cwdat times, but outside of linux you need to manually remap this when debugging, with e.g.Not sure which of these approaches would be best, or who would be the best to consult on this, but I think moving to one of the above is a good path forward.