From: Mo DeJong <supermo@bayarea.net>
To: gdb <gdb@sources.redhat.com>
Subject: Problem with MI -var-evaluate-expression command
Date: Wed, 10 Jul 2002 17:15:00 -0000 [thread overview]
Message-ID: <20020710171957.5e657753.supermo@bayarea.net> (raw)
Hello gdbers.
I have been looking at the GDB/MI recently and have run into a problem
with the -var-evaluate-expression method that really seems like a bug.
It seems one is unable to access children of a variable object unless
the -var-list-children command has been run for that object. Here
is a quick example to demonstrate what I mean.
% cat S.c
struct S {
int v1;
int v2;
};
int main() {
struct S* s = (struct S*) malloc(sizeof(struct S));
s->v1 = 0;
s->v2 = 1;
return 0;
}
(compile, then invoke with mi1)
-file-exec-and-symbols S
^done
(gdb)
-break-insert S.c:9
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x080483ee",func="main",file="S.c",line="9",times="0"}
(gdb)
-var-create svar * "(struct S *) 0x8049560"
^done,name="svar",numchild="2",type="struct S *"
(gdb)
# I can access the variable
-var-evaluate-expression svar
^done,value="0x8049560"
(gdb)
# But not the a child variable
-var-evaluate-expression svar.v1
&"Variable object not found\n"
^error,msg="Variable object not found"
(gdb)
# I need to call -var-list-children first
-var-list-children svar
^done,numchild="2",children={child={name="svar.v1",exp="v1",numchild="0",type="int"},child={name="svar.v2",exp="v2",numchild="0",type="int"}}
(gdb)
# Now it works
-var-evaluate-expression svar.v1
^done,value="0"
(gdb)
Is this a bug in the MI? It sure seems like one to me, but I thought
I would ask to make sure. The docs don't mention anything about
having to invoke the -var-evaluate-expression method before accessing
children of a variable.
cheers
Mo DeJong
next reply other threads:[~2002-07-11 0:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-10 17:15 Mo DeJong [this message]
2002-07-10 17:31 ` Keith Seitz
2002-07-11 12:13 ` Mo DeJong
2002-07-11 12:43 ` Keith Seitz
[not found] <1026487389.32493.ezmlm@sources.redhat.com>
2002-07-12 11:30 ` Jim Ingham
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=20020710171957.5e657753.supermo@bayarea.net \
--to=supermo@bayarea.net \
--cc=gdb@sources.redhat.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