From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21054 invoked by alias); 27 Nov 2006 23:30:40 -0000 Received: (qmail 21035 invoked by uid 22791); 27 Nov 2006 23:30:39 -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; Mon, 27 Nov 2006 23:30:35 +0000 Received: (qmail 11378 invoked from network); 27 Nov 2006 23:30:33 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 27 Nov 2006 23:30:33 -0000 To: Gary Funck Cc: gdb@sourceware.org Subject: Re: how to support C type qualifiers applied to arrays? References: <200611272217.kARMHtw3023324@intrepid.intrepid.com> <20061127230948.GA19798@nevyn.them.org> From: Jim Blandy Date: Mon, 27 Nov 2006 23:30:00 -0000 In-Reply-To: <20061127230948.GA19798@nevyn.them.org> (Daniel Jacobowitz's message of "Mon, 27 Nov 2006 18:09:48 -0500") 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-11/txt/msg00187.txt.bz2 Daniel Jacobowitz writes: > On Mon, Nov 27, 2006 at 02:42:12PM -0800, Gary Funck wrote: >> Q: Is GCC generating an inaccurate DWARF 2 representation >> to describe a qualified array type, or is GDB not >> interpreting the DWARF 2 information correctly? > > I will defer to experts on this but I believe GCC is incorrect. I think GCC is wrong, too. The DWARF is unambiguous, and it's attaching the qualifiers to the wrong part of the type tree, just as Daniel says. > My first recommendation would be to have make_cv_type create a new > array type, with the qualified element type. However, doing this > without being excessively wasteful might require care - you couldn't > reuse main_type since the qualified array could not share main_type. > But the waste is acceptably small. If this were a less obscure feature, then I could see GDB deliberately misreading the DWARF to accomodate GCC. But in this case, it doesn't seem like a show-stopper; wouldn't it be better to just report the GCC bug and let GDB continue to interpret DWARF as written? These kludges come back to haunt us. I gather Gary is working with a modified GCC anyway, so it shouldn't be hard for him to fix his compiler. (If that's not so, Gary, please set me straight.)