MI to access value of $ prefixed variable name

Jonah Graham jonah@kichwacoders.com
Tue May 25 04:35:09 GMT 2021


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.

Thanks for your help.
Jonah


More information about the Gdb mailing list