This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Emit a warning for ineffective set VAR = EXP command
- From: Tristan Gingold <gingold at adacore dot com>
- To: Maciej W. Rozycki <macro at codesourcery dot com>
- Cc: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Mon, 7 May 2012 12:30:19 +0200
- Subject: Re: [RFA] Emit a warning for ineffective set VAR = EXP command
- References: <8781499A-A489-42D0-80B1-75136331DBDB@adacore.com> <alpine.DEB.1.10.1205041958130.18334@tp.orcam.me.uk>
On May 4, 2012, at 9:01 PM, Maciej W. Rozycki wrote:
> On Fri, 27 Apr 2012, Tristan Gingold wrote:
>
>> the 'set VAR=EXP' command is a real trap for Ada (and maybe other
>> languages such as Pascal users), because the '=' 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.
>>
>> I simply propose to emit a warning if the expression is not an
>> assignment (or a comma expression).
>>
>> No regressions on x86_64 GNU/Linux.
>>
>> Ok for trunk ?
>>
>> 2012-04-27 Tristan Gingold <gingold@adacore.com>
>>
>> * printcmd.c (set_command): Emit a warning if the expression is not
>> an assignment.
>
> It does regress gdb.base/freebpcmd.exp apparently:
>
> Breakpoint 1, main (argc=1, argv=0xbffff904) at .../gdb/testsuite/gdb.base/freebpcmd.c:27
> 27 printf (">>> %d\n", i); /* euphonium */
> "odd "$79 = 39
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> warning: Expression is not an assignment (and might have no effect)
> ERROR: internal buffer is full.
> UNRESOLVED: gdb.base/freebpcmd.exp: run program with breakpoint commands
>
> This warns about "set variable $j++" presumably -- should the warning be
> disabled for pre/post increments/decrements?
I am not opposed to disable warnings for pre/post inc/dec.
But this usage is dubious (the help explicitly mentions VAR=EXP !)
Opinion ?
Tristan.