This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] varobj: call CHECK_TYPEDEF
- From: David Carlton <carlton at math dot stanford dot edu>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: Andrew Cagney <ac131313 at redhat dot com>, "gdb-patches at sources dot redhat dot com" <gdb-patches at sources dot redhat dot com>, Daniel Jacobowitz <drow at mvista dot com>
- Date: 11 Jun 2003 16:49:41 -0700
- Subject: Re: [RFA] varobj: call CHECK_TYPEDEF
- References: <1051215397.1538.43.camel@lindt.uglyboxes.com><3EA84A9B.5020308@redhat.com><1051221433.1534.72.camel@lindt.uglyboxes.com><3EA8629B.50603@redhat.com><1055362509.1571.63.camel@lindt.uglyboxes.com>
On 11 Jun 2003 13:15:10 -0700, Keith Seitz <keiths@redhat.com> said:
> So where do we stand with this?
I've just gone and looked over the thread and at Keith's patch; I
think the idea is sound, but the implementation isn't. The comments
at the top of get_type say that it's supposed to skip past typedefs,
so calling CHECK_TYPEDEF certainly seems legitimate. But
CHECK_TYPEDEF calls check_typedef, which already goes through chains
of typedefs, so you can get rid of the loop in get_type. So I would
rewrite get_type as follows:
static struct type *
get_type (struct varobj *var)
{
struct type *type;
type = var->type;
if (type != NULL)
CHECK_TYPEDEF (type);
return type;
}
And I don't think you should change get_type_deref at all, but you
should change get_target_type as follows:
static struct type *
get_target_type (struct type *type)
{
if (type != NULL)
{
type = TYPE_TARGET_TYPE (type);
if (type != NULL)
CHECK_TYPEDEF (type);
}
return type;
}
(I do wonder a bit if all of those "type != NULL" checks are
necessary, but that's a separate question.)
I'm not qualified to approve these patches, but the idea seems obvious
to me.
David Carlton
carlton@math.stanford.edu