From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23126 invoked by alias); 27 Apr 2012 13:48:30 -0000 Received: (qmail 23114 invoked by uid 22791); 27 Apr 2012 13:48:27 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.158) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Apr 2012 13:48:14 +0000 Received: from md13.u-strasbg.fr (md13.u-strasbg.fr [130.79.200.248]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q3RDlxrS099303 ; Fri, 27 Apr 2012 15:47:59 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms14.u-strasbg.fr [130.79.204.114]) by md13.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q3RDlWf5011766 ; Fri, 27 Apr 2012 15:47:32 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q3RDlvjw028405 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Fri, 27 Apr 2012 15:47:58 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Tristan Gingold'" , References: <8781499A-A489-42D0-80B1-75136331DBDB@adacore.com> In-Reply-To: <8781499A-A489-42D0-80B1-75136331DBDB@adacore.com> Subject: RE: [RFA] Emit a warning for ineffective set VAR = EXP command Date: Fri, 27 Apr 2012 13:54:00 -0000 Message-ID: <001e01cd247c$5a3ca180$0eb5e480$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" 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: 2012-04/txt/msg00985.txt.bz2 As pascal language maintainer I fully support this RFA. When debugging mixed language executable I quite often forget that I passed from a C compiled function to a pascal compiled one and you the C version resulting in the same kind of troubles as Tristan does. Pierre Muller GDB pascal language maintainer > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Tristan Gingold > Envoy=E9=A0: vendredi 27 avril 2012 15:29 > =C0=A0: gdb-patches@sourceware.org ml > Objet=A0: [RFA] Emit a warning for ineffective set VAR =3D EXP command >=20 > Hi, >=20 > the 'set VAR=3DEXP' command is a real trap for Ada (and maybe other languages > such as Pascal users), because the '=3D' is interpreted as BINOP_EQUAL instead > of BINOP_ASSIGN. You often do not realize that the current language is not > C where you are using to command for registers or convenience variables. >=20 > I simply propose to emit a warning if the expression is not an assignment > (or a comma expression). >=20 > No regressions on x86_64 GNU/Linux. >=20 > Ok for trunk ? >=20 > 2012-04-27 Tristan Gingold >=20 > * printcmd.c (set_command): Emit a warning if the expression is not > an assignment. >=20 > diff --git a/gdb/printcmd.c b/gdb/printcmd.c > index d441dfe..79e38f2 100644 > --- a/gdb/printcmd.c > +++ b/gdb/printcmd.c > @@ -1080,6 +1080,12 @@ set_command (char *exp, int from_tty) > struct cleanup *old_chain =3D > make_cleanup (free_current_contents, &expr); >=20 > + if (expr->nelts >=3D 1 > + && expr->elts[0].opcode !=3D BINOP_ASSIGN > + && expr->elts[0].opcode !=3D BINOP_ASSIGN_MODIFY > + && expr->elts[0].opcode !=3D BINOP_COMMA) > + warning (_("Expression is not an assignment (and might have no > effect)")); > + > evaluate_expression (expr); > do_cleanups (old_chain); > }