From: Roland McGrath Date: Tue, 5 Jan 2010 04:36:10 +0000 (-0800) Subject: readelf: No complaints for missing DWARF under just -a. X-Git-Tag: elfutils-0.144~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e79deb2cb049f3b0f3f45680dfe956cf99b25d8;p=thirdparty%2Felfutils.git readelf: No complaints for missing DWARF under just -a. --- diff --git a/src/ChangeLog b/src/ChangeLog index 01c1ef64d..c03f0b455 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2010-01-04 Roland McGrath + * 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. diff --git a/src/readelf.c b/src/readelf.c index e2807e6c1..ffd7ff458 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -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; }