[mi] fix 'editable' attribute for references

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[mi] fix 'editable' attribute for references

Vladimir Prus

I've noticed that the -var-show-references returns 'attr=noneditable' for structures,
but 'attr=editable' for references to structures, which makes no sense.

This patch fixes this.

Some clarification is is order. Each varobj has three types associated with it.
One type is the declared type in the source program. Second type
is the type of the value we're actually storing. Third type is the type of value
we're operating with when getting children.

To be more concrete, first type is the type in program, no changes at all.
Second type is type in program with top-level reference stripped.
Third type also has top-level pointer dereferenced.

This patch introduces, explicitly, a function to get the second type
and makes c_variable_ediatable use it.

OK?

- Volodya

        Fix the 'editable' attribute computation
        for references.

        testsuite/
        * gdb.mi/mi-var-cp.exp: Run the reference_to_struct
        testcase.
        * gdb.mi/mi-var-cp.cc (reference_to_struct): New function.
        (main): Call the above.

        gdb/
        * varobj.c (get_value_type): New function.
        (c_variable_editable): Use get_value_type.

path_3_5_references__gdb_mainline.diff (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [mi] fix 'editable' attribute for references

Vladimir Prus
Vladimir Prus wrote:

>
> I've noticed that the -var-show-references returns 'attr=noneditable' for
> structures, but 'attr=editable' for references to structures, which makes
> no sense.

I've also noticed that while for structures, we don't compare old
and new values, and never report varobj corresponding to structure as
changed, we do all that for references to structures. This patch fixes
both problems, OK?

- Volodya

        Fix the 'editable' attribute computation
        for references.

        testsuite/
        * lib/mi-support.exp (mi_delete_varobj): New.
        * gdb.mi/mi-var-cp.exp: Run the reference_to_struct
        testcase.
        * gdb.mi/mi-var-cp.cc (reference_to_struct): New function.
        (main): Call the above.
        (reference_update_test, base_in_reference_test)
        (reference_to_pointer): Delete the created varobjs.

        gdb/
        * varobj.c (get_value_type): New function.
        (c_variable_editable): Use get_value_type.
        (varobj_value_is_changeable): Likewise.

path_3_5_references__gdb_mainline.diff (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [mi] fix 'editable' attribute for references

Daniel Jacobowitz-2
On Tue, Jan 16, 2007 at 10:06:30PM +0300, Vladimir Prus wrote:

> Vladimir Prus wrote:
>
> >
> > I've noticed that the -var-show-references returns 'attr=noneditable' for
> > structures, but 'attr=editable' for references to structures, which makes
> > no sense.
>
> I've also noticed that while for structures, we don't compare old
> and new values, and never report varobj corresponding to structure as
> changed, we do all that for references to structures. This patch fixes
> both problems, OK?

This is included in the C++ references patch I just reviewed, right?


--
Daniel Jacobowitz
CodeSourcery
Reply | Threaded
Open this post in threaded view
|

Re: [mi] fix 'editable' attribute for references

Vladimir Prus
Daniel Jacobowitz wrote:

> On Tue, Jan 16, 2007 at 10:06:30PM +0300, Vladimir Prus wrote:
>> Vladimir Prus wrote:
>>
>> >
>> > I've noticed that the -var-show-references returns 'attr=noneditable'
>> > for structures, but 'attr=editable' for references to structures, which
>> > makes no sense.
>>
>> I've also noticed that while for structures, we don't compare old
>> and new values, and never report varobj corresponding to structure as
>> changed, we do all that for references to structures. This patch fixes
>> both problems, OK?
>
> This is included in the C++ references patch I just reviewed, right?

Grr, right. I meant to post them as completely separate patches to ease review,
but messed that up and you've reviewed combined patch.

My only excuse is that I'll still commit those as separate patches, so that
at least the history is right.

- Volodya


Reply | Threaded
Open this post in threaded view
|

Re: [mi] fix 'editable' attribute for references

Vladimir Prus
Vladimir Prus wrote:

>>> I've also noticed that while for structures, we don't compare old
>>> and new values, and never report varobj corresponding to structure as
>>> changed, we do all that for references to structures. This patch fixes
>>> both problems, OK?
>>
>> This is included in the C++ references patch I just reviewed, right?
>
> Grr, right. I meant to post them as completely separate patches to ease
> review, but messed that up and you've reviewed combined patch.
>
> My only excuse is that I'll still commit those as separate patches, so
> that at least the history is right.
Here's the version of the patch that was just checked in. Differs only
by extra check_typedef, per your other email.

- Volodya


path_3_5_as_checked_in.diff (6K) Download Attachment