diff options
author | Zachary Turner <zturner@google.com> | 2017-06-08 23:49:01 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-06-08 23:49:01 +0000 |
commit | 1bf776204926ca9293d2269ee28c21f0543b7941 (patch) | |
tree | e254c189233bd68331667b426595ce8543c33742 /llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp | |
parent | 67aea737f3ee37fd0c39c3a59cef857dcabad231 (diff) | |
download | llvm-1bf776204926ca9293d2269ee28c21f0543b7941.zip llvm-1bf776204926ca9293d2269ee28c21f0543b7941.tar.gz llvm-1bf776204926ca9293d2269ee28c21f0543b7941.tar.bz2 |
[llvm-pdbdump] Support native ordering of subsections in raw mode.
This is the same change for the YAML Output style applied to the
raw output style. Previously we would queue up all subsections
until every one had been read, and then output them in a pre-
determined order. This was because some subsections need to be
read first in order to properly dump later subsections. This
patch allows them to be dumped in the order they appear.
Differential Revision: https://reviews.llvm.org/D34015
llvm-svn: 305034
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp b/llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp index 93fe4e1..ee769d3 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp @@ -14,6 +14,7 @@ #include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h" #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h" #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h" +#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h" #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h" #include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h" #include "llvm/Support/BinaryStreamReader.h" @@ -22,8 +23,40 @@ using namespace llvm; using namespace llvm::codeview; +DebugSubsectionState::DebugSubsectionState() {} + +DebugSubsectionState::DebugSubsectionState( + const DebugStringTableSubsectionRef &Strings) + : Strings(&Strings) {} + +DebugSubsectionState::DebugSubsectionState( + const DebugStringTableSubsectionRef &Strings, + const DebugChecksumsSubsectionRef &Checksums) + : Strings(&Strings), Checksums(&Checksums) {} + +void DebugSubsectionState::initializeStrings(const DebugSubsectionRecord &SR) { + assert(SR.kind() == DebugSubsectionKind::StringTable); + assert(!Strings && "Found a string table even though we already have one!"); + + OwnedStrings = llvm::make_unique<DebugStringTableSubsectionRef>(); + consumeError(OwnedStrings->initialize(SR.getRecordData())); + Strings = OwnedStrings.get(); +} + +void DebugSubsectionState::initializeChecksums( + const DebugSubsectionRecord &FCR) { + assert(FCR.kind() == DebugSubsectionKind::FileChecksums); + if (Checksums) + return; + + OwnedChecksums = llvm::make_unique<DebugChecksumsSubsectionRef>(); + consumeError(OwnedChecksums->initialize(FCR.getRecordData())); + Checksums = OwnedChecksums.get(); +} + Error llvm::codeview::visitDebugSubsection(const DebugSubsectionRecord &R, - DebugSubsectionVisitor &V) { + DebugSubsectionVisitor &V, + const DebugSubsectionState &State) { BinaryStreamReader Reader(R.getRecordData()); switch (R.kind()) { case DebugSubsectionKind::Lines: { @@ -31,32 +64,32 @@ Error llvm::codeview::visitDebugSubsection(const DebugSubsectionRecord &R, if (auto EC = Fragment.initialize(Reader)) return EC; - return V.visitLines(Fragment); + return V.visitLines(Fragment, State); } case DebugSubsectionKind::FileChecksums: { DebugChecksumsSubsectionRef Fragment; if (auto EC = Fragment.initialize(Reader)) return EC; - return V.visitFileChecksums(Fragment); + return V.visitFileChecksums(Fragment, State); } case DebugSubsectionKind::InlineeLines: { DebugInlineeLinesSubsectionRef Fragment; if (auto EC = Fragment.initialize(Reader)) return EC; - return V.visitInlineeLines(Fragment); + return V.visitInlineeLines(Fragment, State); } case DebugSubsectionKind::CrossScopeExports: { DebugCrossModuleExportsSubsectionRef Section; if (auto EC = Section.initialize(Reader)) return EC; - return V.visitCrossModuleExports(Section); + return V.visitCrossModuleExports(Section, State); } case DebugSubsectionKind::CrossScopeImports: { DebugCrossModuleImportsSubsectionRef Section; if (auto EC = Section.initialize(Reader)) return EC; - return V.visitCrossModuleImports(Section); + return V.visitCrossModuleImports(Section, State); } default: { DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData()); |