From: Simon Marchi <simon.marchi@polymtl.ca>
To: Jonah Graham <jonah@kichwacoders.com>,
GDB Development <gdb@sourceware.org>
Subject: Re: MI to access value of $ prefixed variable name
Date: Tue, 25 May 2021 10:03:56 -0400 [thread overview]
Message-ID: <df1ca9fd-5824-fc9b-d926-37a368df3d38@polymtl.ca> (raw)
In-Reply-To: <CAPmGMvihqU-f3s2PL09cFFZFfYGA6GLOv3HDLM4fm+0QawOPGg@mail.gmail.com>
On 2021-05-25 12:35 a.m., Jonah Graham wrote:
> Hello,
>
> I have a user of Eclipse CDT who is having problems displaying a C variable
> called $j (dollar sign prefixed variable) -
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=573703
>
> I understand this is because $ prefixed variables are treated specially by
> GDB.
>
> 47-stack-list-locals --thread 1 --frame 0 1
> 47^done,locals=[{name="$f",value="0"}]
>
> 52-var-create --thread 1 --frame 0 - * $f
> 52^done,name="var3",numchild="0",value="void",type="void",has_more="0"
>
> Note type "void" above, $f is an int in the C code, but is indeed void (as
> expected) in GDB. -stack-list-locals shows the correct value, but I can't
> use the returned name back to -var-create because of the naming conflict.
>
> There wasn't anything I saw in the help (
> https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html)
> on this topic.
Huh, I didn't know this was possible:
https://gcc.gnu.org/onlinedocs/gcc/Dollar-Signs.html#Dollar-Signs
I didn't look in depth, but I don't think there's a way to make it work.
I don't remember seeing a way to escape that dollar sign.
I'd say that the simplest solution would be: don't use dollar sign in
identifiers. But if somebody really wants GDB to support it, then they
can always send a patch for it (I don't think this is a priority for
anyone).
Simon
next prev parent reply other threads:[~2021-05-25 14:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 4:35 Jonah Graham
2021-05-25 14:03 ` Simon Marchi [this message]
2021-05-25 17:11 ` Jonah Graham
2021-06-01 18:57 ` Tom Tromey
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=df1ca9fd-5824-fc9b-d926-37a368df3d38@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb@sourceware.org \
--cc=jonah@kichwacoders.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).