This is an archive of the discontinued LLVM Phabricator instance.

Parse and dump PDB DBI Stream Header Information
ClosedPublic

Authored by zturner on Apr 25 2016, 3:03 PM.

Details

Summary

The DBI stream contains a lot of bookkeeping information for other streams. In particular it contains information about section contributions and linked modules. This patch is a first attempt at parsing some of the information out of the DBI stream. It currently only parses and dumps the headers of the DBI stream, so none of the module data or section contribution data is pulled out. This is just a proof of concept that we understand the basic properties of the DBI stream's metadata, and followup patches will try to extract more detailed information out.

Diff Detail

Event Timeline

zturner updated this revision to Diff 54917.Apr 25 2016, 3:03 PM
zturner retitled this revision from to Parse and dump PDB DBI Stream Header Information.
zturner updated this object.
zturner added reviewers: ruiu, rnk.
zturner added a subscriber: llvm-commits.
majnemer added inline comments.
lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
25–32

You are in an anonymous namespace, no need for static. Also, these don't seem to correspond to the LLVM naming style.

74

No need to stick this assertion in the constructor, I'd leave it with the type definition.

87–88

All signatures != -1 are ok?

115

This is a little confusing to read, why not just write return (Header->Flags & FLAG_INCREMENTAL_MASK) != 0;

zturner added inline comments.Apr 25 2016, 3:17 PM
lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
87–88

That's what Microsoft's dumper does, so I assume it's ok.

115

I mostly did it this way so that the code for converting to bool and non-bool looked the same, but I can change it.

Is there a defined naming convention for global constants? I see one for variables and enumerators, which I guess if I were being liberal I could apply to global constants as well, but I didn't see a clear rule for how to name global constants.

Is there a defined naming convention for global constants? I see one for variables and enumerators, which I guess if I were being liberal I could apply to global constants as well, but I didn't see a clear rule for how to name global constants.

The normal variable name rule applies.

zturner updated this revision to Diff 54935.Apr 25 2016, 3:50 PM
ruiu added inline comments.Apr 25 2016, 5:03 PM
lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
1

You can remove *- C== -* since this file has .cpp file extension.

44

Do you want to add using namespace llvm::support?

68

Can you write this outside of the constructor?

zturner added inline comments.Apr 25 2016, 5:43 PM
lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
68

The class is forward declared as private in PDBDbiStream.h, so it's inaccessible outside the constructor. I could declare it in the public section of the class, but it seemed more appropriate to be private. I don't feel strongly either way, so let me know if you do.

majnemer added inline comments.Apr 25 2016, 11:40 PM
lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
68

I don't think you need to stick it in the public section of the class, the static_assert could just follow immediately after the definition of HeaderInfo.

But it's forward declared as a private nested class, so you can't reference
the inner class except from within the outer class

ruiu accepted this revision.Apr 26 2016, 11:46 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 26 2016, 11:46 AM
Eugene.Zelenko added a subscriber: Eugene.Zelenko.

Committed in r267585.