From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Tristan Gingold <gingold@adacore.com>
Cc: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Emit a warning for ineffective set VAR = EXP command
Date: Tue, 08 May 2012 06:06:00 -0000 [thread overview]
Message-ID: <alpine.DEB.1.10.1205080636280.18334@tp.orcam.me.uk> (raw)
In-Reply-To: <EFDD29C9-79FB-468E-B29B-C1783123E41D@adacore.com>
On Mon, 7 May 2012, Tristan Gingold wrote:
> > 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 ?
I think this is a bit too pedantic, there's no doubt these operators
imply an assignment in C. I think the help text is clear enough with:
"Evaluate expression EXP and assign result to variable VAR, using
assignment syntax appropriate for the current language (VAR = EXP or VAR
:= EXP for example)."
-- it quotes examples but these are by no means exhaustive and one can
imply any assignment valid according to the language selected is going to
be accepted. And there's quite a bunch of assignment operators defined
for C. Note that this help text does not mention "VAR <<= EXP" either and
there's no doubt this is a valid assignment in C too. If you're concerned
about this then perhaps the offline manual could be more elaborate.
I think one of our principles is to make debugging fast and efficient
rather than picky about the input style and with that in mind we should
accept any reasonable input from the user, sometimes even where it is not
perfectly valid for the given language, e.g. you can ask GDB like this:
(gdb) p/x (char[4])somevar
to print SOMEVAR (e.g. an INT) as a 4-element character array even though
this is really not something the C compiler would normally accept. I
recall seeing this principle written down somewhere, but cannot track it
down right now.
I use such constructs all the time, especially when referring to CPU
registers and I think it would be an unnecessary burden if rather than:
(gdb) set $a0++
I had to write:
(gdb) set $a0 += 1
or maybe even:
(gdb) set $a0 = $a0 + 1
That's IMHO an unnecessary waste of time, keyboard, etc. (note that += is
actually explicitly mentioned in the manual).
Maciej
prev parent reply other threads:[~2012-05-08 6:06 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-27 13:48 Tristan Gingold
2012-04-27 13:54 ` Pierre Muller
2012-04-27 16:09 ` Tom Tromey
2012-05-02 13:17 ` Tristan Gingold
2012-05-02 16:41 ` Doug Evans
2012-05-03 10:00 ` Tristan Gingold
2012-05-03 13:12 ` Doug Evans
2012-05-03 15:05 ` Joel Brobecker
2012-05-03 16:33 ` Doug Evans
2012-05-03 22:04 ` Joel Brobecker
2012-05-03 22:07 ` Doug Evans
2012-05-04 7:59 ` Tristan Gingold
2012-05-03 15:02 ` Joel Brobecker
2012-05-03 15:04 ` Tristan Gingold
2012-05-04 19:02 ` Maciej W. Rozycki
2012-05-07 10:30 ` Tristan Gingold
2012-05-07 19:36 ` Tom Tromey
2012-05-07 19:40 ` Paul_Koning
2012-05-07 20:38 ` Tom Tromey
2012-05-07 19:38 ` Joel Brobecker
2012-05-09 12:29 ` Tristan Gingold
2012-05-09 13:54 ` Paul_Koning
2012-05-09 14:10 ` Tristan Gingold
2012-05-09 14:12 ` Maciej W. Rozycki
2012-05-09 14:58 ` Paul_Koning
2012-05-09 15:38 ` Maciej W. Rozycki
2012-05-09 15:55 ` Paul_Koning
2012-05-09 14:17 ` Joel Brobecker
2012-05-10 14:11 ` Tristan Gingold
2012-05-08 6:06 ` Maciej W. Rozycki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.10.1205080636280.18334@tp.orcam.me.uk \
--to=macro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=gingold@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox