[llvm-pdbutil] Fix one more issue with no-id-stream PDBs.

This one occurred when we were dumping symbols, we have code
that is prepared to dump many different types of symbols,
including symbols which reference an ID stream.  So when creating
the dumper object, we assume that there is an ID stream.  Fix
this assumption.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305237 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zachary Turner 2017-06-12 21:57:41 +00:00
parent 3985d97184
commit 6848156130

View File

@ -89,7 +89,7 @@ struct PageStats {
class C13RawVisitor : public DebugSubsectionVisitor {
public:
C13RawVisitor(ScopedPrinter &P, LazyRandomTypeCollection &TPI,
LazyRandomTypeCollection &IPI)
LazyRandomTypeCollection *IPI)
: P(P), TPI(TPI), IPI(IPI) {}
Error visitUnknown(DebugUnknownSubsectionRef &Unknown) override {
@ -299,13 +299,18 @@ public:
private:
Error dumpTypeRecord(StringRef Label, TypeIndex Index) {
CompactTypeDumpVisitor CTDV(IPI, Index, &P);
DictScope D(P, Label);
if (IPI.contains(Index)) {
CVType Type = IPI.getType(Index);
if (auto EC = codeview::visitTypeRecord(Type, CTDV))
return EC;
} else {
bool Success = false;
if (IPI) {
CompactTypeDumpVisitor CTDV(*IPI, Index, &P);
DictScope D(P, Label);
if (IPI->contains(Index)) {
CVType Type = IPI->getType(Index);
if (auto EC = codeview::visitTypeRecord(Type, CTDV))
return EC;
}
}
if (!Success) {
P.printString(
llvm::formatv("Index: {0:x} (unknown function)", Index.getIndex())
.str());
@ -339,7 +344,7 @@ private:
ScopedPrinter &P;
LazyRandomTypeCollection &TPI;
LazyRandomTypeCollection &IPI;
LazyRandomTypeCollection *IPI;
};
}
@ -881,6 +886,8 @@ Error LLVMOutputStyle::dumpDbiStream() {
return Error::success();
}
ExitOnError Err("Error while processing DBI Stream");
auto DS = File.getPDBDbiStream();
if (!DS)
return DS.takeError();
@ -972,10 +979,10 @@ Error LLVMOutputStyle::dumpDbiStream() {
}
if (!opts::shared::DumpModuleSubsections.empty()) {
ListScope SS(P, "Subsections");
auto ExpectedIpi = initializeTypeDatabase(StreamIPI);
if (!ExpectedIpi)
return ExpectedIpi.takeError();
auto &Ipi = *ExpectedIpi;
auto &InfoS = Err(File.getPDBInfoStream());
LazyRandomTypeCollection *Ipi = nullptr;
if (InfoS.containsIdStream())
Ipi = &Err(initializeTypeDatabase(StreamIPI));
auto ExpectedStrings = File.getStringTable();
if (!ExpectedStrings)
return joinErrors(