mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
Dump public symbol records in pdb2yaml mode
llvm-svn: 345348
This commit is contained in:
parent
b70da1d411
commit
1379d923e1
@ -110,6 +110,7 @@ void MappingTraits<PdbObject>::mapping(IO &IO, PdbObject &Obj) {
|
||||
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>::mapping(IO &IO,
|
||||
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);
|
||||
|
@ -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::yaml::StreamBlockList)
|
||||
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)
|
||||
|
@ -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();
|
||||
}
|
||||
@ -326,6 +332,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() {
|
||||
Out << Obj;
|
||||
outs().flush();
|
||||
|
@ -35,6 +35,7 @@ private:
|
||||
Error dumpDbiStream();
|
||||
Error dumpTpiStream();
|
||||
Error dumpIpiStream();
|
||||
Error dumpPublics();
|
||||
|
||||
void flush();
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user