+2003-04-30 H.J. Lu <hjl@gnu.org>
+
+ * 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 <dpaun@rogers.com>
* doc/binutils.texi: Fix the documentation for the -fo option.
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 */
&& 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
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)
{
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)
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)
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;