Skip to content
/ cecil Public
forked from jbevain/cecil
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

Preserve original PDB path in Debug header #183

Closed
wants to merge 4 commits into from
Closed

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented May 31, 2024

When writing debug symbols, Cecil places them into a .pdb file adjacent to the .dll in the output. It also uses the path of this output .pdb as the path to the PDB in the .dll's CodeView Debug Directory entry, which breaks scenarios using PathMap.

This change fixes the PDB path in the CodeView Debug Directory entry to preserve the original path if it was present in the input .dll (but doesn't otherwise affect where Cecil looks for or writes out .pdb files).

Fixes dotnet/runtime#99594.

Copy link
Member

@jtschuster jtschuster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sbomer
Copy link
Member Author

sbomer commented Jun 6, 2024

@vitek-karas pointed out that when not using deterministic source paths, this would break because it would leave the output assembly pointing to the original pdb instead of the new pdb. So this will take more work (it may need to be conditioned on some new flag to control the behavior, or detect whether the compilation was done with deterministic source paths).

@sbomer
Copy link
Member Author

sbomer commented Jun 10, 2024

I found some more context that indicates the supported way to do this is via a custom symbol writer - so I'll close this and implement a solution in linker.

@sbomer sbomer closed this Jun 10, 2024
sbomer added a commit to dotnet/runtime that referenced this pull request Jun 17, 2024
This adds ILLink support for `--preserve-symbol-paths`, which is
set when `DeterministicSourcePaths` is true.  This setting will
preserve the original pdb path from the inputs by using a custom
symbol writer (see
dotnet/cecil#183 (comment)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not all built assemblies have deterministic source paths
2 participants