summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-08-11 19:00:03 +0000
committerZachary Turner <zturner@google.com>2017-08-11 19:00:03 +0000
commitee9906d884ab76f698c4cb2a1b2dd6757e514314 (patch)
treec5f07c8886b37d3dd846c51b09f5b7c1095eed0a /llvm/lib/DebugInfo/PDB
parent3a1a95180034cf4ec74b5331475e48c404994d00 (diff)
downloadbcm5719-llvm-ee9906d884ab76f698c4cb2a1b2dd6757e514314.tar.gz
bcm5719-llvm-ee9906d884ab76f698c4cb2a1b2dd6757e514314.zip
[LLD/PDB] Write actual records to the globals stream.
Previously we were writing an empty globals stream. Windows tools interpret this as "private symbols are not present in this PDB", even when they are, so we need to fix this. Regardless, without it we don't have information about global variables, so we need to fix it anyway. This patch does that. With this patch, the "lm" command in WinDbg correctly reports that we have private symbols available, but the "dv" command still refuses to display local variables. Differential Revision: https://reviews.llvm.org/D36535 llvm-svn: 310743
Diffstat (limited to 'llvm/lib/DebugInfo/PDB')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
index 46951a0b88e..7c88748da80 100644
--- a/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
@@ -9,6 +9,7 @@
#include "llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h"
+#include "llvm/DebugInfo/CodeView/RecordName.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
@@ -27,13 +28,6 @@ using namespace llvm::msf;
using namespace llvm::pdb;
using namespace llvm::codeview;
-static StringRef getSymbolName(const CVSymbol &Sym) {
- assert(Sym.kind() == S_PUB32 && "handle other kinds");
- PublicSym32 PSL =
- cantFail(SymbolDeserializer::deserializeAs<PublicSym32>(Sym));
- return PSL.Name;
-}
-
struct llvm::pdb::GSIHashStreamBuilder {
std::vector<CVSymbol> Records;
uint32_t StreamIndex;
@@ -45,6 +39,13 @@ struct llvm::pdb::GSIHashStreamBuilder {
uint32_t calculateRecordByteSize() const;
Error commit(BinaryStreamWriter &Writer);
void finalizeBuckets(uint32_t RecordZeroOffset);
+
+ template <typename T> void addSymbol(const T &Symbol, MSFBuilder &Msf) {
+ T Copy(Symbol);
+ Records.push_back(SymbolSerializer::writeOneSymbol(Copy, Msf.getAllocator(),
+ CodeViewContainer::Pdb));
+ }
+ void addSymbol(const CVSymbol &Symbol) { Records.push_back(Symbol); }
};
uint32_t GSIHashStreamBuilder::calculateSerializedLength() const {
@@ -222,9 +223,27 @@ uint32_t GSIStreamBuilder::getGlobalsStreamIndex() const {
}
void GSIStreamBuilder::addPublicSymbol(const PublicSym32 &Pub) {
- PublicSym32 Copy(Pub);
- PSH->Records.push_back(SymbolSerializer::writeOneSymbol(
- Copy, Msf.getAllocator(), CodeViewContainer::Pdb));
+ PSH->addSymbol(Pub, Msf);
+}
+
+void GSIStreamBuilder::addGlobalSymbol(const ProcRefSym &Sym) {
+ GSH->addSymbol(Sym, Msf);
+}
+
+void GSIStreamBuilder::addGlobalSymbol(const DataSym &Sym) {
+ GSH->addSymbol(Sym, Msf);
+}
+
+void GSIStreamBuilder::addGlobalSymbol(const ConstantSym &Sym) {
+ GSH->addSymbol(Sym, Msf);
+}
+
+void GSIStreamBuilder::addGlobalSymbol(const UDTSym &Sym) {
+ GSH->addSymbol(Sym, Msf);
+}
+
+void GSIStreamBuilder::addGlobalSymbol(const codeview::CVSymbol &Sym) {
+ GSH->addSymbol(Sym);
}
static Error writeRecords(BinaryStreamWriter &Writer,
OpenPOWER on IntegriCloud