From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32222 invoked by alias); 27 Dec 2006 02:12:13 -0000 Received: (qmail 32212 invoked by uid 22791); 27 Dec 2006 02:12:12 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 27 Dec 2006 02:12:08 +0000 Received: (qmail 5103 invoked from network); 27 Dec 2006 02:12:06 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Dec 2006 02:12:06 -0000 To: "Gary Funck" Cc: , "'Daniel Jacobowitz'" , "'Jim Wilson'" Subject: Re: how to support C type qualifiers applied to arrays? References: <004901c723e0$303c67a0$0a0a0a0a@DELORIAN> From: Jim Blandy Date: Wed, 27 Dec 2006 02:12:00 -0000 In-Reply-To: <004901c723e0$303c67a0$0a0a0a0a@DELORIAN> (Gary Funck's message of "Tue, 19 Dec 2006 18:40:15 -0800") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00212.txt.bz2 "Gary Funck" writes: >> From: Jim Blandy >> Sent: Friday, December 15, 2006 2:37 PM >> >> "Gary Funck" 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.