From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4547 invoked by alias); 8 Dec 2010 16:53:55 -0000 Received: (qmail 4276 invoked by uid 22791); 8 Dec 2010 16:53:54 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,TW_TG X-Spam-Check-By: sourceware.org Received: from imr3.ericy.com (HELO imr3.ericy.com) (198.24.6.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Dec 2010 16:53:48 +0000 Received: from eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) by imr3.ericy.com (8.13.8/8.13.8) with ESMTP id oB8GramF012925 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 8 Dec 2010 10:53:36 -0600 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.63]) by eusaamw0707.eamcs.ericsson.se ([147.117.20.32]) with mapi; Wed, 8 Dec 2010 11:53:36 -0500 From: Marc Khouzam To: Tom Tromey CC: "gdb-patches@sourceware.org" Date: Wed, 08 Dec 2010 16:53:00 -0000 Subject: RE: [MI] Wrong error message when parsing invalid --thread-group Message-ID: References: , In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00088.txt.bz2 From: Tom Tromey [tromey@redhat.com] >>>>> "Marc" =3D=3D Marc Khouzam writes: Marc> (gdb) interpreter-exec mi "28-break-insert --thread-group ix" Marc> 28^error,msg=3D"Invalid value for the '--thread' option" Marc> The error msg says "thread" instead of "thread-group". > Thanks for noticing this :) Marc> error (_("Invalid value for the '%s' option"), Marc> - start[2] =3D=3D 't' ? "--thread" : "--frame"); Marc> + start[2] =3D=3D 'f' ? "--frame" : Marc> + start[8] =3D=3D '-' ? "--thread-group" : "--thread"); > I think it would be better to do something using %*s. > This would mean computing a little extra state in the "if" bodies, but > that doesn't seem like a big deal. > I prefer this because it is less obscure and perhaps more future-proof. I have to agree with you there. How about this? Marc 2010-12-07 Marc Khouzam * mi/mi-parse.c (mi_parse): Wrong error message. ### Eclipse Workspace Patch 1.0 #P src Index: gdb/mi/mi-parse.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/mi/mi-parse.c,v retrieving revision 1.21.2.1 diff -u -r1.21.2.1 mi-parse.c --- gdb/mi/mi-parse.c 6 Dec 2010 14:23:40 -0000 1.21.2.1 +++ gdb/mi/mi-parse.c 8 Dec 2010 16:50:21 -0000 @@ -292,7 +292,7 @@ to CLI. */ for (;;) { - char *start =3D chp; + char *option; size_t as =3D sizeof ("--all ") - 1; size_t tgs =3D sizeof ("--thread-group ") - 1; size_t ts =3D sizeof ("--thread ") - 1; @@ -311,6 +311,7 @@ } if (strncmp (chp, "--thread-group ", tgs) =3D=3D 0) { + option =3D "--thread-group"; if (parse->thread_group !=3D -1) error (_("Duplicate '--thread-group' option")); chp +=3D tgs; @@ -321,6 +322,7 @@ } else if (strncmp (chp, "--thread ", ts) =3D=3D 0) { + option =3D "--thread"; if (parse->thread !=3D -1) error (_("Duplicate '--thread' option")); chp +=3D ts; @@ -328,6 +330,7 @@ } else if (strncmp (chp, "--frame ", fs) =3D=3D 0) { + option =3D "--frame"; if (parse->frame !=3D -1) error (_("Duplicate '--frame' option")); chp +=3D fs; @@ -337,8 +340,7 @@ break; =20 if (*chp !=3D '\0' && !isspace (*chp)) - error (_("Invalid value for the '%s' option"), - start[2] =3D=3D 't' ? "--thread" : "--frame"); + error (_("Invalid value for the '%s' option"), option); while (isspace (*chp)) chp++; }