Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Behaviour of invalid varobjs
@ 2007-03-18 10:40 Vladimir Prus
  2007-03-22 10:32 ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2007-03-18 10:40 UTC (permalink / raw)
  To: gdb


I think current mainline does something strange
about varobjs that cannot be evaluated:

        -var-create null_ptr * **0
        ^done,name="null_ptr",numchild="0",value="0",type="int"
        (gdb)
        -var-update null_ptr
        ^done,changelist=[{name="null_ptr",in_scope="false"}]

First, the value of "**0" is not 0, in fact there's no value at all.
Second, given that nothing was changed between the two commands,
it's strange that 'null_ptr' is mentioned in -var-update.

Before I go changing code, do everybody agree that:

1. The output of -var-create should either have no "value"
field at all, or value="", as is used in some other context.
2. The output of -var-update should not include anything.

Also, we probably should include in_scope="false" in output of
-var-create, but I'm not quite sure.

Comments?

- Volodya






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

* Re: Behaviour of invalid varobjs
  2007-03-18 10:40 Behaviour of invalid varobjs Vladimir Prus
@ 2007-03-22 10:32 ` Nick Roberts
  2007-03-22 10:41   ` Vladimir Prus
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2007-03-22 10:32 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

 > I think current mainline does something strange
 > about varobjs that cannot be evaluated:
 > 
 >         -var-create null_ptr * **0
 >         ^done,name="null_ptr",numchild="0",value="0",type="int"
 >         (gdb)
 >         -var-update null_ptr
 >         ^done,changelist=[{name="null_ptr",in_scope="false"}]
 > 
 > First, the value of "**0" is not 0, in fact there's no value at all.
 > Second, given that nothing was changed between the two commands,
 > it's strange that 'null_ptr' is mentioned in -var-update.
 > 
 > Before I go changing code, do everybody agree that:
 > 
 > 1. The output of -var-create should either have no "value"
 > field at all, or value="", as is used in some other context.
 > 2. The output of -var-update should not include anything.
 > 
 > Also, we probably should include in_scope="false" in output of

            probably should not include?

 > -var-create, but I'm not quite sure.

Are there any real situations where you would want to create a variable object
of a constant?  If not, then, apart from ensuring that such objects don't crash
GDB, I don't think this is an urgent issue.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: Behaviour of invalid varobjs
  2007-03-22 10:32 ` Nick Roberts
@ 2007-03-22 10:41   ` Vladimir Prus
  2007-03-22 23:53     ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2007-03-22 10:41 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb

On Thursday 22 March 2007 13:32, Nick Roberts wrote:
>  > I think current mainline does something strange
>  > about varobjs that cannot be evaluated:
>  > 
>  >         -var-create null_ptr * **0
>  >         ^done,name="null_ptr",numchild="0",value="0",type="int"
>  >         (gdb)
>  >         -var-update null_ptr
>  >         ^done,changelist=[{name="null_ptr",in_scope="false"}]
>  > 
>  > First, the value of "**0" is not 0, in fact there's no value at all.
>  > Second, given that nothing was changed between the two commands,
>  > it's strange that 'null_ptr' is mentioned in -var-update.
>  > 
>  > Before I go changing code, do everybody agree that:
>  > 
>  > 1. The output of -var-create should either have no "value"
>  > field at all, or value="", as is used in some other context.
>  > 2. The output of -var-update should not include anything.
>  > 
>  > Also, we probably should include in_scope="false" in output of
> 
>             probably should not include?
> 
>  > -var-create, but I'm not quite sure.
> 
> Are there any real situations where you would want to create a variable object
> of a constant?  If not, then, apart from ensuring that such objects don't crash
> GDB, I don't think this is an urgent issue.

That's testcase example. Replace **0 with "**some_pointer" and you have a real
use-case.

- Volodya


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

* Re: Behaviour of invalid varobjs
  2007-03-22 10:41   ` Vladimir Prus
@ 2007-03-22 23:53     ` Nick Roberts
  2007-03-25 10:30       ` Vladimir Prus
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Roberts @ 2007-03-22 23:53 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

 > > Are there any real situations where you would want to create a variable
 > > object of a constant?  If not, then, apart from ensuring that such objects
 > > don't crash GDB, I don't think this is an urgent issue.
 > 
 > That's testcase example. Replace **0 with "**some_pointer" and you have a
 > real use-case.

OK, I didn't realise that.  Constants and variables are treated differently:
try "-var-create - * *0" and "-var-create - * *some_pointer" when
some_pointer = 0x0.

Going back to your original e-mail:

    Before I go changing code, do everybody agree that:

    1. The output of -var-create should either have no "value"
    field at all, or value="", as is used in some other context.

I prefer value="" as it would be consistent with the status quo.

    2. The output of -var-update should not include anything.

I agree.

    Also, we probably should include in_scope="false" in output of
    -var-create, but I'm not quite sure.

I don't see why.  


-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: Behaviour of invalid varobjs
  2007-03-22 23:53     ` Nick Roberts
@ 2007-03-25 10:30       ` Vladimir Prus
  2007-03-25 12:03         ` Nick Roberts
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2007-03-25 10:30 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb

On Friday 23 March 2007 02:53, Nick Roberts wrote:
>  > > Are there any real situations where you would want to create a variable
>  > > object of a constant?  If not, then, apart from ensuring that such objects
>  > > don't crash GDB, I don't think this is an urgent issue.
>  > 
>  > That's testcase example. Replace **0 with "**some_pointer" and you have a
>  > real use-case.
> 
> OK, I didn't realise that.  Constants and variables are treated differently:
> try "-var-create - * *0" and "-var-create - * *some_pointer" when
> some_pointer = 0x0.

The testcase uses "**0", not *0, and I
don't see any difference between constant and variable below:

	-var-create V1 * **0
	^done,name="V1",numchild="0",value="0",type="int"
	(gdb)
	-var-create V2 * **p
	^done,name="V2",numchild="0",value="0",type="int"
	(gdb)
	-var-update V1
	^done,changelist=[{name="V1",in_scope="false"}]
	(gdb)
	-var-update V2
	^done,changelist=[{name="V2",in_scope="false"}]

Nor do I see any difference for *0 and *p:

	-var-create V1 * *0
	^done,name="V1",numchild="0",value="",type="int"
	(gdb)
	-var-create V2 * *p
	^done,name="V2",numchild="0",value="",type="int"
	(gdb)
	-var-update V1
	^done,changelist=[]
	(gdb)
	-var-update V2
	^done,changelist=[]

Can you clarify what you meant?

>     1. The output of -var-create should either have no "value"
>     field at all, or value="", as is used in some other context.
> 
> I prefer value="" as it would be consistent with the status quo.
> 
>     2. The output of -var-update should not include anything.
> 
> I agree.
> 
>     Also, we probably should include in_scope="false" in output of
>     -var-create, but I'm not quite sure.
> 
> I don't see why. 

Because as long as we (IMO, bogusly) use in_scope="false" to indicate
"expression cannot be evaluated", we should consistently report
that everywhere. 

- Volodya


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

* Re: Behaviour of invalid varobjs
  2007-03-25 10:30       ` Vladimir Prus
@ 2007-03-25 12:03         ` Nick Roberts
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Roberts @ 2007-03-25 12:03 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

 > The testcase uses "**0", not *0, 

Presumably though we're not just interested in the tescase.

 > and I don't see any difference between constant and variable below:
 >... 
 > Can you clarify what you meant?

I can't seem to reproduce it now.  I must have been mistaken

 > >     Also, we probably should include in_scope="false" in output of
 > >     -var-create, but I'm not quite sure.
 > >
 > > I don't see why. 
 > 
 > Because as long as we (IMO, bogusly) use in_scope="false" to indicate
 > "expression cannot be evaluated", we should consistently report
 > that everywhere. 

AFAICS we don't use in_scope at all for -var-create.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

end of thread, other threads:[~2007-03-25 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-18 10:40 Behaviour of invalid varobjs Vladimir Prus
2007-03-22 10:32 ` Nick Roberts
2007-03-22 10:41   ` Vladimir Prus
2007-03-22 23:53     ` Nick Roberts
2007-03-25 10:30       ` Vladimir Prus
2007-03-25 12:03         ` Nick Roberts

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