Skip to content
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

Easiest way to map document paths in portable [embedded] PDBs? #903

Open
safesparrow opened this issue Apr 7, 2023 · 0 comments
Open

Easiest way to map document paths in portable [embedded] PDBs? #903

safesparrow opened this issue Apr 7, 2023 · 0 comments

Comments

@safesparrow
Copy link

safesparrow commented Apr 7, 2023

Hi,

I'm trying to use Mono.Cecil to help implement a compilation cache: https://github.com/safesparrow/MSBuild.CompilerCache/

One of the problems with such a cache is that when reusing a dll from the cache that was previously compiled in a different location, its debug symbols contain absolute paths to the source files from that original compilation and will not be compatible with any other location.

I managed to use Mono.Cecil to rewrite all document URLs in all the methods found, to make the dll/pdb compatible (and it works).

However, I can see that roundtripping the whole module with Mono.Cecil has side effects, ie. a simple var m = ModuleDefinition.ReadModule(...); m.Write() does not yield an identical result.
I'm assuming that that is somewhat expected and hard to avoid.
(or maybe it isn't and I'm using the API wrong?)

Therefore I'm wondering if there is a less intrusive way to modify just the document URLs in the symbols of a module, that would guarantee that everything else stays untouched.
I'm sure this can be done by low-level modifications of the dll/pdb files - after all it's almost a "find & replace".
Is there a high-level API to achieve this though?

I'm interested in "portable" and "embedded [portable]" PDBs.

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

No branches or pull requests

1 participant