* objdump.c (main) :Accept multiple -M switch.

* doc/binutils.texi: Document that multiple -M switches are accepted and that
  a single -M switch can contain comma separated options.
* arm-dis.c (parse_arm_disassembler_option): Do not expect option string to be
  NUL terminated.
  (parse_disassembler_options): Allow options to be space or comma separated.
This commit is contained in:
Nick Clifton 2003-07-18 11:34:41 +00:00
parent 278a7cf7f0
commit 31e0f3cd45
5 changed files with 37 additions and 33 deletions

View file

@ -1,3 +1,10 @@
2003-07-18 Nick Clifton <nickc@redhat.com>
* objdump.c (main) :Accept multiple -M switch.
* doc/binutils.texi: Document that multiple -M switches are
accepted and that a single -M switch can contain comma
separated options.
2003-07-17 Nick Clifton <nickc@redhat.com> 2003-07-17 Nick Clifton <nickc@redhat.com>
* objdump.c (main): Issue a warning message if multiple -M * objdump.c (main): Issue a warning message if multiple -M

View file

@ -1625,15 +1625,9 @@ architectures with the @option{-i} option.
@item -M @var{options} @item -M @var{options}
@itemx --disassembler-options=@var{options} @itemx --disassembler-options=@var{options}
Pass target specific information to the disassembler. Only supported on Pass target specific information to the disassembler. Only supported on
some targets. Note only a single instance of the option on the some targets. If it is necessary to specify more than one
command line is supported. If the option occurs more than once, the disassembler option then multiple @option{-M} options can be used or
earlier versions will be ignored. If it is necessary to specify more can be placed together into a comma separated list.
than one disassembler option then they should be placed together into
a space separated list. ie:
@smallexample
-M"first-disassembler-option second-disassembler-option"
@end smallexample
If the target is an ARM architecture then this switch can be used to If the target is an ARM architecture then this switch can be used to
select which register name set is used during disassembler. Specifying select which register name set is used during disassembler. Specifying

View file

@ -2661,12 +2661,10 @@ main (argc, argv)
break; break;
case 'M': case 'M':
if (disassembler_options) if (disassembler_options)
{ /* Ignore potential memory leak for now. */
non_fatal ("multiple separate -M options are not supported."); disassembler_options = concat (disassembler_options, ",", optarg, NULL);
non_fatal ("please combine them into a single, space separated option."); else
non_fatal ("ignoring option '-M%s'", disassembler_options); disassembler_options = optarg;
}
disassembler_options = optarg;
break; break;
case 'j': case 'j':
if (only == NULL) if (only == NULL)

View file

@ -1,3 +1,10 @@
2003-07-18 Nick Clifton <nickc@redhat.com>
* arm-dis.c (parse_arm_disassembler_option): Do not expect
option string to be NUL terminated.
(parse_disassembler_options): Allow options to be space or
comma separated.
2003-07-17 Nick Clifton <nickc@redhat.com> 2003-07-17 Nick Clifton <nickc@redhat.com>
* po/es.po: New Spanish translation. * po/es.po: New Spanish translation.

View file

@ -27,6 +27,7 @@
#include "coff/internal.h" #include "coff/internal.h"
#include "libcoff.h" #include "libcoff.h"
#include "opintl.h" #include "opintl.h"
#include "safe-ctype.h"
/* FIXME: This shouldn't be done here. */ /* FIXME: This shouldn't be done here. */
#include "elf-bfd.h" #include "elf-bfd.h"
@ -1152,51 +1153,48 @@ parse_arm_disassembler_option (option)
option += 10; option += 10;
for (i = NUM_ARM_REGNAMES; i--;) for (i = NUM_ARM_REGNAMES; i--;)
if (streq (option, regnames[i].name)) if (strneq (option, regnames[i].name, strlen (regnames[i].name)))
{ {
regname_selected = i; regname_selected = i;
break; break;
} }
if (i < 0) if (i < 0)
/* XXX - should break 'option' at following delimiter. */
fprintf (stderr, _("Unrecognised register name set: %s\n"), option); fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
} }
else if (streq (option, "force-thumb")) else if (strneq (option, "force-thumb", 11))
force_thumb = 1; force_thumb = 1;
else if (streq (option, "no-force-thumb")) else if (strneq (option, "no-force-thumb", 14))
force_thumb = 0; force_thumb = 0;
else else
/* XXX - should break 'option' at following delimiter. */
fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option); fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
return; return;
} }
/* Parse the string of disassembler options, spliting it at whitespaces. */ /* Parse the string of disassembler options, spliting it at whitespaces
or commas. (Whitespace separators supported for backwards compatibility). */
static void static void
parse_disassembler_options (options) parse_disassembler_options (options)
char * options; char * options;
{ {
char * space;
if (options == NULL) if (options == NULL)
return; return;
do while (*options)
{ {
space = strchr (options, ' '); parse_arm_disassembler_option (options);
if (space) /* Skip forward to next seperator. */
{ while ((*options) && (! ISSPACE (*options)) && (*options != ','))
* space = '\0'; ++ options;
parse_arm_disassembler_option (options); /* Skip forward past seperators. */
* space = ' '; while (ISSPACE (*options) || (*options == ','))
options = space + 1; ++ options;
}
else
parse_arm_disassembler_option (options);
} }
while (space);
} }
/* NOTE: There are no checks in these routines that /* NOTE: There are no checks in these routines that