Fix a few small issues in llvm-pdbutil
Running "llvm-pdbutil dump -all" on linux (using the native PDB reader),
over a few PDBs pulled from the Microsoft public symbol store uncovered
a few small issues:
- stripped PDBs might not have the strings stream (/names)
- stripped PDBs might not have the "module info" stream
Differential Revision: https://reviews.llvm.org/D54006
llvm-svn: 346010
diff --git a/llvm/tools/llvm-pdbutil/InputFile.cpp b/llvm/tools/llvm-pdbutil/InputFile.cpp
index b201964..8eb116c 100644
--- a/llvm/tools/llvm-pdbutil/InputFile.cpp
+++ b/llvm/tools/llvm-pdbutil/InputFile.cpp
@@ -116,10 +116,6 @@
return formatUnknownEnum(Kind);
}
-static const DebugStringTableSubsectionRef &extractStringTable(PDBFile &File) {
- return cantFail(File.getStringTable()).getStringTable();
-}
-
template <typename... Args>
static void formatInternal(LinePrinter &Printer, bool Append, Args &&... args) {
if (Append)
@@ -168,8 +164,13 @@
// PDB always uses the same string table, but each module has its own
// checksums. So we only set the strings if they're not already set.
- if (!SC.hasStrings())
- SC.setStrings(extractStringTable(File->pdb()));
+ if (!SC.hasStrings()) {
+ auto StringTable = File->pdb().getStringTable();
+ if (StringTable)
+ SC.setStrings(StringTable->getStringTable());
+ else
+ consumeError(StringTable.takeError());
+ }
SC.resetChecksums();
auto MDS = getModuleDebugStream(File->pdb(), Name, Modi);