diff options
author | Rui Ueyama <ruiu@google.com> | 2016-05-20 19:55:17 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-05-20 19:55:17 +0000 |
commit | 59427f6dc74f369a4c191b47c848ff329b600253 (patch) | |
tree | 4e7a1210a0ff0fa4082d8d0ec27810f8c92b170a /include | |
parent | 7192e937607a980d67697ef788483f3aa3240cab (diff) |
pdbdump: print out symbol names referred by publics stream.
DBI stream contains a stream number of the symbol record stream.
Symbol record streams is an array of length-type-value members.
Each member represents one symbol.
Publics stream contains offsets to the symbol record stream.
This patch is to print out all symbols that are referenced by
the publics stream.
Note that even with this patch, llvm-pdbdump cannot dump all the
information in a publics stream since it contains more information
than symbol names. I'll improve it in followup patches.
Differential Revision: http://reviews.llvm.org/D20480
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/DebugInfo/PDB/Raw/PDBFile.h | 3 | ||||
-rw-r--r-- | include/llvm/DebugInfo/PDB/Raw/PublicsStream.h | 11 | ||||
-rw-r--r-- | include/llvm/DebugInfo/PDB/Raw/SymbolStream.h | 39 |
3 files changed, 51 insertions, 2 deletions
diff --git a/include/llvm/DebugInfo/PDB/Raw/PDBFile.h b/include/llvm/DebugInfo/PDB/Raw/PDBFile.h index 26e27f7fcf4..45bec8596d5 100644 --- a/include/llvm/DebugInfo/PDB/Raw/PDBFile.h +++ b/include/llvm/DebugInfo/PDB/Raw/PDBFile.h @@ -25,6 +25,7 @@ struct PDBFileContext; class DbiStream; class InfoStream; class PublicsStream; +class SymbolStream; class TpiStream; class PDBFile { @@ -64,6 +65,7 @@ public: Expected<DbiStream &> getPDBDbiStream(); Expected<TpiStream &> getPDBTpiStream(); Expected<PublicsStream &> getPDBPublicsStream(); + Expected<SymbolStream &> getPDBSymbolStream(); private: std::unique_ptr<PDBFileContext> Context; @@ -71,6 +73,7 @@ private: std::unique_ptr<DbiStream> Dbi; std::unique_ptr<TpiStream> Tpi; std::unique_ptr<PublicsStream> Publics; + std::unique_ptr<SymbolStream> Symbols; }; } } diff --git a/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h b/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h index 522a32fdb53..7f9522e4465 100644 --- a/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h +++ b/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h @@ -20,12 +20,13 @@ namespace llvm { namespace pdb { +class DbiStream; class PDBFile; class PublicsStream { - struct HeaderInfo; struct GSIHashHeader; - struct HRFile; + struct HashRecord; + struct HeaderInfo; public: PublicsStream(PDBFile &File, uint32_t StreamNum); @@ -36,15 +37,21 @@ public: uint32_t getSymHash() const; uint32_t getAddrMap() const; uint32_t getNumBuckets() const { return NumBuckets; } + std::vector<std::string> getSymbols() const; ArrayRef<uint32_t> getHashBuckets() const { return HashBuckets; } ArrayRef<uint32_t> getAddressMap() const { return AddressMap; } ArrayRef<uint32_t> getThunkMap() const { return ThunkMap; } ArrayRef<uint32_t> getSectionOffsets() const { return SectionOffsets; } private: + Error readSymbols(); + + PDBFile &Pdb; + uint32_t StreamNum; MappedBlockStream Stream; uint32_t NumBuckets = 0; + std::vector<HashRecord> HashRecords; std::vector<uint32_t> HashBuckets; std::vector<uint32_t> AddressMap; std::vector<uint32_t> ThunkMap; diff --git a/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h b/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h new file mode 100644 index 00000000000..cffc92674d8 --- /dev/null +++ b/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h @@ -0,0 +1,39 @@ +//===- SymbolStream.cpp - PDB Symbol Stream Access --------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBSYMBOLSTREAM_H +#define LLVM_DEBUGINFO_PDB_RAW_PDBSYMBOLSTREAM_H + +#include "llvm/DebugInfo/CodeView/TypeStream.h" +#include "llvm/DebugInfo/PDB/PDBTypes.h" +#include "llvm/DebugInfo/PDB/Raw/ByteStream.h" +#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h" +#include "llvm/DebugInfo/PDB/Raw/RawConstants.h" + +#include "llvm/Support/Error.h" + +namespace llvm { +namespace pdb { +class PDBFile; + +class SymbolStream { +public: + SymbolStream(PDBFile &File, uint32_t StreamNum); + ~SymbolStream(); + Error reload(); + + Expected<std::string> getSymbolName(uint32_t Offset) const; + +private: + MappedBlockStream Stream; +}; +} +} + +#endif |