This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Emit a warning for ineffective set VAR = EXP command


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]