-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug info is broken on macOS when using --remap-path-prefix #132143
Comments
This is just a guess, but I suspect the issue is to do with the fact that remapped paths become relative paths, whereas OSO paths seem to always be absolute. For example, if I use the rustc main.rs --codegen=debuginfo=2 --codegen=split-debuginfo=unpacked --codegen=link-args=-Wl,-oso_prefix,/Users/cameron/Desktop/broken > nm -pa main | rg OSO
0000000000000000 - 00 0001 OSO /main.main.4b21619d1e36c66a-cgu.0.rcgu.o
0000000000000000 - 00 0001 OSO /Users/cameron/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-0b4a354a5d882f18.rlib(std-0b4a354a5d882f18.std.d8d90c69e022292b-cgu.0.rcgu.o)
0000000000000000 - 00 0001 OSO /Users/cameron/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-00e89274fccf37d9.rlib(panic_unwind-00e89274fccf37d9.panic_unwind.ea3026af965941fa-cgu.0.rcgu.o)
0000000000000000 - 00 0001 OSO /Users/cameron/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-726032628236814d.rlib(memchr-726032628236814d.memchr.5ae0b6d692968ecf-cgu.0.rcgu.o)
0000000000000000 - 00 0001 OSO /Users/cameron/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-a7504b44dda8a2a3.rlib(alloc-a7504b44dda8a2a3.alloc.764fc8c78a1bb3e1-cgu.0.rcgu.o)
0000000000000000 - 00 0001 OSO /Users/cameron/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-a17e2a568e77fc15.rlib(core-a17e2a568e77fc15.core.fafc87a594706398-cgu.0.rcgu.o) |
After a little more investigation, I'm wondering if the fact that I will file feedback with Apple and hopefully |
The broken debuginfo is kinda expected? Without any |
In this case, I want the scope to include debuginfo. The The problem appears to be that when DW_AT_name is a relative path and DW_AT_comp_dir is absent, then the ld linker just throws out the OSO stab, instead of doing what I guess a workaround would be to use Another workaround would be to use something like It seems like either / both:
|
Have you managed to confirm that is true with Apple?
Yes that is possibly the cleverest way. IIRC debugger is not intended to work with full sanitization done by
cc @Urgau (summon you because I am forgetting stuff again…) |
This can be easily reproduced with a simple program.
Without --remap-path-prefix, building with unpacked debug info:
Results in a binary that has an OSO entry pointing to the object file containing the debug info:
With --remap-path-prefix:
Results in a binary that is missing OSO entries for the remapped object files:
Note how the first OSO entry from the first command is missing from the second:
I believe the same underlying issue prevents
--split-debuginfo=packed
from generating a dSYM containing debug info for the object files containing the remapped path prefix, as I believe dsymutil is just using the OSO entries to create a self contained set of DWARF debug info.Packed debug info without remapping:
Results in a complete dSYM:
Whereas the remapped version:
Does not:
All these issues are reproducible on a recent nightly (
rustc version 1.84.0-nightly (a93c1718c 2024-10-24)
).The text was updated successfully, but these errors were encountered: