This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [gdb 6.7.1/6.8] does '-var-create - @' work or not?
Please add some additional details: what version of GDB is this,
and what were the exact commands and output in the MI session?
Ups, my fault. It was gdb6.8(built using mingw, but not mingw technical
preview, the same problem is with gdb6.7.1(cygwin)), windows XP. Tested
program built using cygwin gcc -g3.
gdb6.8.exe -i mi -q
(gdb)
-file-exec-and-symbols test.exe
^done
(gdb)
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x004010a5",func="main",file="main.cpp",fullname=
"c:\\cygwin\\bin/main.cpp",line="14",times="0"}
(gdb)
-break-insert test2
^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00401056",func="test2(int)",file="main.cpp",ful
lname="c:\\cygwin\\bin/main.cpp",line="3",times="0"}
(gdb)
-exec-run
^running
(gdb)
~"[New thread 3528.0xd8c]\n"
~"[New thread 3528.0xed4]\n"
&"warning: cYgFFFFFFFF 6110C854\n"
&"warning: cYgstd 22cc80 d 3\n"
*stopped,reason="breakpoint-hit",bkptno="1",thread-id="1",frame={addr="0x004010a5",func="main",args=[{name="argc",value=
"1"},{name="argv",value="0x6601e8"}],file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="14"}
(gdb)
-exec-next
^running
(gdb)
*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x004010aa",func="main",args=[{name="argc",value="1"},{n
ame="argv",value="0x6601e8"}],file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="15"}
(gdb)
-exec-next
^running
(gdb)
*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x004010b1",func="main",args=[{name="argc",value="1"},{n
ame="argv",value="0x6601e8"}],file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="16"}
(gdb)
-exec-next
^running
(gdb)
*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x004010b8",func="main",args=[{name="argc",value="1"},{n
ame="argv",value="0x6601e8"}],file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="17"}
(gdb)
-var-create - @ a
^done,name="var1",numchild="0",value="10",type="int"
(gdb)
-var-create - @ b
^done,name="var2",numchild="0",value="1",type="int"
(gdb)
-exec-continue
^running
(gdb)
*stopped,reason="breakpoint-hit",bkptno="2",thread-id="1",frame={addr="0x00401056",func="test2",args=[{name="a",value="1
1"}],file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="3"}
(gdb)
-exec-next
^running
(gdb)
*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x0040105f",func="test2",args=[{name="a",value="11"}],fi
le="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="4"}
(gdb)
-stack-info-frame
^done,frame={level="0",addr="0x0040105f",func="test2",file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="4"}
(gdb)
p a
&"p a\n"
~"$1 = 11"
~"\n"
^done
(gdb)
p b
&"p b\n"
~"$2 = 31"
~"\n"
^done
(gdb)
-var-update var1
^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
(gdb)
-var-evaluate-expression var1
^done,value="31"
(gdb)
-var-update var2
^done,changelist=[{name="var2",in_scope="true",type_changed="false"}]
(gdb)
-var-evaluate-expression var2
^done,value="0"
(gdb)
-stack-select-frame 1
^done
(gdb)
-stack-info-frame
^done,frame={level="1",addr="0x0040107e",func="test1",file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="10"}
(gdb)
-var-update var1
^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
(gdb)
-var-evaluate-expression var1
^done,value="11"
(gdb)
-var-update var2
^done,changelist=[{name="var2",in_scope="true",type_changed="false"}]
(gdb)
-var-evaluate-expression var2
^done,value="11"
(gdb)
p a
&"p a\n"
~"$3 = 1"
~"\n"
^done
(gdb)
p b
&"p b\n"
~"$4 = 11"
~"\n"
^done
(gdb)
-stack-select-frame 2
^done
(gdb)
-var-update var1
^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
(gdb)
-var-evaluate-expression var1
^done,value="10"
(gdb)
-var-update var2
^done,changelist=[{name="var2",in_scope="true",type_changed="false"}]
(gdb)
-var-evaluate-expression var2
^done,value="1"
(gdb)
p a
&"p a\n"
~"$5 = 10"
~"\n"
^done
(gdb)
p b
&"p b\n"
~"$6 = 1"
~"\n"
^done
(gdb)
-stack-info-frame
^done,frame={level="2",addr="0x004010c4",func="main",file="main.cpp",fullname="c:\\cygwin\\bin/main.cpp",line="17"}
(gdb)
q
&"q\n"
Tested file:
int test2( int a )
{
int b = a + 20;
return b;//a=11, b=31
}
int test1( int a )
{
int b = a + 10;
return test2( b );//a=1, b=11
}
int main( int argc, char** argv )
{
int a = 10;
int b = 1;
test1( 1 );//a=10, b=1
return 0;
}
If you need another information, just ask.
Regards,
Bogdan