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.
| 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;
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);
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);
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;
}
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;
}