This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: MI: fix base members in references
On Wed, Dec 06, 2006 at 10:21:06AM +1300, Nick Roberts wrote:
> The comment in varobj.c refers to "Baseclass" and I presume the original author
> included the case
>
> TYPE_CODE (value_type (parent->value)) == TYPE_CODE_REF
>
> for a specific reason.
Probably, but as Vlad's explanation is correct, either the original
author was wrong or the behavior of value_ind has changed. Something
in this code should change, but see below.
On Tue, Dec 05, 2006 at 01:33:12PM -0800, Jim Blandy wrote:
> (By the way --- it's handy to include a link to the post with the
> patch, or ideally the patch itself.)
Is a threading mailer really so much to ask? :-)
> How should this behave if parent->value is a reference to a pointer?
> Shouldn't it follow the ref, and then behave the same as when it's a
> pointer? If so, then the fix would be something like this instead
> (not that I understand this code):
If this is always the same values affected by Vlad's other patch which
calls coerce_ref when setting the value, then maybe we should just be
asserting there is no reference here after that patch.
> --- 2426,2439 ----
> /* Baseclass */
> if (parent->value != NULL)
> {
> ! struct value *temp = coerce_ref (parent->value);
>
> ! if (TYPE_CODE (value_type (temp)) == TYPE_CODE_PTR
> ! || TYPE_CODE (value_type (temp)) == TYPE_CODE_REF)
> {
> ! if (!gdb_value_ind (temp, &temp))
> return NULL;
In any case, you can drop the TYPE_CODE_REF check if you do it this
way.
--
Daniel Jacobowitz
CodeSourcery