summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-09-15 22:47:16 +0000
committerAdrian Prantl <aprantl@apple.com>2017-09-15 22:47:16 +0000
commitb5abcc558d4a1b53e3efbd4d26a8fd0d6676130e (patch)
treee800cb189841ba5f826be4faf5e4f09877ba4d84 /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
parentfb5d284e976ed39bd1a0a7d7032a5e77adb2c60e (diff)
downloadbcm5719-llvm-b5abcc558d4a1b53e3efbd4d26a8fd0d6676130e.tar.gz
bcm5719-llvm-b5abcc558d4a1b53e3efbd4d26a8fd0d6676130e.zip
Revert "llvm-dwarfdump: Add support for -debug-info=<offset>."
This reverts commit r313412 because of a g++ incompatibility. llvm-svn: 313413
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r--llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp83
1 files changed, 10 insertions, 73 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 7671bd8adaf..823eb8e8133 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -37,59 +37,8 @@
using namespace llvm;
using namespace object;
-/// Parser for options that take an optional offest argument.
-/// @{
-struct OffsetOption {
- uint64_t Val = 0;
- bool HasValue = false;
- bool IsRequested = false;
-};
-
-template <>
-class cl::parser<OffsetOption> final : public cl::basic_parser<OffsetOption> {
-public:
- parser(Option &O) : basic_parser(O) {}
-
- /// Return true on error.
- bool parse(Option &O, StringRef ArgName, StringRef Arg, OffsetOption &Val) {
- if (Arg == "") {
- Val.Val = 0;
- Val.HasValue = false;
- Val.IsRequested = true;
- return false;
- }
- if (Arg.getAsInteger(0, Val.Val))
- return O.error("'" + Arg + "' value invalid for integer argument!");
- Val.HasValue = true;
- Val.IsRequested = true;
- return false;
- }
-
- enum ValueExpected getValueExpectedFlagDefault() const {
- return ValueOptional;
- }
-
- void printOptionInfo(const Option &O, size_t GlobalWidth) const {
- outs() << " -" << O.ArgStr;
- Option::printHelpStr(O.HelpStr, GlobalWidth, getOptionWidth(O));
- }
-
- void printOptionDiff(const Option &O, OffsetOption V, OptVal Default,
- size_t GlobalWidth) const {
- printOptionName(O, GlobalWidth);
- outs() << "[=offset]";
- }
-
- // An out-of-line virtual method to provide a 'home' for this class.
- void anchor() override {};
-};
-
-/// @}
-/// Command line options.
-/// @{
-
namespace {
-using namespace cl;
+using namespace llvm::cl;
OptionCategory DwarfDumpCategory("Specific Options");
static opt<bool> Help("h", desc("Alias for -help"), Hidden,
@@ -98,26 +47,20 @@ static list<std::string>
InputFilenames(Positional, desc("<input object files or .dSYM bundles>"),
ZeroOrMore, cat(DwarfDumpCategory));
-cl::OptionCategory SectionCategory("Section-specific Dump Options",
- "These control which sections are dumped. "
- "Where applicable these parameters take an "
- "optional =<offset> argument to dump only "
- "the entry at the specified offset.");
-
+cl::OptionCategory
+ SectionCategory("Section-specific Dump Options",
+ "These control which sections are dumped.");
static opt<bool> DumpAll("all", desc("Dump all debug info sections"),
cat(SectionCategory));
static alias DumpAllAlias("a", desc("Alias for -all"), aliasopt(DumpAll));
-// Options for dumping specific sections.
static unsigned DumpType = DIDT_Null;
-static std::array<Optional<uint64_t>, DIDT_ID_Count> DumpOffsets;
#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME) \
- static opt<OffsetOption> Dump##ENUM_NAME( \
- CMDLINE_NAME, desc("Dump the " ELF_NAME " section"), \
- cat(SectionCategory));
+ static opt<bool> Dump##ENUM_NAME(CMDLINE_NAME, \
+ desc("Dump the " ELF_NAME " section"), \
+ cat(SectionCategory));
#include "llvm/BinaryFormat/Dwarf.def"
#undef HANDLE_DWARF_SECTION
-
static opt<bool> DumpUUID("uuid", desc("Show the UUID for each architecture"),
cat(DwarfDumpCategory));
static alias DumpUUIDAlias("u", desc("Alias for -uuid"), aliasopt(DumpUUID));
@@ -135,9 +78,6 @@ static opt<bool> Verbose("verbose",
static alias VerboseAlias("v", desc("Alias for -verbose"), aliasopt(Verbose),
cat(DwarfDumpCategory));
} // namespace
-/// @}
-//===----------------------------------------------------------------------===//
-
static void error(StringRef Filename, std::error_code EC) {
if (!EC)
@@ -163,7 +103,7 @@ static bool dumpObjectFile(ObjectFile &Obj, Twine Filename) {
outs() << Filename << ":\tfile format " << Obj.getFileFormatName() << '\n';
// Dump the complete DWARF structure.
- DICtx->dump(outs(), getDumpOpts(), DumpOffsets);
+ DICtx->dump(outs(), getDumpOpts());
return true;
}
@@ -297,11 +237,8 @@ int main(int argc, char **argv) {
// Defaults to dumping all sections, unless brief mode is specified in which
// case only the .debug_info section in dumped.
#define HANDLE_DWARF_SECTION(ENUM_NAME, ELF_NAME, CMDLINE_NAME) \
- if (Dump##ENUM_NAME.IsRequested) { \
- DumpType |= DIDT_##ENUM_NAME; \
- if (Dump##ENUM_NAME.HasValue) \
- DumpOffsets[DIDT_ID_##ENUM_NAME] = Dump##ENUM_NAME.Val; \
- }
+ if (Dump##ENUM_NAME) \
+ DumpType |= DIDT_##ENUM_NAME;
#include "llvm/BinaryFormat/Dwarf.def"
#undef HANDLE_DWARF_SECTION
if (DumpUUID)
OpenPOWER on IntegriCloud