summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2009-01-23 16:10:44 -0800
committerUlrich Drepper <[email protected]>2009-01-23 16:10:44 -0800
commitd7285e190a2d84b4120f5230320124bfa517e1c7 (patch)
tree10a98b1ef2172c02ec7f2f96ed70b2ec3f3bb2d4
parent7a2a59144d6de340e8f4a3340a6bf3f5a4ac6dcd (diff)
Print .strtab, .dynstr, and .comment for -a option of readelf.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/readelf.c24
2 files changed, 22 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index da35a668..30fdb07b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-23 Ulrich Drepper <[email protected]>
+
+ * readelf.c (parse_opt): Move code to add to dump_data_sections and
+ string_sections list in local function add_dump_section. Adjust 'x'
+ key handling. For 'a' key add .strtab, .dynstr, and .comment section
+ to string_sections list.
+
2009-01-22 Roland McGrath <[email protected]>
* readelf.c (print_phdr): Don't print section mapping when no sections.
diff --git a/src/readelf.c b/src/readelf.c
index d5a3b8d4..88eb9a7c 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -275,6 +275,17 @@ static error_t
parse_opt (int key, char *arg,
struct argp_state *state __attribute__ ((unused)))
{
+ void add_dump_section (const char *name)
+ {
+ struct section_argument *a = xmalloc (sizeof *a);
+ a->arg = name;
+ a->next = NULL;
+ struct section_argument ***tailp
+ = key == 'x' ? &dump_data_sections_tail : &string_sections_tail;
+ **tailp = a;
+ *tailp = &a->next;
+ }
+
switch (key)
{
case 'a':
@@ -290,6 +301,9 @@ parse_opt (int key, char *arg,
print_arch = true;
print_notes = true;
print_debug_sections |= section_exception;
+ add_dump_section (".strtab");
+ add_dump_section (".dynstr");
+ add_dump_section (".comment");
any_control_option = true;
break;
case 'A':
@@ -387,15 +401,7 @@ parse_opt (int key, char *arg,
}
/* Fall through. */
case 'x':
- {
- struct section_argument *a = xmalloc (sizeof *a);
- a->arg = arg;
- a->next = NULL;
- struct section_argument ***tailp
- = key == 'x' ? &dump_data_sections_tail : &string_sections_tail;
- **tailp = a;
- *tailp = &a->next;
- }
+ add_dump_section (arg);
any_control_option = true;
break;
case ARGP_KEY_NO_ARGS: