This is the mail archive of the gdb-patches@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: MI: fix base members in references


 > > 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.

OK, thats good.  It keeps things simple.

 > > 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.

But as you point out, its not necessary anyway.

 > 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.

That would do what my patch already does, but putting it all once in
get_type_deref would be cleaner, of course.

 > 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.

Yes but this is a separate issue and IMO should be a separate patch.


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


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