summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
index df47ced8cd6..05b3dc7fc31 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFile.cpp
@@ -11,6 +11,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
+#include "llvm/DebugInfo/PDB/Raw/TpiStream.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -119,6 +120,8 @@ StringRef PDBFile::getBlockData(uint32_t BlockIndex, uint32_t NumBytes) const {
std::error_code PDBFile::parseFileHeaders() {
std::error_code EC;
MemoryBufferRef BufferRef = *Context->Buffer;
+ // Make sure the file is sufficiently large to hold a super block.
+ // Do this before attempting to read the super block.
if (BufferRef.getBufferSize() < sizeof(SuperBlock))
return std::make_error_code(std::errc::illegal_byte_sequence);
@@ -135,10 +138,6 @@ std::error_code PDBFile::parseFileHeaders() {
if (BufferRef.getBufferSize() % SB->BlockSize != 0)
return std::make_error_code(std::errc::illegal_byte_sequence);
- // Make sure the file is sufficiently large to hold a super block.
- if (BufferRef.getBufferSize() < sizeof(SuperBlock))
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
// Check the magic bytes.
if (memcmp(SB->MagicBytes, Magic, sizeof(Magic)) != 0)
return std::make_error_code(std::errc::illegal_byte_sequence);
@@ -271,3 +270,11 @@ DbiStream &PDBFile::getPDBDbiStream() {
}
return *Dbi;
}
+
+TpiStream &PDBFile::getPDBTpiStream() {
+ if (!Tpi) {
+ Tpi.reset(new TpiStream(*this));
+ Tpi->reload();
+ }
+ return *Tpi;
+}
OpenPOWER on IntegriCloud