summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/GSI.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-07-26 00:40:36 +0000
committerReid Kleckner <rnk@google.com>2017-07-26 00:40:36 +0000
commit14d90fd05cbed5fd3fcee492f072a4e5816f20b5 (patch)
tree53164d09de3887dbb7ef6d157766a9d9c801cc5d /llvm/lib/DebugInfo/PDB/Native/GSI.cpp
parentb4dbe7231e7eb1852248f6ed29fb57d9e9af06de (diff)
downloadbcm5719-llvm-14d90fd05cbed5fd3fcee492f072a4e5816f20b5.tar.gz
bcm5719-llvm-14d90fd05cbed5fd3fcee492f072a4e5816f20b5.zip
[PDB] Improve GSI hash table dumping for publics and globals
The PDB "symbol stream" actually contains symbol records for the publics and the globals stream. The globals and publics streams are essentially hash tables that point into a single stream of records. In order to match cvdump's behavior, we need to only dump symbol records referenced from the hash table. This patch implements that, and then implements global stream dumping, since it's just a subset of public stream dumping. Now we shouldn't see S_PROCREF or S_GDATA32 records when dumping publics, and instead we should see those record in the globals stream. llvm-svn: 309066
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/GSI.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/GSI.cpp93
1 files changed, 0 insertions, 93 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/GSI.cpp b/llvm/lib/DebugInfo/PDB/Native/GSI.cpp
deleted file mode 100644
index d77676dbd1c..00000000000
--- a/llvm/lib/DebugInfo/PDB/Native/GSI.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-//===- GSI.cpp - Common Functions for GlobalsStream and PublicsStream ----===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "GSI.h"
-
-#include "llvm/DebugInfo/PDB/Native/RawError.h"
-#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
-#include "llvm/Support/BinaryStreamArray.h"
-#include "llvm/Support/BinaryStreamReader.h"
-
-#include "llvm/Support/Error.h"
-
-namespace llvm {
-namespace pdb {
-
-static Error checkHashHdrVersion(const GSIHashHeader *HashHdr) {
- if (HashHdr->VerHdr != GSIHashHeader::HdrVersion)
- return make_error<RawError>(
- raw_error_code::feature_unsupported,
- "Encountered unsupported globals stream version.");
-
- return Error::success();
-}
-
-Error readGSIHashBuckets(FixedStreamArray<support::ulittle32_t> &HashBuckets,
- ArrayRef<uint8_t> &HashBitmap,
- const GSIHashHeader *HashHdr,
- BinaryStreamReader &Reader) {
- if (auto EC = checkHashHdrVersion(HashHdr))
- return EC;
-
- // Before the actual hash buckets, there is a bitmap of length determined by
- // IPHR_HASH.
- size_t BitmapSizeInBits = alignTo(IPHR_HASH + 1, 32);
- uint32_t NumBitmapEntries = BitmapSizeInBits / 8;
- if (auto EC = Reader.readBytes(HashBitmap, NumBitmapEntries))
- return joinErrors(std::move(EC),
- make_error<RawError>(raw_error_code::corrupt_file,
- "Could not read a bitmap."));
- uint32_t NumBuckets = 0;
- for (uint8_t B : HashBitmap)
- NumBuckets += countPopulation(B);
-
- // Hash buckets follow.
- if (auto EC = Reader.readArray(HashBuckets, NumBuckets))
- return joinErrors(std::move(EC),
- make_error<RawError>(raw_error_code::corrupt_file,
- "Hash buckets corrupted."));
-
- return Error::success();
-}
-
-Error readGSIHashHeader(const GSIHashHeader *&HashHdr,
- BinaryStreamReader &Reader) {
- if (Reader.readObject(HashHdr))
- return make_error<RawError>(raw_error_code::corrupt_file,
- "Stream does not contain a GSIHashHeader.");
-
- if (HashHdr->VerSignature != GSIHashHeader::HdrSignature)
- return make_error<RawError>(
- raw_error_code::feature_unsupported,
- "GSIHashHeader signature (0xffffffff) not found.");
-
- return Error::success();
-}
-
-Error readGSIHashRecords(FixedStreamArray<PSHashRecord> &HashRecords,
- const GSIHashHeader *HashHdr,
- BinaryStreamReader &Reader) {
- if (auto EC = checkHashHdrVersion(HashHdr))
- return EC;
-
- // HashHdr->HrSize specifies the number of bytes of PSHashRecords we have.
- // Verify that we can read them all.
- if (HashHdr->HrSize % sizeof(PSHashRecord))
- return make_error<RawError>(raw_error_code::corrupt_file,
- "Invalid HR array size.");
- uint32_t NumHashRecords = HashHdr->HrSize / sizeof(PSHashRecord);
- if (auto EC = Reader.readArray(HashRecords, NumHashRecords))
- return joinErrors(std::move(EC),
- make_error<RawError>(raw_error_code::corrupt_file,
- "Error reading hash records."));
-
- return Error::success();
-}
-}
-}
OpenPOWER on IntegriCloud