From 0895032e6e12499aee40e1fffcab26048b3a6ca5 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Thu, 22 Jun 2017 20:57:39 +0000 Subject: [PATCH] [llvm-pdbutil] Rename "raw" to "dump". Now you run llvm-pdbutil dump . This is a followup after having renamed the tool, whereas before raw was obviously just the style of dumping, whereas now "dump" is the action to perform with the "util". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306055 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../PDB/pdbdump-merge-ids-and-types.test | 4 +- test/DebugInfo/PDB/pdbdump-mergeids.test | 4 +- test/DebugInfo/PDB/pdbdump-mergetypes.test | 2 +- test/DebugInfo/PDB/pdbdump-raw-blocks.test | 10 +- test/DebugInfo/PDB/pdbdump-raw-stream.test | 6 +- test/DebugInfo/PDB/pdbdump-readwrite.test | 4 +- tools/llvm-pdbutil/CMakeLists.txt | 2 +- ...RawOutputStyle.cpp => DumpOutputStyle.cpp} | 104 +++++++-------- .../{RawOutputStyle.h => DumpOutputStyle.h} | 10 +- tools/llvm-pdbutil/llvm-pdbutil.cpp | 121 +++++++++--------- tools/llvm-pdbutil/llvm-pdbutil.h | 2 +- 11 files changed, 135 insertions(+), 134 deletions(-) rename tools/llvm-pdbutil/{RawOutputStyle.cpp => DumpOutputStyle.cpp} (93%) rename tools/llvm-pdbutil/{RawOutputStyle.h => DumpOutputStyle.h} (83%) diff --git a/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test b/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test index f25e9024453..d3b7ae56eaa 100644 --- a/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test +++ b/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test @@ -1,8 +1,8 @@ ; RUN: llvm-pdbutil yaml2pdb -pdb=%t.1.pdb %p/Inputs/merge-ids-and-types-1.yaml ; RUN: llvm-pdbutil yaml2pdb -pdb=%t.2.pdb %p/Inputs/merge-ids-and-types-2.yaml ; RUN: llvm-pdbutil merge -pdb=%t.3.pdb %t.1.pdb %t.2.pdb -; RUN: llvm-pdbutil raw -types %t.3.pdb | FileCheck -check-prefix=TPI-TYPES %s -; RUN: llvm-pdbutil raw -ids %t.3.pdb | FileCheck -check-prefix=IPI-TYPES %s +; RUN: llvm-pdbutil dump -types %t.3.pdb | FileCheck -check-prefix=TPI-TYPES %s +; RUN: llvm-pdbutil dump -ids %t.3.pdb | FileCheck -check-prefix=IPI-TYPES %s TPI-TYPES: Types (TPI Stream) TPI-TYPES-NEXT: ============================================================ diff --git a/test/DebugInfo/PDB/pdbdump-mergeids.test b/test/DebugInfo/PDB/pdbdump-mergeids.test index 441ce4d8dbc..971bf0eac08 100644 --- a/test/DebugInfo/PDB/pdbdump-mergeids.test +++ b/test/DebugInfo/PDB/pdbdump-mergeids.test @@ -1,8 +1,8 @@ ; RUN: llvm-pdbutil yaml2pdb -pdb=%t.1.pdb %p/Inputs/merge-ids-1.yaml ; RUN: llvm-pdbutil yaml2pdb -pdb=%t.2.pdb %p/Inputs/merge-ids-2.yaml ; RUN: llvm-pdbutil merge -pdb=%t.3.pdb %t.1.pdb %t.2.pdb -; RUN: llvm-pdbutil raw -ids %t.3.pdb | FileCheck -check-prefix=MERGED %s -; RUN: llvm-pdbutil raw -types %t.3.pdb | FileCheck -check-prefix=TPI-EMPTY %s +; RUN: llvm-pdbutil dump -ids %t.3.pdb | FileCheck -check-prefix=MERGED %s +; RUN: llvm-pdbutil dump -types %t.3.pdb | FileCheck -check-prefix=TPI-EMPTY %s MERGED: Types (IPI Stream) diff --git a/test/DebugInfo/PDB/pdbdump-mergetypes.test b/test/DebugInfo/PDB/pdbdump-mergetypes.test index 9aae4054369..8ab64cfab51 100644 --- a/test/DebugInfo/PDB/pdbdump-mergetypes.test +++ b/test/DebugInfo/PDB/pdbdump-mergetypes.test @@ -1,7 +1,7 @@ +; RUN: llvm-pdbutil yaml2pdb -pdb=%t.1.pdb %p/Inputs/merge-types-1.yaml ; RUN: llvm-pdbutil yaml2pdb -pdb=%t.2.pdb %p/Inputs/merge-types-2.yaml ; RUN: llvm-pdbutil merge -pdb=%t.3.pdb %t.1.pdb %t.2.pdb -; RUN: llvm-pdbutil raw -types %t.3.pdb | FileCheck -check-prefix=MERGED %s +; RUN: llvm-pdbutil dump -types %t.3.pdb | FileCheck -check-prefix=MERGED %s MERGED: Types (TPI Stream) diff --git a/test/DebugInfo/PDB/pdbdump-raw-blocks.test b/test/DebugInfo/PDB/pdbdump-raw-blocks.test index b695d5a1c4c..e333a05fce3 100644 --- a/test/DebugInfo/PDB/pdbdump-raw-blocks.test +++ b/test/DebugInfo/PDB/pdbdump-raw-blocks.test @@ -1,8 +1,8 @@ -; RUN: llvm-pdbutil raw -block-data=0 %p/Inputs/empty.pdb | FileCheck --check-prefix=BLOCK0 %s -; RUN: llvm-pdbutil raw -block-data=0-1 %p/Inputs/empty.pdb | FileCheck --check-prefix=BLOCK01 %s -; RUN: not llvm-pdbutil raw -block-data=0,1 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BADSYNTAX %s -; RUN: not llvm-pdbutil raw -block-data=0a1 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BADSYNTAX %s -; RUN: not llvm-pdbutil raw -block-data=0- %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BADSYNTAX %s +; RUN: llvm-pdbutil dump -block-data=0 %p/Inputs/empty.pdb | FileCheck --check-prefix=BLOCK0 %s +; RUN: llvm-pdbutil dump -block-data=0-1 %p/Inputs/empty.pdb | FileCheck --check-prefix=BLOCK01 %s +; RUN: not llvm-pdbutil dump -block-data=0,1 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BADSYNTAX %s +; RUN: not llvm-pdbutil dump -block-data=0a1 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BADSYNTAX %s +; RUN: not llvm-pdbutil dump -block-data=0- %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BADSYNTAX %s BLOCK0: MSF Blocks BLOCK0-NEXT: ============================================================ diff --git a/test/DebugInfo/PDB/pdbdump-raw-stream.test b/test/DebugInfo/PDB/pdbdump-raw-stream.test index 2f8e05ad058..4022975e108 100644 --- a/test/DebugInfo/PDB/pdbdump-raw-stream.test +++ b/test/DebugInfo/PDB/pdbdump-raw-stream.test @@ -1,6 +1,6 @@ -; RUN: llvm-pdbutil raw -stream-data=1 %p/Inputs/empty.pdb | FileCheck --check-prefix=STREAM %s -; RUN: llvm-pdbutil raw -stream-data=100 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=INVALIDSTREAM %s -; RUN: llvm-pdbutil raw -stream-data=1,100 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BOTH %s +; RUN: llvm-pdbutil dump -stream-data=1 %p/Inputs/empty.pdb | FileCheck --check-prefix=STREAM %s +; RUN: llvm-pdbutil dump -stream-data=100 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=INVALIDSTREAM %s +; RUN: llvm-pdbutil dump -stream-data=1,100 %p/Inputs/empty.pdb 2>&1 | FileCheck --check-prefix=BOTH %s STREAM: Stream Data STREAM-NEXT: ============================================================ diff --git a/test/DebugInfo/PDB/pdbdump-readwrite.test b/test/DebugInfo/PDB/pdbdump-readwrite.test index 51ebd754545..b3ec3ce4ee6 100644 --- a/test/DebugInfo/PDB/pdbdump-readwrite.test +++ b/test/DebugInfo/PDB/pdbdump-readwrite.test @@ -3,8 +3,8 @@ RUN: -pdb-stream -string-table -tpi-stream -stream-directory \ RUN: -stream-metadata %p/Inputs/empty.pdb > %t.1 RUN: llvm-pdbutil yaml2pdb -pdb=%t.2 %t.1 -RUN: llvm-pdbutil raw -summary -string-table -types %p/Inputs/empty.pdb | FileCheck %s -RUN: llvm-pdbutil raw -summary -string-table -types %t.2 | FileCheck %s +RUN: llvm-pdbutil dump -summary -string-table -types %p/Inputs/empty.pdb | FileCheck %s +RUN: llvm-pdbutil dump -summary -string-table -types %t.2 | FileCheck %s CHECK: Summary diff --git a/tools/llvm-pdbutil/CMakeLists.txt b/tools/llvm-pdbutil/CMakeLists.txt index 94e74412b50..8ebe0133f5e 100644 --- a/tools/llvm-pdbutil/CMakeLists.txt +++ b/tools/llvm-pdbutil/CMakeLists.txt @@ -10,6 +10,7 @@ set(LLVM_LINK_COMPONENTS add_llvm_tool(llvm-pdbutil Analyze.cpp Diff.cpp + DumpOutputStyle.cpp llvm-pdbutil.cpp FormatUtil.cpp LinePrinter.cpp @@ -26,7 +27,6 @@ add_llvm_tool(llvm-pdbutil PrettyTypeDumper.cpp PrettyTypedefDumper.cpp PrettyVariableDumper.cpp - RawOutputStyle.cpp StreamUtil.cpp YAMLOutputStyle.cpp ) diff --git a/tools/llvm-pdbutil/RawOutputStyle.cpp b/tools/llvm-pdbutil/DumpOutputStyle.cpp similarity index 93% rename from tools/llvm-pdbutil/RawOutputStyle.cpp rename to tools/llvm-pdbutil/DumpOutputStyle.cpp index 515125739b3..ea7d9f1f708 100644 --- a/tools/llvm-pdbutil/RawOutputStyle.cpp +++ b/tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -1,4 +1,4 @@ -//===- RawOutputStyle.cpp ------------------------------------ *- C++ --*-===// +//===- DumpOutputStyle.cpp ------------------------------------ *- C++ --*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "RawOutputStyle.h" +#include "DumpOutputStyle.h" #include "FormatUtil.h" #include "MinimalSymbolDumper.h" @@ -64,96 +64,96 @@ using namespace llvm::codeview; using namespace llvm::msf; using namespace llvm::pdb; -RawOutputStyle::RawOutputStyle(PDBFile &File) +DumpOutputStyle::DumpOutputStyle(PDBFile &File) : File(File), P(2, false, outs()) {} -Error RawOutputStyle::dump() { - if (opts::raw::DumpSummary) { +Error DumpOutputStyle::dump() { + if (opts::dump::DumpSummary) { if (auto EC = dumpFileSummary()) return EC; P.NewLine(); } - if (opts::raw::DumpStreams) { + if (opts::dump::DumpStreams) { if (auto EC = dumpStreamSummary()) return EC; P.NewLine(); } - if (opts::raw::DumpBlockRange.hasValue()) { + if (opts::dump::DumpBlockRange.hasValue()) { if (auto EC = dumpBlockRanges()) return EC; P.NewLine(); } - if (!opts::raw::DumpStreamData.empty()) { + if (!opts::dump::DumpStreamData.empty()) { if (auto EC = dumpStreamBytes()) return EC; P.NewLine(); } - if (opts::raw::DumpStringTable) { + if (opts::dump::DumpStringTable) { if (auto EC = dumpStringTable()) return EC; P.NewLine(); } - if (opts::raw::DumpModules) { + if (opts::dump::DumpModules) { if (auto EC = dumpModules()) return EC; } - if (opts::raw::DumpModuleFiles) { + if (opts::dump::DumpModuleFiles) { if (auto EC = dumpModuleFiles()) return EC; } - if (opts::raw::DumpLines) { + if (opts::dump::DumpLines) { if (auto EC = dumpLines()) return EC; } - if (opts::raw::DumpInlineeLines) { + if (opts::dump::DumpInlineeLines) { if (auto EC = dumpInlineeLines()) return EC; } - if (opts::raw::DumpXmi) { + if (opts::dump::DumpXmi) { if (auto EC = dumpXmi()) return EC; } - if (opts::raw::DumpXme) { + if (opts::dump::DumpXme) { if (auto EC = dumpXme()) return EC; } - if (opts::raw::DumpTypes || opts::raw::DumpTypeExtras) { + if (opts::dump::DumpTypes || opts::dump::DumpTypeExtras) { if (auto EC = dumpTpiStream(StreamTPI)) return EC; } - if (opts::raw::DumpIds || opts::raw::DumpIdExtras) { + if (opts::dump::DumpIds || opts::dump::DumpIdExtras) { if (auto EC = dumpTpiStream(StreamIPI)) return EC; } - if (opts::raw::DumpPublics) { + if (opts::dump::DumpPublics) { if (auto EC = dumpPublics()) return EC; } - if (opts::raw::DumpSymbols) { + if (opts::dump::DumpSymbols) { if (auto EC = dumpModuleSyms()) return EC; } - if (opts::raw::DumpSectionContribs) { + if (opts::dump::DumpSectionContribs) { if (auto EC = dumpSectionContribs()) return EC; } - if (opts::raw::DumpSectionMap) { + if (opts::dump::DumpSectionMap) { if (auto EC = dumpSectionMap()) return EC; } @@ -167,7 +167,7 @@ static void printHeader(LinePrinter &P, const Twine &S) { P.formatLine("{0}", fmt_repeat('=', 60)); } -Error RawOutputStyle::dumpFileSummary() { +Error DumpOutputStyle::dumpFileSummary() { printHeader(P, "Summary"); ExitOnError Err("Invalid PDB Format"); @@ -197,7 +197,7 @@ Error RawOutputStyle::dumpFileSummary() { return Error::success(); } -Error RawOutputStyle::dumpStreamSummary() { +Error DumpOutputStyle::dumpStreamSummary() { printHeader(P, "Streams"); if (StreamPurposes.empty()) @@ -216,10 +216,10 @@ Error RawOutputStyle::dumpStreamSummary() { return Error::success(); } -Error RawOutputStyle::dumpBlockRanges() { +Error DumpOutputStyle::dumpBlockRanges() { printHeader(P, "MSF Blocks"); - auto &R = *opts::raw::DumpBlockRange; + auto &R = *opts::dump::DumpBlockRange; uint32_t Max = R.Max.getValueOr(R.Min); AutoIndent Indent(P); @@ -264,14 +264,14 @@ static Error parseStreamSpec(StringRef Str, uint32_t &SI, uint32_t &Offset, return Error::success(); } -Error RawOutputStyle::dumpStreamBytes() { +Error DumpOutputStyle::dumpStreamBytes() { if (StreamPurposes.empty()) discoverStreamPurposes(File, StreamPurposes); printHeader(P, "Stream Data"); ExitOnError Err("Unexpected error reading stream data"); - for (auto &Str : opts::raw::DumpStreamData) { + for (auto &Str : opts::dump::DumpStreamData) { uint32_t SI = 0; uint32_t Begin = 0; uint32_t Size = 0; @@ -493,7 +493,7 @@ static void iterateModuleSubsections( }); } -Error RawOutputStyle::dumpModules() { +Error DumpOutputStyle::dumpModules() { printHeader(P, "Modules"); AutoIndent Indent(P); @@ -521,7 +521,7 @@ Error RawOutputStyle::dumpModules() { return Error::success(); } -Error RawOutputStyle::dumpModuleFiles() { +Error DumpOutputStyle::dumpModuleFiles() { printHeader(P, "Files"); ExitOnError Err("Unexpected error processing modules"); @@ -573,7 +573,7 @@ static void typesetLinesAndColumns(PDBFile &File, LinePrinter &P, } } -Error RawOutputStyle::dumpLines() { +Error DumpOutputStyle::dumpLines() { printHeader(P, "Lines"); uint32_t LastModi = UINT32_MAX; @@ -609,7 +609,7 @@ Error RawOutputStyle::dumpLines() { return Error::success(); } -Error RawOutputStyle::dumpInlineeLines() { +Error DumpOutputStyle::dumpInlineeLines() { printHeader(P, "Inlinee Lines"); iterateModuleSubsections( @@ -628,7 +628,7 @@ Error RawOutputStyle::dumpInlineeLines() { return Error::success(); } -Error RawOutputStyle::dumpXmi() { +Error DumpOutputStyle::dumpXmi() { printHeader(P, "Cross Module Imports"); iterateModuleSubsections( File, P, 2, @@ -663,7 +663,7 @@ Error RawOutputStyle::dumpXmi() { return Error::success(); } -Error RawOutputStyle::dumpXme() { +Error DumpOutputStyle::dumpXme() { printHeader(P, "Cross Module Exports"); iterateModuleSubsections( @@ -680,7 +680,7 @@ Error RawOutputStyle::dumpXme() { return Error::success(); } -Error RawOutputStyle::dumpStringTable() { +Error DumpOutputStyle::dumpStringTable() { printHeader(P, "String Table"); AutoIndent Indent(P); @@ -722,7 +722,7 @@ Error RawOutputStyle::dumpStringTable() { return Error::success(); } -Error RawOutputStyle::dumpTpiStream(uint32_t StreamIdx) { +Error DumpOutputStyle::dumpTpiStream(uint32_t StreamIdx) { assert(StreamIdx == StreamTPI || StreamIdx == StreamIPI); bool Present = false; @@ -733,19 +733,19 @@ Error RawOutputStyle::dumpTpiStream(uint32_t StreamIdx) { if (StreamIdx == StreamTPI) { printHeader(P, "Types (TPI Stream)"); Present = File.hasPDBTpiStream(); - DumpTypes = opts::raw::DumpTypes; - DumpBytes = opts::raw::DumpTypeData; - DumpExtras = opts::raw::DumpTypeExtras; - Indices.assign(opts::raw::DumpTypeIndex.begin(), - opts::raw::DumpTypeIndex.end()); + DumpTypes = opts::dump::DumpTypes; + DumpBytes = opts::dump::DumpTypeData; + DumpExtras = opts::dump::DumpTypeExtras; + Indices.assign(opts::dump::DumpTypeIndex.begin(), + opts::dump::DumpTypeIndex.end()); } else if (StreamIdx == StreamIPI) { printHeader(P, "Types (IPI Stream)"); Present = File.hasPDBIpiStream(); - DumpTypes = opts::raw::DumpIds; - DumpBytes = opts::raw::DumpIdData; - DumpExtras = opts::raw::DumpIdExtras; - Indices.assign(opts::raw::DumpIdIndex.begin(), - opts::raw::DumpIdIndex.end()); + DumpTypes = opts::dump::DumpIds; + DumpBytes = opts::dump::DumpIdData; + DumpExtras = opts::dump::DumpIdExtras; + Indices.assign(opts::dump::DumpIdIndex.begin(), + opts::dump::DumpIdIndex.end()); } AutoIndent Indent(P); @@ -814,7 +814,7 @@ Error RawOutputStyle::dumpTpiStream(uint32_t StreamIdx) { } Expected -RawOutputStyle::initializeTypes(uint32_t SN) { +DumpOutputStyle::initializeTypes(uint32_t SN) { auto &TypeCollection = (SN == StreamTPI) ? TpiTypes : IpiTypes; auto Tpi = (SN == StreamTPI) ? File.getPDBTpiStream() : File.getPDBIpiStream(); @@ -832,7 +832,7 @@ RawOutputStyle::initializeTypes(uint32_t SN) { return *TypeCollection; } -Error RawOutputStyle::dumpModuleSyms() { +Error DumpOutputStyle::dumpModuleSyms() { printHeader(P, "Symbols"); AutoIndent Indent(P); @@ -872,7 +872,7 @@ Error RawOutputStyle::dumpModuleSyms() { SymbolVisitorCallbackPipeline Pipeline; SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb); - MinimalSymbolDumper Dumper(P, opts::raw::DumpSymRecordBytes, Types); + MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, Types); Pipeline.addCallbackToPipeline(Deserializer); Pipeline.addCallbackToPipeline(Dumper); @@ -886,7 +886,7 @@ Error RawOutputStyle::dumpModuleSyms() { return Error::success(); } -Error RawOutputStyle::dumpPublics() { +Error DumpOutputStyle::dumpPublics() { printHeader(P, "Public Symbols"); AutoIndent Indent(P); @@ -901,7 +901,7 @@ Error RawOutputStyle::dumpPublics() { auto &Publics = Err(File.getPDBPublicsStream()); SymbolVisitorCallbackPipeline Pipeline; SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb); - MinimalSymbolDumper Dumper(P, opts::raw::DumpSymRecordBytes, Types); + MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, Types); Pipeline.addCallbackToPipeline(Deserializer); Pipeline.addCallbackToPipeline(Dumper); @@ -1001,7 +1001,7 @@ static std::string formatSegMapDescriptorFlag(uint32_t IndentLevel, return typesetItemList(Opts, IndentLevel, 4, " | "); } -Error RawOutputStyle::dumpSectionContribs() { +Error DumpOutputStyle::dumpSectionContribs() { printHeader(P, "Section Contributions"); ExitOnError Err("Error dumping publics stream"); @@ -1047,7 +1047,7 @@ Error RawOutputStyle::dumpSectionContribs() { return Error::success(); } -Error RawOutputStyle::dumpSectionMap() { +Error DumpOutputStyle::dumpSectionMap() { printHeader(P, "Section Map"); ExitOnError Err("Error dumping section map"); diff --git a/tools/llvm-pdbutil/RawOutputStyle.h b/tools/llvm-pdbutil/DumpOutputStyle.h similarity index 83% rename from tools/llvm-pdbutil/RawOutputStyle.h rename to tools/llvm-pdbutil/DumpOutputStyle.h index 68ba15ddcbd..296a6c14942 100644 --- a/tools/llvm-pdbutil/RawOutputStyle.h +++ b/tools/llvm-pdbutil/DumpOutputStyle.h @@ -1,4 +1,4 @@ -//===- RawOutputStyle.h -------------------------------------- *- C++ --*-===// +//===- DumpOutputStyle.h -------------------------------------- *- C++ --*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_TOOLS_LLVMPDBDUMP_RAWOUTPUTSTYLE_H -#define LLVM_TOOLS_LLVMPDBDUMP_RAWOUTPUTSTYLE_H +#ifndef LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H +#define LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H #include "LinePrinter.h" #include "OutputStyle.h" @@ -26,9 +26,9 @@ class LazyRandomTypeCollection; } namespace pdb { -class RawOutputStyle : public OutputStyle { +class DumpOutputStyle : public OutputStyle { public: - RawOutputStyle(PDBFile &File); + DumpOutputStyle(PDBFile &File); Error dump() override; diff --git a/tools/llvm-pdbutil/llvm-pdbutil.cpp b/tools/llvm-pdbutil/llvm-pdbutil.cpp index 35327b57851..658833de625 100644 --- a/tools/llvm-pdbutil/llvm-pdbutil.cpp +++ b/tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -15,6 +15,7 @@ #include "Analyze.h" #include "Diff.h" +#include "DumpOutputStyle.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" @@ -86,7 +86,7 @@ using namespace llvm::pdb; namespace opts { -cl::SubCommand RawSubcommand("raw", "Dump raw structure of the PDB file"); +cl::SubCommand DumpSubcommand("dump", "Dump MSF and CodeView debug info"); cl::SubCommand PrettySubcommand("pretty", "Dump semantic information about types and symbols"); @@ -263,7 +263,7 @@ cl::list InputFilenames(cl::Positional, cl::OptionCategory FileOptions("Module & File Options"); -namespace raw { +namespace dump { cl::OptionCategory MsfOptions("MSF Container Options"); cl::OptionCategory TypeOptions("Type Record Options"); @@ -272,109 +272,110 @@ cl::OptionCategory MiscOptions("Miscellaneous Options"); // MSF OPTIONS cl::opt DumpSummary("summary", cl::desc("dump file summary"), - cl::cat(MsfOptions), cl::sub(RawSubcommand)); + cl::cat(MsfOptions), cl::sub(DumpSubcommand)); cl::opt DumpStreams("streams", cl::desc("dump summary of the PDB streams"), - cl::cat(MsfOptions), cl::sub(RawSubcommand)); + cl::cat(MsfOptions), cl::sub(DumpSubcommand)); cl::opt DumpBlockRangeOpt("block-data", cl::value_desc("start[-end]"), cl::desc("Dump binary data from specified range."), - cl::cat(MsfOptions), cl::sub(RawSubcommand)); + cl::cat(MsfOptions), cl::sub(DumpSubcommand)); llvm::Optional DumpBlockRange; cl::list DumpStreamData("stream-data", cl::CommaSeparated, cl::ZeroOrMore, cl::desc("Dump binary data from specified streams. Format " "is SN[:Start][@Size]"), - cl::cat(MsfOptions), cl::sub(RawSubcommand)); + cl::cat(MsfOptions), cl::sub(DumpSubcommand)); // TYPE OPTIONS cl::opt DumpTypes("types", cl::desc("dump CodeView type records from TPI stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::opt DumpTypeData( "type-data", cl::desc("dump CodeView type record raw bytes from TPI stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::opt DumpTypeExtras("type-extras", cl::desc("dump type hashes and index offsets"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::list DumpTypeIndex( "type-index", cl::ZeroOrMore, cl::desc("only dump types with the specified hexadecimal type index"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::opt DumpIds("ids", cl::desc("dump CodeView type records from IPI stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::opt DumpIdData("id-data", cl::desc("dump CodeView type record raw bytes from IPI stream"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::opt DumpIdExtras("id-extras", cl::desc("dump id hashes and index offsets"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::list DumpIdIndex( "id-index", cl::ZeroOrMore, cl::desc("only dump ids with the specified hexadecimal type index"), - cl::cat(TypeOptions), cl::sub(RawSubcommand)); + cl::cat(TypeOptions), cl::sub(DumpSubcommand)); // SYMBOL OPTIONS cl::opt DumpPublics("publics", cl::desc("dump Publics stream data"), - cl::cat(SymbolOptions), cl::sub(RawSubcommand)); + cl::cat(SymbolOptions), cl::sub(DumpSubcommand)); cl::opt DumpSymbols("symbols", cl::desc("dump module symbols"), - cl::cat(SymbolOptions), cl::sub(RawSubcommand)); + cl::cat(SymbolOptions), cl::sub(DumpSubcommand)); cl::opt DumpSymRecordBytes("sym-data", cl::desc("dump CodeView symbol record raw bytes"), - cl::cat(SymbolOptions), cl::sub(RawSubcommand)); + cl::cat(SymbolOptions), cl::sub(DumpSubcommand)); // MODULE & FILE OPTIONS cl::opt DumpModules("modules", cl::desc("dump compiland information"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); + cl::cat(FileOptions), cl::sub(DumpSubcommand)); cl::opt DumpModuleFiles( "files", cl::desc("Dump the source files that contribute to each module's."), - cl::cat(FileOptions), cl::sub(RawSubcommand)); + cl::cat(FileOptions), cl::sub(DumpSubcommand)); cl::opt DumpLines( "l", cl::desc("dump source file/line information (DEBUG_S_LINES subsection)"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); + cl::cat(FileOptions), cl::sub(DumpSubcommand)); cl::opt DumpInlineeLines( "il", cl::desc("dump inlinee line information (DEBUG_S_INLINEELINES subsection)"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); + cl::cat(FileOptions), cl::sub(DumpSubcommand)); cl::opt DumpXmi( "xmi", cl::desc( "dump cross module imports (DEBUG_S_CROSSSCOPEIMPORTS subsection)"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); + cl::cat(FileOptions), cl::sub(DumpSubcommand)); cl::opt DumpXme( "xme", cl::desc( "dump cross module exports (DEBUG_S_CROSSSCOPEEXPORTS subsection)"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); + cl::cat(FileOptions), cl::sub(DumpSubcommand)); // MISCELLANEOUS OPTIONS cl::opt DumpStringTable("string-table", cl::desc("dump PDB String Table"), - cl::cat(MiscOptions), cl::sub(RawSubcommand)); + cl::cat(MiscOptions), cl::sub(DumpSubcommand)); cl::opt DumpSectionContribs("section-contribs", cl::desc("dump section contributions"), - cl::cat(MiscOptions), cl::sub(RawSubcommand)); + cl::cat(MiscOptions), + cl::sub(DumpSubcommand)); cl::opt DumpSectionMap("section-map", cl::desc("dump section map"), - cl::cat(MiscOptions), cl::sub(RawSubcommand)); + cl::cat(MiscOptions), cl::sub(DumpSubcommand)); cl::opt RawAll("all", cl::desc("Implies most other options."), - cl::cat(MiscOptions), cl::sub(RawSubcommand)); + cl::cat(MiscOptions), cl::sub(DumpSubcommand)); cl::list InputFilenames(cl::Positional, cl::desc(""), - cl::OneOrMore, cl::sub(RawSubcommand)); + cl::OneOrMore, cl::sub(DumpSubcommand)); } namespace yaml2pdb { @@ -620,7 +621,7 @@ static void dumpRaw(StringRef Path) { std::unique_ptr Session; auto &File = loadPDB(Path, Session); - auto O = llvm::make_unique(File); + auto O = llvm::make_unique(File); ExitOnErr(O->dump()); } @@ -896,43 +897,43 @@ int main(int argc_, const char *argv_[]) { llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argv.size(), argv.data(), "LLVM PDB Dumper\n"); - if (!opts::raw::DumpBlockRangeOpt.empty()) { + if (!opts::dump::DumpBlockRangeOpt.empty()) { llvm::Regex R("^([0-9]+)(-([0-9]+))?$"); llvm::SmallVector Matches; - if (!R.match(opts::raw::DumpBlockRangeOpt, &Matches)) { - errs() << "Argument '" << opts::raw::DumpBlockRangeOpt + if (!R.match(opts::dump::DumpBlockRangeOpt, &Matches)) { + errs() << "Argument '" << opts::dump::DumpBlockRangeOpt << "' invalid format.\n"; errs().flush(); exit(1); } - opts::raw::DumpBlockRange.emplace(); - Matches[1].getAsInteger(10, opts::raw::DumpBlockRange->Min); + opts::dump::DumpBlockRange.emplace(); + Matches[1].getAsInteger(10, opts::dump::DumpBlockRange->Min); if (!Matches[3].empty()) { - opts::raw::DumpBlockRange->Max.emplace(); - Matches[3].getAsInteger(10, *opts::raw::DumpBlockRange->Max); + opts::dump::DumpBlockRange->Max.emplace(); + Matches[3].getAsInteger(10, *opts::dump::DumpBlockRange->Max); } } - if (opts::RawSubcommand) { - if (opts::raw::RawAll) { - opts::raw::DumpLines = true; - opts::raw::DumpInlineeLines = true; - opts::raw::DumpXme = true; - opts::raw::DumpXmi = true; - opts::raw::DumpIds = true; - opts::raw::DumpPublics = true; - opts::raw::DumpSectionContribs = true; - opts::raw::DumpSectionMap = true; - opts::raw::DumpStreams = true; - opts::raw::DumpStringTable = true; - opts::raw::DumpSummary = true; - opts::raw::DumpSymbols = true; - opts::raw::DumpIds = true; - opts::raw::DumpIdExtras = true; - opts::raw::DumpTypes = true; - opts::raw::DumpTypeExtras = true; - opts::raw::DumpModules = true; - opts::raw::DumpModuleFiles = true; + if (opts::DumpSubcommand) { + if (opts::dump::RawAll) { + opts::dump::DumpLines = true; + opts::dump::DumpInlineeLines = true; + opts::dump::DumpXme = true; + opts::dump::DumpXmi = true; + opts::dump::DumpIds = true; + opts::dump::DumpPublics = true; + opts::dump::DumpSectionContribs = true; + opts::dump::DumpSectionMap = true; + opts::dump::DumpStreams = true; + opts::dump::DumpStringTable = true; + opts::dump::DumpSummary = true; + opts::dump::DumpSymbols = true; + opts::dump::DumpIds = true; + opts::dump::DumpIdExtras = true; + opts::dump::DumpTypes = true; + opts::dump::DumpTypeExtras = true; + opts::dump::DumpModules = true; + opts::dump::DumpModuleFiles = true; } } if (opts::PdbToYamlSubcommand) { @@ -1014,9 +1015,9 @@ int main(int argc_, const char *argv_[]) { } std::for_each(opts::pretty::InputFilenames.begin(), opts::pretty::InputFilenames.end(), dumpPretty); - } else if (opts::RawSubcommand) { - std::for_each(opts::raw::InputFilenames.begin(), - opts::raw::InputFilenames.end(), dumpRaw); + } else if (opts::DumpSubcommand) { + std::for_each(opts::dump::InputFilenames.begin(), + opts::dump::InputFilenames.end(), dumpRaw); } else if (opts::DiffSubcommand) { if (opts::diff::InputFilenames.size() != 2) { errs() << "diff subcommand expects exactly 2 arguments.\n"; diff --git a/tools/llvm-pdbutil/llvm-pdbutil.h b/tools/llvm-pdbutil/llvm-pdbutil.h index a939564265c..c18d1b79549 100644 --- a/tools/llvm-pdbutil/llvm-pdbutil.h +++ b/tools/llvm-pdbutil/llvm-pdbutil.h @@ -92,7 +92,7 @@ extern llvm::cl::opt ClassFormat; extern llvm::cl::opt ClassRecursionDepth; } -namespace raw { +namespace dump { struct BlockRange { uint32_t Min; llvm::Optional Max; -- 2.40.0