From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3165 invoked by alias); 18 Jul 2003 11:34:46 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 3158 invoked from network); 18 Jul 2003 11:34:45 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 18 Jul 2003 11:34:45 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h6IBYjH04919 for ; Fri, 18 Jul 2003 07:34:45 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h6IBYiI03190 for ; Fri, 18 Jul 2003 07:34:44 -0400 Received: from localhost.localdomain.redhat.com (vpn50-1.rdu.redhat.com [172.16.50.1]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h6IBYd505987 for ; Fri, 18 Jul 2003 07:34:43 -0400 To: binutils@sources.redhat.com Subject: Re: [arnm-elf-objdump] Can't use two -M flags for disassembler (-Mforce-thumb and -Mreg-names-raw) References: <3F0E3141.4060706@st.com> <3F136B7B.6090201@st.com> <3F176A30.1090603@st.com> <20030717183908.GA25442@nevyn.them.org> From: Nick Clifton Date: Fri, 18 Jul 2003 11:34:00 -0000 In-Reply-To: <20030717183908.GA25442@nevyn.them.org> (Daniel Jacobowitz's message of "Thu, 17 Jul 2003 14:39:08 -0400") Message-ID: User-Agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-07/txt/msg00341.txt.bz2 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 * 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 * 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