From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31815 invoked by alias); 13 Feb 2013 16:58:29 -0000 Received: (qmail 31806 invoked by uid 22791); 13 Feb 2013 16:58:26 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Feb 2013 16:58:21 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1U5ff1-0007A3-89 from Hafiz_Abid@mentor.com ; Wed, 13 Feb 2013 08:58:19 -0800 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 13 Feb 2013 08:58:19 -0800 Received: from abidh-ubunto1104 (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server (TLS) id 14.1.289.1; Wed, 13 Feb 2013 16:58:18 +0000 Date: Wed, 13 Feb 2013 16:58:00 -0000 From: "Abid, Hafiz" Subject: Re: [patch[ Improve the error messages of tvariable command To: Pedro Alves CC: , References: <1360688372.8583.1@abidh-ubunto1104> <511BC3AA.60708@redhat.com> In-Reply-To: <511BC3AA.60708@redhat.com> (from palves@redhat.com on Wed Feb 13 16:47:38 2013) Message-ID: <1360774697.2842.2@abidh-ubunto1104> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; delsp=Yes; format=Flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: 2013-02/txt/msg00314.txt.bz2 On 13/02/13 16:47:38, Pedro Alves wrote: > I somewhat remember investigating this, and writing a longer > rationale for the change -- the gist of it being not > handling tsv name as expressions. Can you dig it out from > the internal archives and repost including that info? It'd > be good for posterity. >=20 > -- > Pedro Alves >=20 >=20 Here is what I found. Is it what you were expecting? -- Here's a fix for issue #8161, which is about the "tvariable" returning errors on invalid and tsv names. E.g., Temporary breakpoint 1, main () at a.cc:2 2 int x =3D 1; (gdb) tvar x Syntax must be $NAME [ =3D EXPR ] (gdb) tvar y No symbol "y" in current context. The problem is the use of parse_expression to parse the tvariable's name. We could merely always catch errors thrown from within parse_expression, and issue a "usage" error, but it wouldn't cover all cases correctly. E.g., (gdb) tvar x =3D nonexistingvariable is an invalid expression, not invalid syntax. I also noticed that (gdb) tvar x =3D 1 =3D 1 would be incorrectly accepted. Given that the comand is documented to only take an expression on the right side of the '=3D', it seems that whatever is on the left side of the '=3D' should not be treated as an expression, but literaly as "$NAME". That's what the patch does. MI now shares the same name validations as the CLI variant. -- Regards, Abid