public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Vincent Rubiolo <vincent.rubiolo@st.com>
To: nickc@redhat.com
Cc: binutils@sources.redhat.com
Subject: Re: [arnm-elf-objdump] Can't use two -M flags for disassembler [SOLVED]
Date: Wed, 23 Jul 2003 06:39:00 -0000	[thread overview]
Message-ID: <3F1ED70F.8010906@st.com> (raw)
In-Reply-To: <H0000cba187217e5.1058853947.eux100.sgp.st.com@MHS>

Hello !

Thanks to you all for you time and consideration concerning this problem. I am 
hereby applying the patch and building the new binutils.

Thank you very much Nick!

Regards,

Vincent

nickc@redhat.com wrote:

> Hi Guys,
> 
>   I am applying this patch which should fix the parsing of the -M
>   switch properly.
> 
>   It allows multiple -M switches on the command line, and it documents
>   that a single -M switch can contain comma separated target specific
>   options.  It also updates the arm disassembler to accept these comma
>   separated options.
> 
> Cheers
>         Nick
> 
> binutils/ChangeLog
> 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.
> 
> opcodes/ChangeLog
> 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.  
> 
> Index: binutils/objdump.c
> ===================================================================
> RCS file: /cvs/src/src/binutils/objdump.c,v
> retrieving revision 1.68
> diff -c -3 -p -r1.68 objdump.c
> *** binutils/objdump.c	17 Jul 2003 17:02:46 -0000	1.68
> --- binutils/objdump.c	18 Jul 2003 11:17:36 -0000
> *************** main (argc, argv)
> *** 2661,2672 ****
>   	  break;
>   	case 'M':
>   	  if (disassembler_options)
> ! 	    {
> ! 	      non_fatal ("multiple separate -M options are not supported.");
> ! 	      non_fatal ("please combine them into a single, space separated option.");
> ! 	      non_fatal ("ignoring option '-M%s'", disassembler_options);
> ! 	    }
> ! 	  disassembler_options = optarg;
>   	  break;
>   	case 'j':
>   	  if (only == NULL)
> --- 2661,2670 ----
>   	  break;
>   	case 'M':
>   	  if (disassembler_options)
> ! 	    /* Ignore potential memory leak for now.  */
> ! 	    disassembler_options = concat (disassembler_options, ",", optarg, NULL);
> ! 	  else
> ! 	    disassembler_options = optarg;
>   	  break;
>   	case 'j':
>   	  if (only == NULL)
> Index: binutils/doc/binutils.texi
> ===================================================================
> RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
> retrieving revision 1.43
> diff -c -3 -p -r1.43 binutils.texi
> *** binutils/doc/binutils.texi	17 Jul 2003 17:02:46 -0000	1.43
> --- binutils/doc/binutils.texi	18 Jul 2003 11:17:40 -0000
> *************** architectures with the @option{-i} optio
> *** 1625,1639 ****
>   @item -M @var{options}
>   @itemx --disassembler-options=@var{options}
>   Pass target specific information to the disassembler.  Only supported on
> ! some targets.  Note only a single instance of the option on the
> ! command line is supported.  If the option occurs more than once, the
> ! earlier versions will be ignored.  If it is necessary to specify more
> ! 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
>   select which register name set is used during disassembler.  Specifying
> --- 1625,1633 ----
>   @item -M @var{options}
>   @itemx --disassembler-options=@var{options}
>   Pass target specific information to the disassembler.  Only supported on
> ! some targets.  If it is necessary to specify more than one
> ! disassembler option then multiple @option{-M} options can be used or
> ! can be placed together into a comma separated list.
>   
>   If the target is an ARM architecture then this switch can be used to
>   select which register name set is used during disassembler.  Specifying
> Index: opcodes/arm-dis.c
> ===================================================================
> RCS file: /cvs/src/src/opcodes/arm-dis.c,v
> retrieving revision 1.32
> diff -c -3 -p -r1.32 arm-dis.c
> *** opcodes/arm-dis.c	1 Apr 2003 13:08:06 -0000	1.32
> --- opcodes/arm-dis.c	18 Jul 2003 11:17:41 -0000
> ***************
> *** 27,32 ****
> --- 27,33 ----
>   #include "coff/internal.h"
>   #include "libcoff.h"
>   #include "opintl.h"
> + #include "safe-ctype.h"
>   
>   /* FIXME: This shouldn't be done here.  */
>   #include "elf-bfd.h"
> *************** parse_arm_disassembler_option (option)
> *** 1152,1202 ****
>         option += 10;
>   
>         for (i = NUM_ARM_REGNAMES; i--;)
> ! 	if (streq (option, regnames[i].name))
>   	  {
>   	    regname_selected = i;
>   	    break;
>   	  }
>   
>         if (i < 0)
>   	fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
>       }
> !   else if (streq (option, "force-thumb"))
>       force_thumb = 1;
> !   else if (streq (option, "no-force-thumb"))
>       force_thumb = 0;
>     else
>       fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
>   
>     return;
>   }
>   
> ! /* Parse the string of disassembler options, spliting it at whitespaces.  */
>   
>   static void
>   parse_disassembler_options (options)
>        char * options;
>   {
> -   char * space;
> - 
>     if (options == NULL)
>       return;
>   
> !   do
>       {
> !       space = strchr (options, ' ');
>   
> !       if (space)
> ! 	{
> ! 	  * space = '\0';
> ! 	  parse_arm_disassembler_option (options);
> ! 	  * space = ' ';
> ! 	  options = space + 1;
> ! 	}
> !       else
> ! 	parse_arm_disassembler_option (options);
>       }
> -   while (space);
>   }
>   
>   /* NOTE: There are no checks in these routines that
> --- 1153,1200 ----
>         option += 10;
>   
>         for (i = NUM_ARM_REGNAMES; i--;)
> ! 	if (strneq (option, regnames[i].name, strlen (regnames[i].name)))
>   	  {
>   	    regname_selected = i;
>   	    break;
>   	  }
>   
>         if (i < 0)
> + 	/* XXX - should break 'option' at following delimiter.  */
>   	fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
>       }
> !   else if (strneq (option, "force-thumb", 11))
>       force_thumb = 1;
> !   else if (strneq (option, "no-force-thumb", 14))
>       force_thumb = 0;
>     else
> +     /* XXX - should break 'option' at following delimiter.  */
>       fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
>   
>     return;
>   }
>   
> ! /* Parse the string of disassembler options, spliting it at whitespaces
> !    or commas.  (Whitespace separators supported for backwards compatibility).  */
>   
>   static void
>   parse_disassembler_options (options)
>        char * options;
>   {
>     if (options == NULL)
>       return;
>   
> !   while (*options)
>       {
> !       parse_arm_disassembler_option (options);
>   
> !       /* Skip forward to next seperator.  */
> !       while ((*options) && (! ISSPACE (*options)) && (*options != ','))
> ! 	++ options;
> !       /* Skip forward past seperators.  */
> !       while (ISSPACE (*options) || (*options == ','))
> ! 	++ options;      
>       }
>   }
>   
>   /* NOTE: There are no checks in these routines that
>         
> 

  parent reply	other threads:[~2003-07-23  6:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-10 15:38 [arnm-elf-objdump] Can't use two -M flags for disassembler (-Mforce-thumb and -Mreg-names-raw) Vincent Rubiolo
2003-07-11 14:35 ` Nick Clifton
     [not found] ` <H0000cba18680191.1057939164.eux100.sgp.st.com@MHS>
2003-07-14 14:48   ` Vincent Rubiolo
2003-07-17 14:44     ` Nick Clifton
     [not found]     ` <H0000cba186df243.1058453251.eux100.sgp.st.com@MHS>
2003-07-17 15:31       ` Vincent Rubiolo
2003-07-17 17:02         ` Nick Clifton
2003-07-17 18:39           ` Daniel Jacobowitz
2003-07-18 11:34             ` Nick Clifton
     [not found]             ` <H0000cba187217e5.1058853947.eux100.sgp.st.com@MHS>
2003-07-23  6:39               ` Vincent Rubiolo [this message]
2003-07-18  8:05           ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F1ED70F.8010906@st.com \
    --to=vincent.rubiolo@st.com \
    --cc=binutils@sources.redhat.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).