[llvm] r345348 - Dump public symbol records in pdb2yaml mode
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 25 17:17:32 PDT 2018
Author: zturner
Date: Thu Oct 25 17:17:31 2018
New Revision: 345348
URL: http://llvm.org/viewvc/llvm-project?rev=345348&view=rev
Log:
Dump public symbol records in pdb2yaml mode
Modified:
llvm/trunk/tools/llvm-pdbutil/PdbYaml.cpp
llvm/trunk/tools/llvm-pdbutil/PdbYaml.h
llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.cpp
llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.h
llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h
Modified: llvm/trunk/tools/llvm-pdbutil/PdbYaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/PdbYaml.cpp?rev=345348&r1=345347&r2=345348&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/PdbYaml.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/PdbYaml.cpp Thu Oct 25 17:17:31 2018
@@ -110,6 +110,7 @@ void MappingTraits<PdbObject>::mapping(I
IO.mapOptional("DbiStream", Obj.DbiStream);
IO.mapOptional("TpiStream", Obj.TpiStream);
IO.mapOptional("IpiStream", Obj.IpiStream);
+ IO.mapOptional("PublicsStream", Obj.PublicsStream);
}
void MappingTraits<MSFHeaders>::mapping(IO &IO, MSFHeaders &Obj) {
@@ -163,6 +164,11 @@ void MappingTraits<PdbTpiStream>::mappin
IO.mapRequired("Records", Obj.Records);
}
+void MappingTraits<PdbPublicsStream>::mapping(
+ IO &IO, pdb::yaml::PdbPublicsStream &Obj) {
+ IO.mapRequired("Records", Obj.PubSyms);
+}
+
void MappingTraits<NamedStreamMapping>::mapping(IO &IO,
NamedStreamMapping &Obj) {
IO.mapRequired("Name", Obj.StreamName);
Modified: llvm/trunk/tools/llvm-pdbutil/PdbYaml.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/PdbYaml.h?rev=345348&r1=345347&r2=345348&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/PdbYaml.h (original)
+++ llvm/trunk/tools/llvm-pdbutil/PdbYaml.h Thu Oct 25 17:17:31 2018
@@ -92,6 +92,10 @@ struct PdbTpiStream {
std::vector<CodeViewYAML::LeafRecord> Records;
};
+struct PdbPublicsStream {
+ std::vector<CodeViewYAML::SymbolRecord> PubSyms;
+};
+
struct PdbObject {
explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
@@ -102,6 +106,7 @@ struct PdbObject {
Optional<PdbDbiStream> DbiStream;
Optional<PdbTpiStream> TpiStream;
Optional<PdbTpiStream> IpiStream;
+ Optional<PdbPublicsStream> PublicsStream;
Optional<std::vector<StringRef>> StringTable;
@@ -118,6 +123,7 @@ LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::ya
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbInfoStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbTpiStream)
+LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbPublicsStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::NamedStreamMapping)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbModiStream)
LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiModuleInfo)
Modified: llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.cpp?rev=345348&r1=345347&r2=345348&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.cpp Thu Oct 25 17:17:31 2018
@@ -18,10 +18,13 @@
#include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
+#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/PublicsStream.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
using namespace llvm;
@@ -68,6 +71,9 @@ Error YAMLOutputStyle::dump() {
if (auto EC = dumpIpiStream())
return EC;
+ if (auto EC = dumpPublics())
+ return EC;
+
flush();
return Error::success();
}
@@ -324,6 +330,42 @@ Error YAMLOutputStyle::dumpIpiStream() {
}
return Error::success();
+}
+
+Error YAMLOutputStyle::dumpPublics() {
+ if (!opts::pdb2yaml::PublicsStream)
+ return Error::success();
+
+ Obj.PublicsStream.emplace();
+ auto ExpectedPublics = File.getPDBPublicsStream();
+ if (!ExpectedPublics) {
+ llvm::consumeError(ExpectedPublics.takeError());
+ return Error::success();
+ }
+
+ PublicsStream &Publics = *ExpectedPublics;
+ const GSIHashTable &PublicsTable = Publics.getPublicsTable();
+
+ auto ExpectedSyms = File.getPDBSymbolStream();
+ if (!ExpectedSyms) {
+ llvm::consumeError(ExpectedSyms.takeError());
+ return Error::success();
+ }
+
+ BinaryStreamRef SymStream =
+ ExpectedSyms->getSymbolArray().getUnderlyingStream();
+ for (uint32_t PubSymOff : PublicsTable) {
+ Expected<CVSymbol> Sym = readSymbolFromStream(SymStream, PubSymOff);
+ if (!Sym)
+ return Sym.takeError();
+ auto ES = CodeViewYAML::SymbolRecord::fromCodeViewSymbol(*Sym);
+ if (!ES)
+ return ES.takeError();
+
+ Obj.PublicsStream->PubSyms.push_back(*ES);
+ }
+
+ return Error::success();
}
void YAMLOutputStyle::flush() {
Modified: llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.h?rev=345348&r1=345347&r2=345348&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.h (original)
+++ llvm/trunk/tools/llvm-pdbutil/YAMLOutputStyle.h Thu Oct 25 17:17:31 2018
@@ -35,6 +35,7 @@ private:
Error dumpDbiStream();
Error dumpTpiStream();
Error dumpIpiStream();
+ Error dumpPublics();
void flush();
Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=345348&r1=345347&r2=345348&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp Thu Oct 25 17:17:31 2018
@@ -663,6 +663,10 @@ cl::opt<bool> IpiStream("ipi-stream",
cl::desc("Dump the IPI Stream (Stream 5)"),
cl::sub(PdbToYamlSubcommand), cl::init(false));
+cl::opt<bool> PublicsStream("publics-stream",
+ cl::desc("Dump the Publics Stream"),
+ cl::sub(PdbToYamlSubcommand), cl::init(false));
+
// MODULE & FILE OPTIONS
cl::opt<bool> DumpModules("modules", cl::desc("dump compiland information"),
cl::cat(FileOptions), cl::sub(PdbToYamlSubcommand));
@@ -1495,6 +1499,7 @@ int main(int Argc, const char **Argv) {
opts::pdb2yaml::DbiStream = true;
opts::pdb2yaml::TpiStream = true;
opts::pdb2yaml::IpiStream = true;
+ opts::pdb2yaml::PublicsStream = true;
opts::pdb2yaml::DumpModules = true;
opts::pdb2yaml::DumpModuleFiles = true;
opts::pdb2yaml::DumpModuleSyms = true;
Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h?rev=345348&r1=345347&r2=345348&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h Thu Oct 25 17:17:31 2018
@@ -192,6 +192,7 @@ extern llvm::cl::opt<bool> PdbStream;
extern llvm::cl::opt<bool> DbiStream;
extern llvm::cl::opt<bool> TpiStream;
extern llvm::cl::opt<bool> IpiStream;
+extern llvm::cl::opt<bool> PublicsStream;
extern llvm::cl::list<std::string> InputFilename;
extern llvm::cl::opt<bool> DumpModules;
extern llvm::cl::opt<bool> DumpModuleFiles;
More information about the llvm-commits
mailing list