mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 15:17:13 +08:00
* readelf.c (struct dump_list_entry, request_dump_byname)
(initialise_dumps_byname): New. (parse_args): Call request_dump_byname. (process_section_contents): Call initialise_dumps_byname. * doc/binutils.texi (readelf): Mention -x NAME. * NEWS: Likewise.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2005-11-14 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* readelf.c (struct dump_list_entry, request_dump_byname)
|
||||||
|
(initialise_dumps_byname): New.
|
||||||
|
(parse_args): Call request_dump_byname.
|
||||||
|
(process_section_contents): Call initialise_dumps_byname.
|
||||||
|
* doc/binutils.texi (readelf): Mention -x NAME.
|
||||||
|
* NEWS: Likewise.
|
||||||
|
|
||||||
2005-11-11 Nick Clifton <nickc@redhat.com>
|
2005-11-11 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR 1150
|
PR 1150
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
-*- text -*-
|
-*- text -*-
|
||||||
|
|
||||||
|
* Add "-x NAME" to readelf in addition to "-x NUMBER".
|
||||||
|
|
||||||
* Add -i and -t switches to cxxfilt. -i disables the display of implementation
|
* Add -i and -t switches to cxxfilt. -i disables the display of implementation
|
||||||
specific extra demangling information (if any) and -t disables the demangling
|
specific extra demangling information (if any) and -t disables the demangling
|
||||||
of types.
|
of types.
|
||||||
|
@ -3324,7 +3324,7 @@ readelf [@option{-a}|@option{--all}]
|
|||||||
[@option{-V}|@option{--version-info}]
|
[@option{-V}|@option{--version-info}]
|
||||||
[@option{-A}|@option{--arch-specific}]
|
[@option{-A}|@option{--arch-specific}]
|
||||||
[@option{-D}|@option{--use-dynamic}]
|
[@option{-D}|@option{--use-dynamic}]
|
||||||
[@option{-x} <number>|@option{--hex-dump=}<number>]
|
[@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
|
||||||
[@option{-w[liaprmfFsoR]}|
|
[@option{-w[liaprmfFsoR]}|
|
||||||
@option{--debug-dump}[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]]
|
@option{--debug-dump}[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]]
|
||||||
[@option{-I}|@option{-histogram}]
|
[@option{-I}|@option{-histogram}]
|
||||||
@ -3444,9 +3444,11 @@ When displaying symbols, this option makes @command{readelf} use the
|
|||||||
symbol table in the file's dynamic section, rather than the one in the
|
symbol table in the file's dynamic section, rather than the one in the
|
||||||
symbols section.
|
symbols section.
|
||||||
|
|
||||||
@item -x <number>
|
@item -x <number or name>
|
||||||
@itemx --hex-dump=<number>
|
@itemx --hex-dump=<number or name>
|
||||||
Displays the contents of the indicated section as a hexadecimal dump.
|
Displays the contents of the indicated section as a hexadecimal dump.
|
||||||
|
A number identifies a particular section by index in the section table;
|
||||||
|
any other string identifies all sections with that name in the object file.
|
||||||
|
|
||||||
@item -w[liaprmfFsoR]
|
@item -w[liaprmfFsoR]
|
||||||
@itemx --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]
|
@itemx --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges]
|
||||||
|
@ -177,6 +177,16 @@ static size_t group_count;
|
|||||||
static struct group *section_groups;
|
static struct group *section_groups;
|
||||||
static struct group **section_headers_groups;
|
static struct group **section_headers_groups;
|
||||||
|
|
||||||
|
/* A linked list of the section names for which dumps were requested
|
||||||
|
by name. */
|
||||||
|
struct dump_list_entry
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
int type;
|
||||||
|
struct dump_list_entry *next;
|
||||||
|
};
|
||||||
|
static struct dump_list_entry *dump_sects_byname;
|
||||||
|
|
||||||
/* A dynamic array of flags indicating for which sections a hex dump
|
/* A dynamic array of flags indicating for which sections a hex dump
|
||||||
has been requested (via the -x switch) and/or a disassembly dump
|
has been requested (via the -x switch) and/or a disassembly dump
|
||||||
(via the -i switch). */
|
(via the -i switch). */
|
||||||
@ -185,8 +195,9 @@ unsigned num_cmdline_dump_sects = 0;
|
|||||||
|
|
||||||
/* A dynamic array of flags indicating for which sections a dump of
|
/* A dynamic array of flags indicating for which sections a dump of
|
||||||
some kind has been requested. It is reset on a per-object file
|
some kind has been requested. It is reset on a per-object file
|
||||||
basis and then initialised from the cmdline_dump_sects array and
|
basis and then initialised from the cmdline_dump_sects array,
|
||||||
the results of interpreting the -w switch. */
|
the results of interpreting the -w switch, and the
|
||||||
|
dump_sects_byname list. */
|
||||||
char *dump_sects = NULL;
|
char *dump_sects = NULL;
|
||||||
unsigned int num_dump_sects = 0;
|
unsigned int num_dump_sects = 0;
|
||||||
|
|
||||||
@ -2658,6 +2669,27 @@ request_dump (unsigned int section, int type)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Request a dump by section name. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
request_dump_byname (const char *section, int type)
|
||||||
|
{
|
||||||
|
struct dump_list_entry *new_request;
|
||||||
|
|
||||||
|
new_request = malloc (sizeof (struct dump_list_entry));
|
||||||
|
if (!new_request)
|
||||||
|
error (_("Out of memory allocating dump request table."));
|
||||||
|
|
||||||
|
new_request->name = strdup (section);
|
||||||
|
if (!new_request->name)
|
||||||
|
error (_("Out of memory allocating dump request table."));
|
||||||
|
|
||||||
|
new_request->type = type;
|
||||||
|
|
||||||
|
new_request->next = dump_sects_byname;
|
||||||
|
dump_sects_byname = new_request;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_args (int argc, char **argv)
|
parse_args (int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -2745,11 +2777,10 @@ parse_args (int argc, char **argv)
|
|||||||
do_dump++;
|
do_dump++;
|
||||||
section = strtoul (optarg, & cp, 0);
|
section = strtoul (optarg, & cp, 0);
|
||||||
if (! *cp && section >= 0)
|
if (! *cp && section >= 0)
|
||||||
{
|
request_dump (section, HEX_DUMP);
|
||||||
request_dump (section, HEX_DUMP);
|
else
|
||||||
break;
|
request_dump_byname (optarg, HEX_DUMP);
|
||||||
}
|
break;
|
||||||
goto oops;
|
|
||||||
case 'w':
|
case 'w':
|
||||||
do_dump++;
|
do_dump++;
|
||||||
if (optarg == 0)
|
if (optarg == 0)
|
||||||
@ -2913,7 +2944,9 @@ parse_args (int argc, char **argv)
|
|||||||
do_wide++;
|
do_wide++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
#ifdef SUPPORT_DISASSEMBLY
|
||||||
oops:
|
oops:
|
||||||
|
#endif
|
||||||
/* xgettext:c-format */
|
/* xgettext:c-format */
|
||||||
error (_("Invalid option '-%c'\n"), c);
|
error (_("Invalid option '-%c'\n"), c);
|
||||||
/* Drop through. */
|
/* Drop through. */
|
||||||
@ -7547,6 +7580,32 @@ display_debug_section (Elf_Internal_Shdr *section, FILE *file)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set DUMP_SECTS for all sections where dumps were requested
|
||||||
|
based on section name. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
initialise_dumps_byname (void)
|
||||||
|
{
|
||||||
|
struct dump_list_entry *cur;
|
||||||
|
|
||||||
|
for (cur = dump_sects_byname; cur; cur = cur->next)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
int any;
|
||||||
|
|
||||||
|
for (i = 0, any = 0; i < elf_header.e_shnum; i++)
|
||||||
|
if (streq (SECTION_NAME (section_headers + i), cur->name))
|
||||||
|
{
|
||||||
|
request_dump (i, cur->type);
|
||||||
|
any = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!any)
|
||||||
|
warn (_("Section '%s' was not dumped because it does not exist!\n"),
|
||||||
|
cur->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_section_contents (FILE *file)
|
process_section_contents (FILE *file)
|
||||||
{
|
{
|
||||||
@ -7556,6 +7615,8 @@ process_section_contents (FILE *file)
|
|||||||
if (! do_dump)
|
if (! do_dump)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
initialise_dumps_byname ();
|
||||||
|
|
||||||
for (i = 0, section = section_headers;
|
for (i = 0, section = section_headers;
|
||||||
i < elf_header.e_shnum && i < num_dump_sects;
|
i < elf_header.e_shnum && i < num_dump_sects;
|
||||||
i++, section++)
|
i++, section++)
|
||||||
|
Reference in New Issue
Block a user