[llvm-pdbdump] Stream 0 isn't actually the MSF superblock.

Oddly enough, I realized we don't actually know what stream
0 is (if anything).

llvm-svn: 270655
This commit is contained in:
Zachary Turner 2016-05-25 03:53:16 +00:00
parent 82dd8bae71
commit c59261ca37
3 changed files with 11 additions and 5 deletions

View File

@ -124,6 +124,7 @@ StringRef PDBFile::getBlockData(uint32_t BlockIndex, uint32_t NumBytes) const {
Error PDBFile::parseFileHeaders() {
std::error_code EC;
MemoryBufferRef BufferRef = *Context->Buffer;
// Make sure the file is sufficiently large to hold a super block.
// Do this before attempting to read the super block.
if (BufferRef.getBufferSize() < sizeof(SuperBlock))

View File

@ -18,7 +18,7 @@
; EMPTY-NEXT: NumStreams: 17
; EMPTY-NEXT: }
; EMPTY-NEXT: Streams [
; EMPTY-NEXT: Stream 0: [MSF Superblock] (40 bytes)
; EMPTY-NEXT: Stream 0: [???] (40 bytes)
; EMPTY-NEXT: Stream 1: [PDB Stream] (118 bytes)
; EMPTY-NEXT: Stream 2: [TPI Stream] (5392 bytes)
; EMPTY-NEXT: Stream 3: [DBI Stream] (739 bytes)

View File

@ -237,9 +237,7 @@ static Error dumpStreamSummary(ScopedPrinter &P, PDBFile &File) {
std::string Label("Stream ");
Label += to_string(StreamIdx);
std::string Value;
if (StreamIdx == 0)
Value = "MSF Superblock";
else if (StreamIdx == StreamPDB)
if (StreamIdx == StreamPDB)
Value = "PDB Stream";
else if (StreamIdx == StreamDBI)
Value = "DBI Stream";
@ -320,6 +318,8 @@ static Error dumpStreamData(ScopedPrinter &P, PDBFile &File) {
}
static Error dumpInfoStream(ScopedPrinter &P, PDBFile &File) {
if (!opts::DumpHeaders)
return Error::success();
auto InfoS = File.getPDBInfoStream();
if (auto EC = InfoS.takeError())
return EC;
@ -374,6 +374,11 @@ static Error dumpNamedStream(ScopedPrinter &P, PDBFile &File) {
static Error dumpDbiStream(ScopedPrinter &P, PDBFile &File,
codeview::CVTypeDumper &TD) {
bool DumpModules =
opts::DumpModules || opts::DumpModuleSyms || opts::DumpModuleFiles;
if (!opts::DumpHeaders && !DumpModules)
return Error::success();
auto DbiS = File.getPDBDbiStream();
if (auto EC = DbiS.takeError())
return EC;
@ -400,7 +405,7 @@ static Error dumpDbiStream(ScopedPrinter &P, PDBFile &File,
DllStream.flush();
P.printVersion(DllName, Major, Minor, DS.getPdbDllVersion());
if (opts::DumpModules || opts::DumpModuleSyms || opts::DumpModuleFiles) {
if (DumpModules) {
ListScope L(P, "Modules");
for (auto &Modi : DS.modules()) {
DictScope DD(P);