From: Andrew Burgess <aburgess@redhat.com>
To: Pedro Alves <pedro@palves.net>
Cc: "abdul.b.ijaz" <abijaz@ecsmtp.iul.intel.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 1/2] gdb: add annotation in 'info locals' command for variables shadowing case
Date: Wed, 5 Jan 2022 16:26:47 +0000 [thread overview]
Message-ID: <20220105162647.GA808548@redhat.com> (raw)
In-Reply-To: <8c79c059-ceb1-290d-bfe6-7df8ce927380@palves.net>
* Pedro Alves <pedro@palves.net> [2022-01-05 15:55:05 +0000]:
> On 2022-01-05 15:20, Andrew Burgess via Gdb-patches wrote:
> > (gdb) info locals
> > var = 123
> > foo = 456
> > var = 999 <shadowed: decl at line 1>
> > foo = 888 <shadowed: decl at line 10>
> > (gdb)
> >
> > As you can see the information for var is not helpful. I suspect we
> > might want to print something like:
> >
> > var = 999 <shadowed: other-file.c:1>
> > foo = 888 <shadowed: test.c:10>
>
> I just read this and my first impression from:
>
> shadowed: test.c:10
>
> ... without thinking much was that the ":" after "shadowed" meant "shadowed by". It's a super
> minor thing, but a colon or semicolon instead might drop that ambiguity, without reintroducing
> the wordier "decl at":
>
> foo = 888 <shadowed, test.c:10>
>
> Also, instead of printing extra info just for the shadowed ones, would it be useful to
> print the disambiguation info for all variable names that are ambiguous?
> In that case, maybe put "shadowed" at the end, as most frequently the variables are
> shadowed in the same file, so you get better alignment. Like:
>
> var = 123 <file.c:1>
> var = 999 <file.c:10, shadowed>
Oh, I like this. This one please.
Then in the MI output we'd have something like:
^done,locals=[{name="var",type="int",value="132",file="file.c",line="1"},
{name="var",type="int",value="999",file="file.c",line="10",shadowed="True"}]
>
> Just some 2c. I think the feature is quite useful, whatever the finer details end up as.
> Thanks for working on it.
Agree this seems like a great addition.
Thanks,
Andrew
next prev parent reply other threads:[~2022-01-05 16:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-29 11:14 [PATCH v2 0/2] " abdul.b.ijaz
2021-12-29 11:14 ` [PATCH v2 1/2] gdb: " abdul.b.ijaz
2022-01-05 15:20 ` Andrew Burgess
2022-01-05 15:55 ` Pedro Alves
2022-01-05 16:26 ` Andrew Burgess [this message]
2022-01-11 8:55 ` Ijaz, Abdul B
2021-12-29 11:14 ` [PATCH v2 2/2] gdb: add shadowed_loc field in '-stack-list-locals/variables' mi commands abdul.b.ijaz
2022-01-01 20:14 ` [PATCH v2 0/2] add annotation in 'info locals' command for variables shadowing case Philippe Waroquiers
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=20220105162647.GA808548@redhat.com \
--to=aburgess@redhat.com \
--cc=abijaz@ecsmtp.iul.intel.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).