MI: fix base members in references

Vladimir Prus ghost@cs.msu.su
Mon Dec 11 07:22:00 GMT 2006


On Monday 11 December 2006 08:53, Nick Roberts wrote:

>  >                                                                  that's
>  > the important thing here.  What does not happen that you want to make
>  > happen, and why doesn't it happen?  The explanation in my previous
>  > message _should_ answer those questions, if I've understood the
>  > discussion right, but maybe it doesn't.
> 
> What doesn't work: references to pointers to structs/unions.
> 
> All my patch does is add an extra level of dereferencing to the relevant
> cplus_* functions.  Presumably you could also have references to references to

Fortnately, references to references do no exist.

> pointers, pointers to references to pointers etc 

Likewise, pointers to references do not exist either.

> so maybe the change should 
> look something like:
> 
>       while (TYPE_CODE (type) == TYPE_CODE_PTR)
>              || TYPE_CODE (type) == TYPE_CODE_REF)
> 	type = get_target_type (type);
> 
> but I suspect the business of fake children would make this awkward.

Then, if you have a pointer to pointer to pointer to struct, you'll collapse
the inner pointers, which might not be good idea.

I think the best short time fix might be to modify get_type_deref to first check
for reference, and after that check for pointer.

But what irks me most is that we have four functions that encapsulate knowledge of number of children
and how to get to them:

	*_number_of_children
	*_name_of_child
	*_value_of_child
	*_type_of_child

and all those functions are present for C and for C++. I'm thinking we can collapse the last
three functions into one, seriously cutting down on code duplication.

- Volodya




More information about the Gdb-patches mailing list