From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15418 invoked by alias); 7 Sep 2005 05:40:00 -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 14639 invoked by uid 22791); 7 Sep 2005 05:39:52 -0000 Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 07 Sep 2005 05:39:52 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id 3D48D48CD95 for ; Wed, 7 Sep 2005 01:39:51 -0400 (EDT) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11815-01-4 for ; Wed, 7 Sep 2005 01:39:51 -0400 (EDT) Received: from takamaka.act-europe.fr (s142-179-108-108.bc.hsia.telus.net [142.179.108.108]) by nile.gnat.com (Postfix) with ESMTP id E371848CD93 for ; Wed, 7 Sep 2005 01:39:50 -0400 (EDT) Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 783E247E74; Tue, 6 Sep 2005 22:39:51 -0700 (PDT) Date: Wed, 07 Sep 2005 05:40:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] print arrays with indexes Message-ID: <20050907053951.GC1540@adacore.com> References: <20050906202018.GC1153@adacore.com> <20050906205710.GA12715@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050906205710.GA12715@nevyn.them.org> User-Agent: Mutt/1.4i X-SW-Source: 2005-09/txt/msg00044.txt.bz2 > In fact, C99 allows: > int A[3] = { [1] = 2 }; > > GNU C has supported it for a while, I think. I don't think it works > for C++. Aha! Thanks for the tip. > So, yes, a language method would be good. Ok, how about calling it la_print_array_index? The current language_defn structure already la_printchar and la_printstr (no "_" between print and the object name), but I think using underscores is that much clearer in this case. void (*la_print_array_index) (struct value *index_value, struct ui_file *stream, int format, enum val_prettyprint pretty); I'll then define a new LA_PRINT_ARRAY_INDEX macro #define LA_PRINT_ARRAY_INDEX (index_value, stream, format, pretty) \ (current_language->la_print_array_index(index_value, stream, format, pretty)) > > (gdb) set/show print array-indexes > > > > With a default of "off", to preserve the current behavior. > > I suppose we've got to :-) I'd turn it on, that's for sure. There is also Jim's suggestion which has some merits. I'm more of an all or nothing kind of guy, so I prefer the approach I've chosen, but I am flexible. > Afraid I haven't time to look at the patch just now. I'll be back. Sure. Thanks for the early feedback. -- Joel