This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: MI: fix base members in references
> > > does the code you've added ever does anything?
> >
> > It seems to handle variable objects of references to pointers correctly.
> > Have you tried it?
>
> I have not been able to follow this discussion, but there needs to be a
> better level of understanding here. Vlad's asking "why does this fix
> the problem" and you're responding "it seems to fix the problem".
> Every time I see something like that, I assume the problem is only
> being fixed by accident - I'm a big believer in understanding causes.
Looking at code is a bit like peeling an onion: when you remove one layer
there's another layer beneath. Unfortunately I have to work within my
limitations, both temporal and mental, and I was just trying to get Vladimir to
do a sanity check. It's easier to show code doesn't work than prove it does
and I don't follow his point about using value_type (var->value) instead of
var->type. Surely if he thinks that there is a simpler/better patch then
the onus is on him to provide it?
> get_type_deref looks at the type, and if it is a pointer or reference,
> it dereferences it. I assume that this is because we want to show the
> children of pointers to structs and references to structs. Is that
> right?
My patch was just for references to pointers.
> If you want to show the children of the struct given a reference to a
> pointer to the struct, then it should handle that too. Sounds like it
> should check for a reference and _then_ for a pointer, instead of
> checking at the same time.
I'm not thinking specifically of structs...
> There are probably some missing calls to check_typedef here, too. I
> don't think you can have a typedef to a reference in C++, but you can
> definitely have a typedef to a pointer, so it would probably be
> advisable to call check_typedef before checking for TYPE_CODE_PTR.
...or typedefs.
--
Nick http://www.inet.net.nz/~nickrob