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: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Tristan Gingold <gingold at adacore dot com>
- Cc: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Fri, 4 May 2012 20:01:52 +0100
- Subject: Re: [RFA] Emit a warning for ineffective set VAR = EXP command
- References: <8781499A-A489-42D0-80B1-75136331DBDB@adacore.com>
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?
Maciej