The IMAGE_FILE_HEADER structure contains a (RVA, size) to an array of
COFF_DEBUG_DIRECTORY records. Each one of these records contains an RVA to a
OMF Debug Directory. These OMF debug directories are derived into newer types
such as PDB70, PDB20, etc. This constructs a PDB70 structure which will allow
us to associate a GUID with a build to actually tie debug information.
Details
- Reviewers
ruiu
Diff Detail
- Repository
- rL LLVM
Event Timeline
This is obviously a very preliminary patch. I wanted to get some consensus on how to handle the GUID associated with the binary and an overall structure (whether to merge the content into a different file or keep it separate).
COFF/Debug.cpp | ||
---|---|---|
41 ↗ | (On Diff #67936) | Move. |
79 ↗ | (On Diff #67936) | chunks -> Chunks |
COFF/Debug.h | ||
21 ↗ | (On Diff #67936) | This class is a container of chunks, but only one element is currently added to this vector, so we don't actually need this class (you could add a member of type std::unique_ptr<CVDebugRecordChunk> to the Writer instead of this class.) Are you planning to do more complex thing with this class? If not, I'd remove this class. |
21–22 ↗ | (On Diff #67936) | Move this after all public members for consistency with other class declarations. |
COFF/Writer.cpp | ||
291 | I'd name this Rdata. |
COFF/Debug.h | ||
---|---|---|
21 ↗ | (On Diff #67936) | Well, it should add a coffgrp record by default unless CV is present. Furthermore, we should at some point emit the features record as well. Ideally, at some point, this would also integrate into the PDB handling to retrieve the GUID and Age so that rather than re-generating it on every build, we could just increment the age. I don't think that all of this will happen immediately, but is something that we will need, so I was tempted to create the class. I don't think that Im really tied to that idea and i you think going with the simpler route for now is better, I can merge this into the writer. |
Refactor the addition based on @ruiu's comments. This is still missing a test, but should be functional for stubbing out the section otherwise. We should still figure out the best way to generate the GUID for the RSDS record.
This adds a test as well. Right now the only thing which is missing is the GUID generation. Its unclear whether we want to use the random generation on each build (bad for reproducible builds) or hash the contents. Im not sure how to best do the latter. But, I think beyond that point, this is ready.
auto -> std::unique_ptr<Chunk>