From: H.J. Lu Date: Thu, 1 May 2003 00:40:41 +0000 (+0000) Subject: 2003-04-30 H.J. Lu X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6e50c90cfed6946b6c4c63ae93d7a6d07117f7b2;p=binutils-gdb.git 2003-04-30 H.J. Lu * objdump.c (only): Change it to char **. (only_size): New. (only_used): New. (disassemble_data): Check only as an array. (dump_data): Likewise. (dump_relocs): Likewise. (main): Treat only as an array. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 5df0dc8d36c..807421d7eaa 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,13 @@ +2003-04-30 H.J. Lu + + * objdump.c (only): Change it to char **. + (only_size): New. + (only_used): New. + (disassemble_data): Check only as an array. + (dump_data): Likewise. + (dump_relocs): Likewise. + (main): Treat only as an array. + 2003-04-24 Dimitrie O. Paun * doc/binutils.texi: Fix the documentation for the -fo option. diff --git a/binutils/objdump.c b/binutils/objdump.c index 3c927bd7ae9..f17286c9b45 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -67,7 +67,9 @@ static bfd_boolean disassemble; /* -d */ static bfd_boolean disassemble_all; /* -D */ static int disassemble_zeroes; /* --disassemble-zeroes */ static bfd_boolean formats_info; /* -i */ -static char *only; /* -j secname */ +static char **only; /* -j secname */ +static size_t only_size = 0; +static size_t only_used = 0; static int wide_output; /* -w */ static bfd_vma start_address = (bfd_vma) -1; /* --start-address */ static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */ @@ -1628,8 +1630,18 @@ disassemble_data (abfd) && only == NULL && (section->flags & SEC_CODE) == 0)) continue; - if (only != (char *) NULL && strcmp (only, section->name) != 0) - continue; + + if (only != NULL) + { + size_t i; + + for (i = 0; i < only_used; i++) + if (strcmp (only [i], section->name) == 0) + break; + + if (i == only_used) + continue; + } if ((section->flags & SEC_RELOC) != 0 #ifndef DISASSEMBLER_NEEDS_RELOCS @@ -2221,9 +2233,13 @@ dump_data (abfd) section->next) { int onaline = 16; + size_t i; - if (only == (char *) NULL || - strcmp (only, section->name) == 0) + for (i = 0; i < only_used; i++) + if (strcmp (only [i], section->name) == 0) + break; + + if (only_used == 0 || i != only_used) { if (section->flags & SEC_HAS_CONTENTS) { @@ -2286,7 +2302,7 @@ dump_data (abfd) bfd_sprintf_vma (abfd, buf, (addr_offset + section->vma)); count = strlen (buf); - if (count >= sizeof (buf)) + if ((size_t) count >= sizeof (buf)) abort (); putchar (' '); while (count < width) @@ -2411,7 +2427,13 @@ dump_relocs (abfd) if (only) { - if (strcmp (only, a->name)) + size_t i; + + for (i = 0; i < only_used; i++) + if (strcmp (only [i], a->name) == 0) + break; + + if (i == only_used) continue; } else if ((a->flags & SEC_RELOC) == 0) @@ -2641,7 +2663,18 @@ main (argc, argv) disassembler_options = optarg; break; case 'j': - only = optarg; + if (only == NULL) + { + only_size = 8; + only = (char **) xmalloc (only_size * sizeof (char *)); + } + else if (only_used == only_size) + { + only_size += 8; + only = (char **) xrealloc (only, + only_size * sizeof (char *)); + } + only [only_used++] = optarg; break; case 'l': with_line_numbers = TRUE;