summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2010-01-04 20:36:10 -0800
committerRoland McGrath <[email protected]>2010-01-04 20:36:10 -0800
commit2e79deb2cb049f3b0f3f45680dfe956cf99b25d8 (patch)
treebeb0939da3ef8cf766b9b1a179e798cf27fbdce1
parenta7422be8221f4600505dc7e9aebad6ce577f0081 (diff)
readelf: No complaints for missing DWARF under just -a.
-rw-r--r--src/ChangeLog5
-rw-r--r--src/readelf.c14
2 files changed, 13 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 01c1ef64..c03f0b45 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2010-01-04 Roland McGrath <[email protected]>
+ * 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 e2807e6c..ffd7ff45 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;
}