This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: how to support C type qualifiers applied to arrays?
- From: "Gary Funck" <gary at intrepid dot com>
- To: <gdb at sourceware dot org>
- Cc: "'Daniel Jacobowitz'" <drow at false dot org>, "'Jim Wilson'" <wilson at specifix dot com>, "'Jim Blandy'" <jimb at codesourcery dot com>
- Date: Tue, 19 Dec 2006 18:40:15 -0800
- Subject: RE: how to support C type qualifiers applied to arrays?
> From: Jim Blandy
> Sent: Friday, December 15, 2006 2:37 PM
>
> "Gary Funck" <gary@intrepid.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?