]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: No complaints for missing DWARF under just -a.
authorRoland McGrath <roland@redhat.com>
Tue, 5 Jan 2010 04:36:10 +0000 (20:36 -0800)
committerRoland McGrath <roland@redhat.com>
Tue, 5 Jan 2010 04:36:10 +0000 (20:36 -0800)
src/ChangeLog
src/readelf.c

index 01c1ef64dfc9a0bceabaac287e97d3476edf1542..c03f0b455b946ff2ce4561b4adbf338a07d8bbaa 100644 (file)
@@ -1,5 +1,10 @@
 2010-01-04  Roland McGrath  <roland@redhat.com>
 
+       * readelf.c (implicit_debug_sections): New variable.
+       (parse_opt): Set it instead of print_debug_sections for -a.
+       OR them together for print_debug check.
+       (print_debug): OR them together for section check.
+
        * readelf.c (options): Repartition into set implied by -a and others.
        Correct -a text to match reality.
 
index e2807e6c136b604972dce4274671e01a259ab8c8..ffd7ff458247c142c6a9a48fb2908470cffcada7 100644 (file)
@@ -191,7 +191,7 @@ static enum section_e
                 | section_info | section_line | section_loc
                 | section_pubnames | section_str | section_macinfo
                 | section_ranges | section_exception)
-} print_debug_sections;
+} print_debug_sections, implicit_debug_sections;
 
 /* Select hex dumping of sections.  */
 static struct section_argument *dump_data_sections;
@@ -312,7 +312,7 @@ parse_opt (int key, char *arg,
       print_histogram = true;
       print_arch = true;
       print_notes = true;
-      print_debug_sections |= section_exception;
+      implicit_debug_sections |= section_exception;
       add_dump_section (".strtab", true);
       add_dump_section (".dynstr", true);
       add_dump_section (".comment", true);
@@ -684,7 +684,7 @@ process_elf_file (Dwfl_Module *dwflmod, int fd)
     dump_data (pure_ebl);
   if (string_sections != NULL)
     dump_strings (ebl);
-  if (print_debug_sections != 0)
+  if ((print_debug_sections | implicit_debug_sections) != 0)
     print_debug (dwflmod, ebl, ehdr);
   if (print_notes)
     handle_notes (pure_ebl, ehdr);
@@ -6469,8 +6469,9 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
   Dwarf *dbg = dwfl_module_getdwarf (dwflmod, &dwbias);
   if (dbg == NULL)
     {
-      error (0, 0, gettext ("cannot get debug context descriptor: %s"),
-            dwfl_errmsg (-1));
+      if (print_debug_sections != 0)
+       error (0, 0, gettext ("cannot get debug context descriptor: %s"),
+              dwfl_errmsg (-1));
       return;
     }
 
@@ -6525,7 +6526,8 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
          for (n = 0; n < ndebug_sections; ++n)
            if (strcmp (name, debug_sections[n].name) == 0)
              {
-               if (print_debug_sections & debug_sections[n].bitmask)
+               if ((print_debug_sections | implicit_debug_sections)
+                   & debug_sections[n].bitmask)
                  debug_sections[n].fp (dwflmod, ebl, ehdr, scn, shdr, dbg);
                break;
              }