List Info

Thread: how to support C type qualifiers applied to arrays?




how to support C type qualifiers applied to arrays?
user name
2006-12-27 02:12:20
"Gary Funck" <garyintrepid.com> writes:
>> From: Jim Blandy
>> Sent: Friday, December 15, 2006 2:37 PM
>> 
>> "Gary Funck" <garyintrepid.com> writes:
>> > Here, GCC sets TREE_THIS_VOLATILE in the DECL
node of S,
>> > but does not attempt to clone the type
description of
>> > s_struct, and to populate the volatile
qualifier across all
>> > contained member types.  This works for GCC
because it
>> > propagates the qualifiers as it evaluates
expressions.
>> > Thus when evaluating S.c[10], GCC starts with
the knowledge
>> > that S is volatile, thus S.c is volatile, and
S.c[1] is
>> > volatile.
>> 
>> Okay --- this is a different problem altogether. 
This one is indeed
>> GDB's fault: referring to a field of a volatile- or
const-qualified
>> structure should get you a member with the same
qualifiers.
>> [...]
>> > Typedefs above are used to illustrate that
"volatile" must
>> > be factored to the lowest level types of the
components,
>> > and must also appear at the struct level to
accommodate
>> > operations on the entire structure.
>> 
>> Just to be clear: GCC should *not* perform the
transformation you're
>> suggesting here and record the result in the DWARF
info.  GDB should
>> propagate the qualifiers itself.
>
> This leads to the next question: how difficult will it
be to
> teach GDB to properly track type qualifiers when
evaluating
> expressions?  Which files/functions will likely need to
be
> changed?  Are there mechanisms within GDB already that
track
> various value attributes along with the expression
values
> themselves?

I think that should be a pretty straightforward change to
value_primitive_field, value_subscripted_rvalue, and
probably
value_coerce_array.
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )