mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[pdb] Don't crash on unknown debug subsections.
More and more unknown debug subsection kinds are being discovered so we should make it possible to dump these and display the bytes. llvm-svn: 305041
This commit is contained in:
parent
b3bb143c65
commit
6caecc8977
@ -120,7 +120,7 @@ Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V,
|
||||
DebugSubsectionState &State) {
|
||||
State.initialize(std::forward<T>(FragmentRange));
|
||||
|
||||
for (const auto &L : FragmentRange) {
|
||||
for (const DebugSubsectionRecord &L : FragmentRange) {
|
||||
if (auto EC = visitDebugSubsection(L, V, State))
|
||||
return EC;
|
||||
}
|
||||
|
@ -34,19 +34,6 @@ Error DebugSubsectionRecord::initialize(BinaryStreamRef Stream,
|
||||
|
||||
DebugSubsectionKind Kind =
|
||||
static_cast<DebugSubsectionKind>(uint32_t(Header->Kind));
|
||||
switch (Kind) {
|
||||
case DebugSubsectionKind::FileChecksums:
|
||||
case DebugSubsectionKind::Lines:
|
||||
case DebugSubsectionKind::InlineeLines:
|
||||
case DebugSubsectionKind::CrossScopeExports:
|
||||
case DebugSubsectionKind::CrossScopeImports:
|
||||
case DebugSubsectionKind::Symbols:
|
||||
case DebugSubsectionKind::StringTable:
|
||||
case DebugSubsectionKind::FrameData:
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Unexpected debug fragment kind!");
|
||||
}
|
||||
if (auto EC = Reader.readStreamRef(Info.Data, Header->Length))
|
||||
return EC;
|
||||
Info.Container = Container;
|
||||
|
@ -91,6 +91,18 @@ public:
|
||||
LazyRandomTypeCollection &IPI)
|
||||
: P(P), TPI(TPI), IPI(IPI) {}
|
||||
|
||||
Error visitUnknown(DebugUnknownSubsectionRef &Unknown) override {
|
||||
if (!opts::checkModuleSubsection(opts::ModuleSubsection::Unknown))
|
||||
return Error::success();
|
||||
DictScope DD(P, "Unknown");
|
||||
P.printHex("Kind", static_cast<uint32_t>(Unknown.kind()));
|
||||
ArrayRef<uint8_t> Data;
|
||||
BinaryStreamReader Reader(Unknown.getData());
|
||||
consumeError(Reader.readBytes(Data, Reader.bytesRemaining()));
|
||||
P.printBinaryBlock("Data", Data);
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error visitLines(DebugLinesSubsectionRef &Lines,
|
||||
const DebugSubsectionState &State) override {
|
||||
if (!opts::checkModuleSubsection(opts::ModuleSubsection::Lines))
|
||||
|
@ -442,6 +442,8 @@ cl::list<ModuleSubsection> DumpModuleSubsections(
|
||||
clEnumValN(ModuleSubsection::Symbols, "symbols",
|
||||
"Symbols (DEBUG_S_SYMBOLS subsection) (not typically "
|
||||
"present in PDB file)"),
|
||||
clEnumValN(ModuleSubsection::Unknown, "unknown",
|
||||
"Any subsection not covered by another option"),
|
||||
clEnumValN(ModuleSubsection::All, "all", "All known subsections")),
|
||||
cl::cat(FileOptions), cl::sub(RawSubcommand), cl::sub(PdbToYamlSubcommand));
|
||||
cl::opt<bool> DumpModuleSyms("module-syms", cl::desc("dump module symbols"),
|
||||
|
Loading…
Reference in New Issue
Block a user