[llvm-pdbutil] Dump raw bytes of module symbols and debug chunks.

llvm-svn: 306179
This commit is contained in:
Zachary Turner
2017-06-23 23:08:57 +00:00
parent 86c664f9d7
commit fa33282774
7 changed files with 245 additions and 15 deletions

View File

@@ -47,15 +47,19 @@ Error ModuleDebugStreamRef::reload() {
if (auto EC = Reader.readInteger(Signature))
return EC;
if (auto EC = Reader.readArray(SymbolsSubstream, SymbolSize - 4))
if (auto EC = Reader.readSubstream(SymbolsSubstream, SymbolSize - 4))
return EC;
if (auto EC = Reader.readSubstream(C11LinesSubstream, C11Size))
return EC;
if (auto EC = Reader.readSubstream(C13LinesSubstream, C13Size))
return EC;
if (auto EC = Reader.readStreamRef(C11LinesSubstream, C11Size))
return EC;
if (auto EC = Reader.readStreamRef(C13LinesSubstream, C13Size))
BinaryStreamReader SymbolReader(SymbolsSubstream.StreamData);
if (auto EC =
SymbolReader.readArray(SymbolArray, SymbolReader.bytesRemaining()))
return EC;
BinaryStreamReader SubsectionsReader(C13LinesSubstream);
BinaryStreamReader SubsectionsReader(C13LinesSubstream.StreamData);
if (auto EC = SubsectionsReader.readArray(Subsections,
SubsectionsReader.bytesRemaining()))
return EC;
@@ -63,7 +67,7 @@ Error ModuleDebugStreamRef::reload() {
uint32_t GlobalRefsSize;
if (auto EC = Reader.readInteger(GlobalRefsSize))
return EC;
if (auto EC = Reader.readStreamRef(GlobalRefsSubstream, GlobalRefsSize))
if (auto EC = Reader.readSubstream(GlobalRefsSubstream, GlobalRefsSize))
return EC;
if (Reader.bytesRemaining() > 0)
return make_error<RawError>(raw_error_code::corrupt_file,
@@ -72,9 +76,25 @@ Error ModuleDebugStreamRef::reload() {
return Error::success();
}
BinarySubstreamRef ModuleDebugStreamRef::getSymbolsSubstream() const {
return SymbolsSubstream;
}
BinarySubstreamRef ModuleDebugStreamRef::getC11LinesSubstream() const {
return C11LinesSubstream;
}
BinarySubstreamRef ModuleDebugStreamRef::getC13LinesSubstream() const {
return C13LinesSubstream;
}
BinarySubstreamRef ModuleDebugStreamRef::getGlobalRefsSubstream() const {
return GlobalRefsSubstream;
}
iterator_range<codeview::CVSymbolArray::Iterator>
ModuleDebugStreamRef::symbols(bool *HadError) const {
return make_range(SymbolsSubstream.begin(HadError), SymbolsSubstream.end());
return make_range(SymbolArray.begin(HadError), SymbolArray.end());
}
llvm::iterator_range<ModuleDebugStreamRef::DebugSubsectionIterator>
@@ -83,7 +103,7 @@ ModuleDebugStreamRef::subsections() const {
}
bool ModuleDebugStreamRef::hasDebugSubsections() const {
return C13LinesSubstream.getLength() > 0;
return !C13LinesSubstream.empty();
}
Error ModuleDebugStreamRef::commit() { return Error::success(); }