From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19311 invoked by alias); 3 Oct 2005 15:50:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19289 invoked by uid 22791); 3 Oct 2005 15:50:22 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 03 Oct 2005 15:50:22 +0000 Received: from drow by nevyn.them.org with local (Exim 4.52) id 1EMSa3-0006F3-TW; Mon, 03 Oct 2005 11:50:19 -0400 Date: Mon, 03 Oct 2005 15:50:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] print arrays with indexes Message-ID: <20051003155019.GA23854@nevyn.them.org> Mail-Followup-To: Joel Brobecker , gdb-patches@sources.redhat.com References: <20050920073058.GR2496@adacore.com> <20050920193132.GY2496@adacore.com> <20050920193339.GA28294@nevyn.them.org> <20050920193918.GB10186@adacore.com> <20050922164622.GF5841@adacore.com> <20050926012259.GA22284@nevyn.them.org> <20050927010420.GW922@adacore.com> <20051002224218.GA3083@nevyn.them.org> <20051003061733.GL938@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051003061733.GL938@adacore.com> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-10/txt/msg00024.txt.bz2 On Sun, Oct 02, 2005 at 11:17:33PM -0700, Joel Brobecker wrote: > > Should the "return 0;" cases in get_array_low_bound be errors? Or even > > internal errors (probably not)? > > I don't think we should use an internal error in this case, since the > erroneous situation can also come from incorrect debugging information. > In this case, it would be misleading to label this as an internal error > when the problem is outside the debugger. > > I wouldn't use an error in this case either, as it allows us to emit > a warning instead, and recover in a way that at least allows us to > print the array. Otherwise, it's more complicated to still print the > array. > > So I would leave this unchanged. Or perhaps a little comment addition > before the function, along with the description, explaining the above? A comment would be nice. With that change, the patch (and testcase and docs) are OK. > > There's already lots of code that uses TYPE_LOW_BOUND (TYPE_INDEX_TYPE > > (array_type)). If that's not valid, we need to know why not. > > The new function does essentially this, except that it adds a bit > of double-checking, probably to avoid falling in a trap laid by > incorrect debugging information. Nick was recently writing some code that needed the bounds of an array. We found three or four different idioms for finding this used throughout the GDB source. Figuring out which ones are right and which ones are obsolete is a royal pain. That's my only concern here. -- Daniel Jacobowitz CodeSourcery, LLC