summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-05-24 18:55:14 +0000
committerZachary Turner <zturner@google.com>2016-05-24 18:55:14 +0000
commit653eb429f5042e80e68f2f5ebc8f963db76d322d (patch)
tree324f29d0f18adcf563113366c5bfd3673c9a9d90 /include
parent0f324db0db5d57cebe1b16701b8a6f4e1fc77562 (diff)
[codeview, pdb] Dump symbol records in publics streamHEADmaster
Differential Revision: http://reviews.llvm.org/D20580 Reviewed By: ruiu git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/DebugInfo/CodeView/CVSymbolTypes.def5
-rw-r--r--include/llvm/DebugInfo/CodeView/SymbolRecord.h58
-rw-r--r--include/llvm/DebugInfo/PDB/Raw/PublicsStream.h3
-rw-r--r--include/llvm/DebugInfo/PDB/Raw/SymbolStream.h9
4 files changed, 67 insertions, 8 deletions
diff --git a/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def b/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def
index d3ecca534e1..991644d102c 100644
--- a/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def
+++ b/include/llvm/DebugInfo/CodeView/CVSymbolTypes.def
@@ -130,7 +130,6 @@ CV_SYMBOL(S_THUNK32 , 0x1102)
CV_SYMBOL(S_WITH32 , 0x1104)
CV_SYMBOL(S_REGISTER , 0x1106)
CV_SYMBOL(S_MANYREG , 0x110a)
-CV_SYMBOL(S_PUB32 , 0x110e)
CV_SYMBOL(S_LPROCMIPS , 0x1114)
CV_SYMBOL(S_GPROCMIPS , 0x1115)
CV_SYMBOL(S_COMPILE2 , 0x1116)
@@ -148,7 +147,6 @@ CV_SYMBOL(S_MANMANYREG , 0x1121)
CV_SYMBOL(S_MANREGREL , 0x1122)
CV_SYMBOL(S_MANMANYREG2 , 0x1123)
CV_SYMBOL(S_UNAMESPACE , 0x1124)
-CV_SYMBOL(S_PROCREF , 0x1125)
CV_SYMBOL(S_DATAREF , 0x1126)
CV_SYMBOL(S_LPROCREF , 0x1127)
CV_SYMBOL(S_ANNOTATIONREF , 0x1128)
@@ -208,6 +206,9 @@ SYMBOL_RECORD_ALIAS(S_GPROC32_ID , 0x1147, GlobalProcIdSym, ProcSym)
SYMBOL_RECORD_ALIAS(S_LPROC32_DPC , 0x1155, DPCProcSym, ProcSym)
SYMBOL_RECORD_ALIAS(S_LPROC32_DPC_ID , 0x1156, DPCProcIdSym, ProcSym)
+SYMBOL_RECORD(S_PUB32 , 0x110e, PublicSym32)
+SYMBOL_RECORD(S_PROCREF , 0x1125, ProcRefSym)
+
SYMBOL_RECORD(S_INLINESITE , 0x114d, InlineSiteSym)
SYMBOL_RECORD(S_LOCAL , 0x113e, LocalSym)
SYMBOL_RECORD(S_DEFRANGE , 0x113f, DefRangeSym)
diff --git a/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/include/llvm/DebugInfo/CodeView/SymbolRecord.h
index 54d114c19b1..f0ff7335111 100644
--- a/include/llvm/DebugInfo/CodeView/SymbolRecord.h
+++ b/include/llvm/DebugInfo/CodeView/SymbolRecord.h
@@ -334,6 +334,64 @@ private:
ArrayRef<uint8_t> Annotations;
};
+// S_PUB32
+class PublicSym32 : public SymbolRecord {
+public:
+ struct Hdr {
+ ulittle32_t Index; // Type index, or Metadata token if a managed symbol
+ ulittle32_t Off;
+ ulittle16_t Seg;
+ // Name: The null-terminated name follows.
+ };
+
+ PublicSym32(uint32_t RecordOffset, const Hdr *H, StringRef Name)
+ : SymbolRecord(SymbolRecordKind::PublicSym32), RecordOffset(RecordOffset),
+ Header(*H), Name(Name) {}
+
+ static ErrorOr<PublicSym32> deserialize(SymbolRecordKind Kind,
+ uint32_t RecordOffset,
+ ArrayRef<uint8_t> &Data) {
+ const Hdr *H = nullptr;
+ StringRef Name;
+ CV_DESERIALIZE(Data, H, Name);
+
+ return PublicSym32(RecordOffset, H, Name);
+ }
+
+ uint32_t RecordOffset;
+ Hdr Header;
+ StringRef Name;
+};
+
+// S_PROCREF
+class ProcRefSym : public SymbolRecord {
+public:
+ struct Hdr {
+ ulittle32_t SumName; // SUC of the name (?)
+ ulittle32_t SymOffset; // Offset of actual symbol in $$Symbols
+ ulittle16_t Mod; // Module containing the actual symbol
+ // Name: The null-terminated name follows.
+ };
+
+ ProcRefSym(uint32_t RecordOffset, const Hdr *H, StringRef Name)
+ : SymbolRecord(SymbolRecordKind::ProcRefSym), RecordOffset(RecordOffset),
+ Header(*H), Name(Name) {}
+
+ static ErrorOr<ProcRefSym> deserialize(SymbolRecordKind Kind,
+ uint32_t RecordOffset,
+ ArrayRef<uint8_t> &Data) {
+ const Hdr *H = nullptr;
+ StringRef Name;
+ CV_DESERIALIZE(Data, H, Name);
+
+ return ProcRefSym(RecordOffset, H, Name);
+ }
+
+ uint32_t RecordOffset;
+ Hdr Header;
+ StringRef Name;
+};
+
// S_LOCAL
class LocalSym : public SymbolRecord {
public:
diff --git a/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h b/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h
index 7f9522e4465..088bcb4da31 100644
--- a/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h
+++ b/include/llvm/DebugInfo/PDB/Raw/PublicsStream.h
@@ -10,6 +10,7 @@
#ifndef LLVM_DEBUGINFO_PDB_RAW_PUBLICSSTREAM_H
#define LLVM_DEBUGINFO_PDB_RAW_PUBLICSSTREAM_H
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeStream.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/ByteStream.h"
@@ -37,7 +38,7 @@ public:
uint32_t getSymHash() const;
uint32_t getAddrMap() const;
uint32_t getNumBuckets() const { return NumBuckets; }
- std::vector<std::string> getSymbols() const;
+ iterator_range<codeview::SymbolIterator> getSymbols() const;
ArrayRef<uint32_t> getHashBuckets() const { return HashBuckets; }
ArrayRef<uint32_t> getAddressMap() const { return AddressMap; }
ArrayRef<uint32_t> getThunkMap() const { return ThunkMap; }
diff --git a/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h b/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h
index cffc92674d8..590fed735b3 100644
--- a/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h
+++ b/include/llvm/DebugInfo/PDB/Raw/SymbolStream.h
@@ -10,11 +10,9 @@
#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/CodeView/SymbolRecord.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"
@@ -28,10 +26,11 @@ public:
~SymbolStream();
Error reload();
- Expected<std::string> getSymbolName(uint32_t Offset) const;
+ iterator_range<codeview::SymbolIterator> getSymbols() const;
private:
- MappedBlockStream Stream;
+ ByteStream Stream;
+ MappedBlockStream MappedStream;
};
}
}