<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 31, 2017 at 7:32 AM Jonas Devlieghere via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">JDevlieghere created this revision.<br>
<br>
This patch changes the default behavior in brief mode to only show the<br>
debug_info section. This is undoubtedly the most popular and likely the<br>
one you'd want in brief mode.<br>
<br>
Non-brief mode behavior is not affected and still defaults to all.<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D37334" rel="noreferrer" target="_blank">https://reviews.llvm.org/D37334</a><br>
<br>
Files:<br>
  test/tools/llvm-dwarfdump/X86/brief.s<br>
  tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
<br>
<br>
Index: tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
===================================================================<br>
--- tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
+++ tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
@@ -41,7 +41,7 @@<br>
                cl::ZeroOrMore);<br>
<br>
 static cl::opt<DIDumpType> DumpType(<br>
-    "debug-dump", cl::init(DIDT_All), cl::desc("Dump of debug sections:"),<br>
+    "debug-dump", cl::init(DIDT_Null), cl::desc("Dump of debug sections:"),<br>
     cl::values(<br>
         clEnumValN(DIDT_All, "all", "Dump all debug sections"),<br>
         clEnumValN(DIDT_Abbrev, "abbrev", ".debug_abbrev"),<br>
@@ -154,12 +154,12 @@<br>
   MemoryBuffer::getFileOrSTDIN(Filename);<br>
   error(Filename, BuffOrErr.getError());<br>
   std::unique_ptr<MemoryBuffer> Buff = std::move(BuffOrErr.get());<br>
-<br>
+<br>
   Expected<std::unique_ptr<Binary>> BinOrErr =<br>
   object::createBinary(Buff->getMemBufferRef());<br>
   if (!BinOrErr)<br>
     error(Filename, errorToErrorCode(BinOrErr.takeError()));<br>
-<br>
+<br>
   bool Result = true;<br>
   if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get()))<br>
     Result = VerifyObjectFile(*Obj, Filename);<br>
@@ -217,6 +217,15 @@<br>
<br>
   cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n");<br>
<br>
+  // Defaults to dumping all sections, unless brief mode is specified in which<br>
+  // case only the .debug_info section in dumped.<br>
+  if (DumpType == DIDT_Null) {<br>
+    if (Brief)<br>
+      DumpType = DIDT_Info;<br>
+    else<br>
+      DumpType = DIDT_All;<br>
+  }<br>
+<br>
   // Defaults to a.out if no filenames specified.<br>
   if (InputFilenames.size() == 0)<br>
     InputFilenames.push_back("a.out");<br>
Index: test/tools/llvm-dwarfdump/X86/brief.s<br>
===================================================================<br>
--- test/tools/llvm-dwarfdump/X86/brief.s<br>
+++ test/tools/llvm-dwarfdump/X86/brief.s<br>
@@ -2,12 +2,39 @@<br>
 # RUN: | llvm-dwarfdump -debug-dump=info -brief - \<br>
 # RUN: | FileCheck %s<br>
<br>
+# CHECK-NOT: .debug_abbrev contents<br>
+#<br>
+# CHECK: .debug_info contents<br>
 # CHECK: DW_TAG_compile_unit<br>
 # CHECK-NOT: DW_FORM<br>
-# CHECK: DW_AT<br>
+# CHECK: DW_AT_name        ("brief.c")<br>
+# CHECK: DW_AT_name      ("main")<br>
+# CHECK: DW_AT_name      ("int")<br>
 # CHECK-NOT: debug_str<br>
 # CHECK-NOT: DW_AT_type {{.*}} =><br>
-<br>
+#<br>
+# CHECK-NOT: .debug_abbrev.dwo contents<br>
+# CHECK-NOT: .debug_abbrev.dwo contents<br>
+# CHECK-NOT: .debug_loc contents:<br>
+# CHECK-NOT: .debug_loc.dwo contents:<br>
+# CHECK-NOT: .debug_frame contents:<br>
+# CHECK-NOT: .debug_macinfo contents:<br>
+# CHECK-NOT: .debug_aranges contents:<br>
+# CHECK-NOT: .debug_line contents:<br>
+# CHECK-NOT: .debug_cu_index contents:<br>
+# CHECK-NOT: .debug_tu_index contents:<br>
+# CHECK-NOT: .debug_line.dwo contents:<br>
+# CHECK-NOT: .debug_str contents:<br>
+# CHECK-NOT: .debug_ranges contents:<br>
+# CHECK-NOT: .debug_pubnames contents:<br>
+# CHECK-NOT: .debug_pubtypes contents:<br>
+# CHECK-NOT: .debug_gnu_pubnames contents:<br>
+# CHECK-NOT: .debug_gnu_pubtypes contents:<br>
+# CHECK-NOT: .apple_names contents:<br>
+# CHECK-NOT: .apple_types contents:<br>
+# CHECK-NOT: .apple_namespaces contents:<br>
+# CHECK-NOT: .apple_objc contents:<br></blockquote><div><br>Maybe this ^ should just be a single "CHECK-NOT: contents:" ?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+#<br>
 # This test is meant to verify that -brief hides DW_FORMs and abbreviation<br>
 # codes from .debug_info section. Furthermore it verifies that it also hides<br>
 # .debug_str and die reference offsets into the CU.<br>
<br>
<br>
</blockquote></div></div>