Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Problem with MI -var-evaluate-expression command
@ 2002-07-10 17:15 Mo DeJong
  2002-07-10 17:31 ` Keith Seitz
  0 siblings, 1 reply; 5+ messages in thread
From: Mo DeJong @ 2002-07-10 17:15 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <1026487389.32493.ezmlm@sources.redhat.com>]

end of thread, other threads:[~2002-07-12 18:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-10 17:15 Problem with MI -var-evaluate-expression command Mo DeJong
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox