debug info: resolve relative paths to source files into absolute paths #13843
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change brings back
stage1behavior in that all debug info paths that are emitted in DWARF/PDB are always absolute. Note that the paths are resolved only when committing them into either a respective LLVM type (llvm.DIFile), or when emitting DWARF (as is the case with self-hosted backends).This change will make stack traces and debugging experience more consistent in the sense that the presence of source lines in stack traces will not be dependent on the current working directory of the running process, making cases like #13831 non-existent (I am referring here to lack of source lines in submitted stack trace, not the actual linker bug which is unrelated).
Additional bonus is that we no longer need to mess with
lld-links output on Windows by including special PDB path manipulating flag,-PDBSOURCEPATHas all source paths are now absolute by design.Finally, as generating valid debug info output is important but not critical, if a call to
std.os.realpathfails for whatever reason, we simply fallback to relative paths readily available.If we merge this, this patch will obsolete #13540
cc @Vexu