This is an archive of the discontinued LLVM Phabricator instance.

Write the TPI stream from Yaml
ClosedPublic

Authored by zturner on Sep 7 2016, 2:26 PM.

Details

Summary

This implements writing of the TPI stream from Yaml. This actually implements a generic TPI Stream builder / writer that is not tied to Yaml, but Yaml is just the vehicle used here to do the testing since we don't have linker support for writing PDBs yet.

Getting this to work was a little nasty due to the interactions between the normally stateless Yaml mappings and the stateful TypeTableBuilder. Because of that, this depends on D24162 which adds the ability to pass some state between yaml mappings, although that patch has yet to be looked at.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner updated this revision to Diff 70600.Sep 7 2016, 2:26 PM
zturner retitled this revision from to Write the TPI stream from Yaml.
zturner updated this object.
zturner added reviewers: rnk, amccarth, ruiu.
zturner added a subscriber: llvm-commits.

Ping, anyone able to take a look?

rnk accepted this revision.Sep 9 2016, 9:27 AM
rnk edited edge metadata.

lgtm

include/llvm/DebugInfo/CodeView/FieldListSerializationVisitor.h
1 ↗(On Diff #70600)

Is this header actually used? It seems like this part is rolled into TypeSerializationVisitor.

include/llvm/DebugInfo/MSF/SequencedItemStream.h
28 ↗(On Diff #70600)

I guess I'm surprised that we're still having to build scaffolding like this. I kind of thought that we had all the stream-y sequence-y primitives in MSF that we needed at this point.

I don't have any real suggestions on how to improve this, just a general comment.

36 ↗(On Diff #70600)

typo

This revision is now accepted and ready to land.Sep 9 2016, 9:27 AM
zturner added inline comments.Sep 9 2016, 10:21 AM
include/llvm/DebugInfo/MSF/SequencedItemStream.h
28 ↗(On Diff #70600)

I think we do have everything we need for reading PDBs, but I guess when you're constructing these things in memory, the requirements change somewhat because you have to adapt the in-memory format -- where it's convenient to store stuff in standard data structures -- to the on-disk format rather than the other way around. All the stuff like FixedStreamArray etc are useful for going from the on-disk format to the in-memory format without a bunch of copying, but how do you go from vector of std::strings (for example) to a single buffer of null terminated strings? We don't have anything like that, which is kind of what this is supposed to solve.

Another solution would have been to allocate some buffer up front, then manually serialize each thing into it, but since we're trying to be conservative with memory usage since PDBs can be so large that's not a great idea, and plus it doesn't take advantage of any of the existing machinery for writing to streams.

This revision was automatically updated to reflect the committed changes.