summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2017-08-31 16:44:47 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2017-08-31 16:44:47 +0000
commit8ac8df03c10c98b1f782b4e0df201361ee4ee067 (patch)
tree96b2a78fc0d0d333cba240380a0247aa2f31a4b3 /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
parent0148e6f3919356435cb0ce604226d30d64941870 (diff)
downloadbcm5719-llvm-8ac8df03c10c98b1f782b4e0df201361ee4ee067.tar.gz
bcm5719-llvm-8ac8df03c10c98b1f782b4e0df201361ee4ee067.zip
[llvm-dwarfdump] Brief mode only dumps debug_info by default
This patch changes the default behavior in brief mode to only show the debug_info section. This is undoubtedly the most popular and likely the one you'd want in brief mode. Non-brief mode behavior is not affected and still defaults to all. Differential revision: https://reviews.llvm.org/D37334 llvm-svn: 312252
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r--llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 2eb433ab3ce..39a035d8129 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -41,7 +41,7 @@ InputFilenames(cl::Positional, cl::desc("<input object files or .dSYM bundles>")
cl::ZeroOrMore);
static cl::opt<DIDumpType> DumpType(
- "debug-dump", cl::init(DIDT_All), cl::desc("Dump of debug sections:"),
+ "debug-dump", cl::init(DIDT_Null), cl::desc("Dump of debug sections:"),
cl::values(
clEnumValN(DIDT_All, "all", "Dump all debug sections"),
clEnumValN(DIDT_Abbrev, "abbrev", ".debug_abbrev"),
@@ -154,12 +154,12 @@ static bool VerifyInput(StringRef Filename) {
MemoryBuffer::getFileOrSTDIN(Filename);
error(Filename, BuffOrErr.getError());
std::unique_ptr<MemoryBuffer> Buff = std::move(BuffOrErr.get());
-
+
Expected<std::unique_ptr<Binary>> BinOrErr =
object::createBinary(Buff->getMemBufferRef());
if (!BinOrErr)
error(Filename, errorToErrorCode(BinOrErr.takeError()));
-
+
bool Result = true;
if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get()))
Result = VerifyObjectFile(*Obj, Filename);
@@ -217,6 +217,15 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n");
+ // Defaults to dumping all sections, unless brief mode is specified in which
+ // case only the .debug_info section in dumped.
+ if (DumpType == DIDT_Null) {
+ if (Brief)
+ DumpType = DIDT_Info;
+ else
+ DumpType = DIDT_All;
+ }
+
// Defaults to a.out if no filenames specified.
if (InputFilenames.size() == 0)
InputFilenames.push_back("a.out");
OpenPOWER on IntegriCloud