Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* [gdb 6.7.1/6.8] does '-var-create - @' work or not?
@ 2008-04-03 13:20 Bogdan Slusarczyk
  2008-04-03 13:33 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Bogdan Slusarczyk @ 2008-04-03 13:20 UTC (permalink / raw)
  To: gdb

I've done simple test:

int test2( int a )
{
	int b = a + 20;
	return b;//should be a=11, b=31, but is a=31,b=0
}

int test1( int a )
{
	int b = a + 10;
	return test2( b );//should be a=1, b=11, but is a=11, b=11
}

int main( int argc, char** argv )
{
	int a = 10;
	int b = 1;
	test1( 1 );//should be a=10, b=1 and is a=10, b=1

	return 0;
}

I thought that created var objects using '-var-create - @' can be 
updated in another frame. But it doesn't work, -var-evaluate-expression 
returns wrong value. On the other hand 'print' returns right values. Or 
maybe I did something wrong? My sequence: -var-create at the begining, 
and next -var-update and -var-evaluate-expression in another frames.

Regards,
Bogdan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gdb 6.7.1/6.8] does '-var-create - @' work or not?
  2008-04-03 13:20 [gdb 6.7.1/6.8] does '-var-create - @' work or not? Bogdan Slusarczyk
@ 2008-04-03 13:33 ` Daniel Jacobowitz
  2008-04-03 13:50   ` Vladimir Prus
  2008-04-03 14:13   ` Bogdan Slusarczyk
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-04-03 13:33 UTC (permalink / raw)
  To: Bogdan Slusarczyk; +Cc: gdb

On Thu, Apr 03, 2008 at 03:19:55PM +0200, Bogdan Slusarczyk wrote:
> I thought that created var objects using '-var-create - @' can be updated 
> in another frame. But it doesn't work, -var-evaluate-expression returns 
> wrong value. On the other hand 'print' returns right values. Or maybe I 
> did something wrong? My sequence: -var-create at the begining, and next 
> -var-update and -var-evaluate-expression in another frames.

Please add some additional details: what version of GDB is this,
and what were the exact commands and output in the MI session?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gdb 6.7.1/6.8] does '-var-create - @' work or not?
  2008-04-03 13:33 ` Daniel Jacobowitz
@ 2008-04-03 13:50   ` Vladimir Prus
  2008-04-03 14:30     ` Bogdan Slusarczyk
  2008-04-03 14:13   ` Bogdan Slusarczyk
  1 sibling, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2008-04-03 13:50 UTC (permalink / raw)
  To: gdb

Daniel Jacobowitz wrote:

> On Thu, Apr 03, 2008 at 03:19:55PM +0200, Bogdan Slusarczyk wrote:
>> I thought that created var objects using '-var-create - @' can be updated
>> in another frame. But it doesn't work, -var-evaluate-expression returns
>> wrong value. On the other hand 'print' returns right values. Or maybe I
>> did something wrong? My sequence: -var-create at the begining, and next
>> -var-update and -var-evaluate-expression in another frames.
> 
> Please add some additional details: what version of GDB is this,
> and what were the exact commands and output in the MI session?

Right, in general MI bug report should include the *exact* sequence
of commands.

In this case, this looks very much like the bug that Nick has already
reported. Nick has also posted a proposed patch, which I haven't reviewed
yet, though.

- Volodya



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gdb 6.7.1/6.8] does '-var-create - @' work or not?
  2008-04-03 13:33 ` Daniel Jacobowitz
  2008-04-03 13:50   ` Vladimir Prus
@ 2008-04-03 14:13   ` Bogdan Slusarczyk
  1 sibling, 0 replies; 6+ messages in thread
From: Bogdan Slusarczyk @ 2008-04-03 14:13 UTC (permalink / raw)
  To: gdb

> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gdb 6.7.1/6.8] does '-var-create - @' work or not?
  2008-04-03 13:50   ` Vladimir Prus
@ 2008-04-03 14:30     ` Bogdan Slusarczyk
  2008-04-03 17:33       ` Vladimir Prus
  0 siblings, 1 reply; 6+ messages in thread
From: Bogdan Slusarczyk @ 2008-04-03 14:30 UTC (permalink / raw)
  Cc: gdb

> In this case, this looks very much like the bug that Nick has already
> reported. Nick has also posted a proposed patch, which I haven't reviewed
> yet, though.
> 

Was it posted to gdb-patches? I can't find it.

Regards,
Bogdan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gdb 6.7.1/6.8] does '-var-create - @' work or not?
  2008-04-03 14:30     ` Bogdan Slusarczyk
@ 2008-04-03 17:33       ` Vladimir Prus
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Prus @ 2008-04-03 17:33 UTC (permalink / raw)
  To: gdb

Bogdan Slusarczyk wrote:

>> In this case, this looks very much like the bug that Nick has already
>> reported. Nick has also posted a proposed patch, which I haven't reviewed
>> yet, though.
>> 
> 
> Was it posted to gdb-patches? I can't find it.

The thread subject is "-var-update @".

- Volodya



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-03 14:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03 13:20 [gdb 6.7.1/6.8] does '-var-create - @' work or not? Bogdan Slusarczyk
2008-04-03 13:33 ` Daniel Jacobowitz
2008-04-03 13:50   ` Vladimir Prus
2008-04-03 14:30     ` Bogdan Slusarczyk
2008-04-03 17:33       ` Vladimir Prus
2008-04-03 14:13   ` Bogdan Slusarczyk

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