Page MenuHomePhabricator

[ms] Add new /PDBSTREAM option to lld-link allowing injection of streams into PDB files.

Authored by epastor on Apr 2 2020, 7:49 AM.



/PDBSTREAM:<name>=<file> adds the contents of <file> to stream <name> in the resulting PDB.

This allows native uses with workflows that (for example) add srcsrv streams to PDB files to provide a location for the build's source files.

Results should be equivalent to linking with lld-link, then running Microsoft's pdbstr tool with the command line:
pdbstr.exe -w -p:<PDB LOCATION> -s:<name> -i:<file>
except in cases where the named stream overlaps with a default named stream, such as "/names". In those cases, the added stream will be overridden, making the /pdbstream option a no-op.

Diff Detail

Event Timeline

epastor created this revision.Apr 2 2020, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2020, 7:49 AM

Seems reasonable. Can you add a test?


Should this do anything if you try to overwrite an existing stream? (Like, error?)

epastor updated this revision to Diff 255375.Apr 6 2020, 9:18 AM
epastor marked 2 inline comments as done.

Add test


I've mimicked other command line flags; the last one with the same name will take precedence.

thakis accepted this revision.Apr 6 2020, 1:25 PM
thakis added inline comments.

I mean, what if this conflicts with a "built-in" pdb named stream (natvis, or what have you)?

This revision is now accepted and ready to land.Apr 6 2020, 1:25 PM
epastor marked 2 inline comments as done.Apr 6 2020, 3:21 PM
epastor added inline comments.

Currently, the "built-in" named stream will win. I think that's probably an acceptable outcome.

epastor edited the summary of this revision. (Show Details)Apr 6 2020, 3:25 PM
This revision was automatically updated to reflect the committed changes.
epastor marked an inline comment as done.