diff options
author | Zachary Turner <zturner@google.com> | 2017-06-15 20:55:51 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-06-15 20:55:51 +0000 |
commit | da504b794cf3154ec9b3f0fb728f1b3880a8bb77 (patch) | |
tree | 95d7f819b11df9e7368116ed40595259d29bc539 /llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | |
parent | 60aac43813beccb33f72d15967ae4f21a789238d (diff) | |
download | bcm5719-llvm-da504b794cf3154ec9b3f0fb728f1b3880a8bb77.tar.gz bcm5719-llvm-da504b794cf3154ec9b3f0fb728f1b3880a8bb77.zip |
Revert "[llvm-pdbutil] rewrite the "raw" output style."
This reverts commit 83ea17ebf2106859a51fbc2a86031b44d33696ad.
This is failing due to some strange template problems, so reverting
until it can be straightened out.
llvm-svn: 305505
Diffstat (limited to 'llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp')
-rw-r--r-- | llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 172 |
1 files changed, 100 insertions, 72 deletions
diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp index 18fda036ee7..3826ba79a20 100644 --- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp +++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -15,6 +15,7 @@ #include "Analyze.h" #include "Diff.h" +#include "LLVMOutputStyle.h" #include "LinePrinter.h" #include "OutputStyle.h" #include "PrettyCompilandDumper.h" @@ -22,7 +23,6 @@ #include "PrettyFunctionDumper.h" #include "PrettyTypeDumper.h" #include "PrettyVariableDumper.h" -#include "RawOutputStyle.h" #include "YAMLOutputStyle.h" #include "llvm/ADT/ArrayRef.h" @@ -266,8 +266,6 @@ cl::list<std::string> InputFilenames(cl::Positional, cl::OneOrMore, cl::sub(DiffSubcommand)); } -cl::OptionCategory FileOptions("Module & File Options"); - namespace raw { cl::OptionCategory MsfOptions("MSF Container Options"); @@ -276,11 +274,18 @@ cl::OptionCategory SymbolOptions("Symbol Options"); cl::OptionCategory MiscOptions("Miscellaneous Options"); // MSF OPTIONS -cl::opt<bool> DumpSummary("summary", cl::desc("dump file summary"), - cl::cat(MsfOptions), cl::sub(RawSubcommand)); -cl::opt<bool> DumpStreams("streams", - cl::desc("dump summary of the PDB streams"), +cl::opt<bool> DumpHeaders("headers", cl::desc("dump PDB headers"), cl::cat(MsfOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpStreamBlocks("stream-blocks", + cl::desc("dump PDB stream blocks"), + cl::cat(MsfOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpStreamSummary("stream-summary", + cl::desc("dump summary of the PDB streams"), + cl::cat(MsfOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpPageStats( + "page-stats", + cl::desc("dump allocation stats of the pages in the MSF file"), + cl::cat(MsfOptions), cl::sub(RawSubcommand)); cl::opt<std::string> DumpBlockRangeOpt("block-data", cl::value_desc("start[-end]"), cl::desc("Dump binary data from specified range."), @@ -294,45 +299,40 @@ cl::list<std::string> cl::cat(MsfOptions), cl::sub(RawSubcommand)); // TYPE OPTIONS -cl::opt<bool> DumpTypes("types", - cl::desc("dump CodeView type records from TPI stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); -cl::opt<bool> DumpTypeData( - "type-data", +cl::opt<bool> + CompactRecords("compact-records", + cl::desc("Dump type and symbol records with less detail"), + cl::cat(TypeOptions), cl::sub(RawSubcommand)); + +cl::opt<bool> + DumpTpiRecords("tpi-records", + cl::desc("dump CodeView type records from TPI stream"), + cl::cat(TypeOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpTpiRecordBytes( + "tpi-record-bytes", cl::desc("dump CodeView type record raw bytes from TPI stream"), cl::cat(TypeOptions), cl::sub(RawSubcommand)); - -cl::opt<bool> DumpTypeHashes("type-hash", - cl::desc("dump CodeView TPI hash stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); - -cl::opt<bool> DumpIds("ids", - cl::desc("dump CodeView type records from IPI stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpTpiHash("tpi-hash", cl::desc("dump CodeView TPI hash stream"), + cl::cat(TypeOptions), cl::sub(RawSubcommand)); cl::opt<bool> - DumpIdData("id-data", - cl::desc("dump CodeView type record raw bytes from IPI stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + DumpIpiRecords("ipi-records", + cl::desc("dump CodeView type records from IPI stream"), + cl::cat(TypeOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpIpiRecordBytes( + "ipi-record-bytes", + cl::desc("dump CodeView type record raw bytes from IPI stream"), + cl::cat(TypeOptions), cl::sub(RawSubcommand)); // SYMBOL OPTIONS -cl::opt<bool> DumpPublics("publics", cl::desc("dump Publics stream data"), +cl::opt<bool> DumpGlobals("globals", cl::desc("dump globals stream data"), cl::cat(SymbolOptions), cl::sub(RawSubcommand)); -cl::opt<bool> DumpSymbols("symbols", cl::desc("dump module symbols"), +cl::opt<bool> DumpPublics("publics", cl::desc("dump Publics stream data"), cl::cat(SymbolOptions), cl::sub(RawSubcommand)); - cl::opt<bool> - DumpSymRecordBytes("sym-data", + DumpSymRecordBytes("sym-record-bytes", cl::desc("dump CodeView symbol record raw bytes"), cl::cat(SymbolOptions), cl::sub(RawSubcommand)); -// MODULE & FILE OPTIONS -cl::opt<bool> DumpModules("modules", cl::desc("dump compiland information"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); -cl::opt<bool> DumpModuleFiles( - "files", - cl::desc("for each module dumped, dump the contributing source files"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); - // MISCELLANEOUS OPTIONS cl::opt<bool> DumpStringTable("string-table", cl::desc("dump PDB String Table"), cl::cat(MiscOptions), cl::sub(RawSubcommand)); @@ -342,6 +342,11 @@ cl::opt<bool> DumpSectionContribs("section-contribs", cl::cat(MiscOptions), cl::sub(RawSubcommand)); cl::opt<bool> DumpSectionMap("section-map", cl::desc("dump section map"), cl::cat(MiscOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpSectionHeaders("section-headers", + cl::desc("dump section headers"), + cl::cat(MiscOptions), cl::sub(RawSubcommand)); +cl::opt<bool> DumpFpo("fpo", cl::desc("dump FPO records"), cl::cat(MiscOptions), + cl::sub(RawSubcommand)); cl::opt<bool> RawAll("all", cl::desc("Implies most other options."), cl::cat(MiscOptions), cl::sub(RawSubcommand)); @@ -399,11 +404,20 @@ cl::opt<bool> IpiStream("ipi-stream", cl::desc("Dump the IPI Stream (Stream 5)"), cl::sub(PdbToYamlSubcommand), cl::init(false)); +cl::list<std::string> InputFilename(cl::Positional, + cl::desc("<input PDB file>"), cl::Required, + cl::sub(PdbToYamlSubcommand)); +} + +namespace shared { +cl::OptionCategory FileOptions("Module & File Options"); + // MODULE & FILE OPTIONS cl::opt<bool> DumpModules("modules", cl::desc("dump compiland information"), - cl::cat(FileOptions), cl::sub(PdbToYamlSubcommand)); + cl::cat(FileOptions), cl::sub(RawSubcommand), + cl::sub(PdbToYamlSubcommand)); cl::opt<bool> DumpModuleFiles("module-files", cl::desc("dump file information"), - cl::cat(FileOptions), + cl::cat(FileOptions), cl::sub(RawSubcommand), cl::sub(PdbToYamlSubcommand)); cl::list<ModuleSubsection> DumpModuleSubsections( "subsections", cl::ZeroOrMore, cl::CommaSeparated, @@ -434,15 +448,11 @@ cl::list<ModuleSubsection> DumpModuleSubsections( clEnumValN(ModuleSubsection::Unknown, "unknown", "Any subsection not covered by another option"), clEnumValN(ModuleSubsection::All, "all", "All known subsections")), - cl::cat(FileOptions), cl::sub(PdbToYamlSubcommand)); + cl::cat(FileOptions), cl::sub(RawSubcommand), cl::sub(PdbToYamlSubcommand)); cl::opt<bool> DumpModuleSyms("module-syms", cl::desc("dump module symbols"), - cl::cat(FileOptions), + cl::cat(FileOptions), cl::sub(RawSubcommand), cl::sub(PdbToYamlSubcommand)); - -cl::list<std::string> InputFilename(cl::Positional, - cl::desc("<input PDB file>"), cl::Required, - cl::sub(PdbToYamlSubcommand)); -} // namespace pdb2yaml +} // namespace shared namespace analyze { cl::opt<bool> StringTable("hash-collisions", cl::desc("Find hash collisions"), @@ -464,6 +474,13 @@ cl::opt<std::string> static ExitOnError ExitOnErr; +bool opts::checkModuleSubsection(opts::ModuleSubsection MS) { + return any_of(opts::shared::DumpModuleSubsections, + [=](opts::ModuleSubsection M) { + return M == MS || M == opts::ModuleSubsection::All; + }); +} + static void yamlToPdb(StringRef Path) { BumpPtrAllocator Allocator; ErrorOr<std::unique_ptr<MemoryBuffer>> ErrorOrBuffer = @@ -594,7 +611,7 @@ static void dumpRaw(StringRef Path) { std::unique_ptr<IPDBSession> Session; auto &File = loadPDB(Path, Session); - auto O = llvm::make_unique<RawOutputStyle>(File); + auto O = llvm::make_unique<LLVMOutputStyle>(File); ExitOnErr(O->dump()); } @@ -887,21 +904,49 @@ int main(int argc_, const char *argv_[]) { } } + if ((opts::RawSubcommand && opts::raw::RawAll) || + (opts::PdbToYamlSubcommand && opts::pdb2yaml::All)) { + opts::shared::DumpModules = true; + opts::shared::DumpModuleFiles = true; + opts::shared::DumpModuleSyms = true; + opts::shared::DumpModuleSubsections.push_back(opts::ModuleSubsection::All); + if (llvm::is_contained(opts::shared::DumpModuleSubsections, + opts::ModuleSubsection::All)) { + opts::shared::DumpModuleSubsections.reset(); + opts::shared::DumpModuleSubsections.push_back( + opts::ModuleSubsection::All); + } + } + + if (opts::shared::DumpModuleSyms || opts::shared::DumpModuleFiles) + opts::shared::DumpModules = true; + + if (opts::shared::DumpModules) + opts::pdb2yaml::DbiStream = true; + if (opts::RawSubcommand) { if (opts::raw::RawAll) { - opts::raw::DumpIds = true; + opts::raw::DumpHeaders = true; + opts::raw::DumpGlobals = true; opts::raw::DumpPublics = true; - opts::raw::DumpSectionContribs = true; + opts::raw::DumpSectionHeaders = true; + opts::raw::DumpStreamSummary = true; + opts::raw::DumpPageStats = true; + opts::raw::DumpStreamBlocks = true; + opts::raw::DumpTpiRecords = true; + opts::raw::DumpTpiHash = true; + opts::raw::DumpIpiRecords = true; opts::raw::DumpSectionMap = true; - opts::raw::DumpStreams = true; + opts::raw::DumpSectionContribs = true; + opts::raw::DumpFpo = true; opts::raw::DumpStringTable = true; - opts::raw::DumpSummary = true; - opts::raw::DumpSymbols = true; - opts::raw::DumpIds = true; - opts::raw::DumpTypes = true; - opts::raw::DumpTypeHashes = true; - opts::raw::DumpModules = true; - opts::raw::DumpModuleFiles = true; + } + + if (opts::raw::CompactRecords && + (opts::raw::DumpTpiRecordBytes || opts::raw::DumpIpiRecordBytes)) { + errs() << "-compact-records is incompatible with -tpi-record-bytes and " + "-ipi-record-bytes.\n"; + exit(1); } } if (opts::PdbToYamlSubcommand) { @@ -913,24 +958,7 @@ int main(int argc_, const char *argv_[]) { opts::pdb2yaml::DbiStream = true; opts::pdb2yaml::TpiStream = true; opts::pdb2yaml::IpiStream = true; - opts::pdb2yaml::DumpModules = true; - opts::pdb2yaml::DumpModuleFiles = true; - opts::pdb2yaml::DumpModuleSyms = true; - opts::pdb2yaml::DumpModuleSubsections.push_back( - opts::ModuleSubsection::All); - if (llvm::is_contained(opts::pdb2yaml::DumpModuleSubsections, - opts::ModuleSubsection::All)) { - opts::pdb2yaml::DumpModuleSubsections.reset(); - opts::pdb2yaml::DumpModuleSubsections.push_back( - opts::ModuleSubsection::All); - } } - - if (opts::pdb2yaml::DumpModuleSyms || opts::pdb2yaml::DumpModuleFiles) - opts::pdb2yaml::DumpModules = true; - - if (opts::pdb2yaml::DumpModules) - opts::pdb2yaml::DbiStream = true; } llvm::sys::InitializeCOMRAII COM(llvm::sys::COMThreadingMode::MultiThreaded); |