This is an archive of the discontinued LLVM Phabricator instance.

[PDB] Merge in types and items from type servers (/Zi)
ClosedPublic

Authored by rnk on Jul 17 2017, 1:57 PM.

Details

Summary

Object files compiled with /Zi emit type information into a type server
PDB. The .debug$S section will contain a single TypeServer2Record with
the absolute path and GUID of the type server. LLD needs to load the
type server PDB and merge all types and items it finds in it into the
destination PDB.

Depends on D35495

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Jul 17 2017, 1:57 PM
ruiu added inline comments.Jul 17 2017, 3:09 PM
lld/COFF/PDB.cpp
125 ↗(On Diff #106942)

Do you need an ordered map?

176 ↗(On Diff #106942)

Reverse the condition for early break.

223–226 ↗(On Diff #106942)

Is this correct that you are calling getPDBInfoStream only to check the existence of an Info stream?

230–238 ↗(On Diff #106942)

Can you remove this code for now?

rnk marked an inline comment as done.Jul 17 2017, 3:23 PM
rnk added inline comments.
lld/COFF/PDB.cpp
125 ↗(On Diff #106942)

I don't need ordering, but the keys and values are large (16 byte GUID + six pointers), so I want a container with a separate allocation. std::unordered_map is probably appropriate, but DenseMap is not.

223–226 ↗(On Diff #106942)

We need it for the Guid checking code below.

230–238 ↗(On Diff #106942)

Oh, the whole point of rebasing this on D35495 was to remove this check. We can check the GUIDs now that YAML serialization works.

rnk updated this revision to Diff 106966.Jul 17 2017, 3:25 PM
  • remove CheckGuids hack
ruiu added inline comments.Jul 17 2017, 3:40 PM
lld/COFF/PDB.cpp
175–177 ↗(On Diff #106966)

Is this possible that Types contain an LF_TYPESERVER2 and other types? If that is impossible, maybe this is more straightforward:

if (Types.empty() || Types[0].kind() == LF_TYPESERVER2)
  return None;

...
rnk updated this revision to Diff 106985.Jul 17 2017, 5:12 PM
  • rebase, remove for loop
rnk added inline comments.Jul 17 2017, 5:14 PM
lld/COFF/PDB.cpp
175–177 ↗(On Diff #106966)

The type array isn't a real collection, though. There's no .front(), no operator[], and begin() could equal end() if there was an error during deserialization even if empty() returns false.

I'll remove the for loop and use begin().

ruiu accepted this revision.Jul 17 2017, 5:15 PM

LGTM

This revision is now accepted and ready to land.Jul 17 2017, 5:15 PM
This revision was automatically updated to reflect the committed changes.