From: Ulrich Drepper Date: Sat, 24 Jan 2009 00:10:44 +0000 (-0800) Subject: Print .strtab, .dynstr, and .comment for -a option of readelf. X-Git-Tag: elfutils-0.140~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7285e190a2d84b4120f5230320124bfa517e1c7;p=thirdparty%2Felfutils.git Print .strtab, .dynstr, and .comment for -a option of readelf. --- diff --git a/src/ChangeLog b/src/ChangeLog index da35a6687..30fdb07b7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2009-01-23 Ulrich Drepper + + * 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 * readelf.c (print_phdr): Don't print section mapping when no sections. diff --git a/src/readelf.c b/src/readelf.c index d5a3b8d45..88eb9a7c8 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: