This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Behaviour of invalid varobjs


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]