diff options
author | Zachary Turner <zturner@google.com> | 2017-06-05 21:40:33 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-06-05 21:40:33 +0000 |
commit | 349c18f8377aa46af024e0ba7d312304ad2ac28a (patch) | |
tree | 1bbd719c419cb69fa87cd037de57ab206216741e /llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp | |
parent | 5b0bf2ff0d80998804871ab151ec2f00ff2dee8b (diff) | |
download | bcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.tar.gz bcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.zip |
[CodeView] Handle Cross Module Imports and Exports.
While it's not entirely clear why a compiler or linker might
put this information into an object or PDB file, one has been
spotted in the wild which was causing llvm-pdbdump to crash.
This patch adds support for reading-writing these sections.
Since I don't know how to get one of the native tools to
generate this kind of debug info, the only test here is one
in which we feed YAML into the tool to produce a PDB and
then spit out YAML from the resulting PDB and make sure that
it matches.
llvm-svn: 304738
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp b/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp index 58202577672..091ac67035d 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp @@ -105,10 +105,12 @@ Error PublicsStream::reload() { "Could not read a thunk map.")); // Something called "section map" follows. - if (auto EC = Reader.readArray(SectionOffsets, Header->NumSections)) - return joinErrors(std::move(EC), - make_error<RawError>(raw_error_code::corrupt_file, - "Could not read a section map.")); + if (Reader.bytesRemaining() > 0) { + if (auto EC = Reader.readArray(SectionOffsets, Header->NumSections)) + return joinErrors(std::move(EC), + make_error<RawError>(raw_error_code::corrupt_file, + "Could not read a section map.")); + } if (Reader.bytesRemaining() > 0) return make_error<RawError>(raw_error_code::corrupt_file, |