From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27306 invoked by alias); 9 Jan 2014 03:06:05 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 27297 invoked by uid 89); 9 Jan 2014 03:06:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 09 Jan 2014 03:06:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id DAB4E1166CC; Wed, 8 Jan 2014 22:06:01 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id SBLrK-XOtDAU; Wed, 8 Jan 2014 22:06:01 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 8210C1166C3; Wed, 8 Jan 2014 22:06:01 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 2FC81E0B70; Thu, 9 Jan 2014 07:05:57 +0400 (RET) Date: Thu, 09 Jan 2014 03:06:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [commit/Ada] General ada-valprint improvements Message-ID: <20140109030557.GS3802@adacore.com> References: <1389068515-10129-1-git-send-email-brobecker@adacore.com> <87r48jhfa8.fsf@fleche.redhat.com> <20140108113517.GL3802@adacore.com> <87txdecwgc.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87txdecwgc.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-01/txt/msg00224.txt.bz2 > I have an ancient branch where I took a stab at removing val_print. > It's a reasonably large patch and still doesn't even compile: > > 30 files changed, 262 insertions(+), 486 deletions(-) > > It's quite a big job and due to the way that most languages wind up > deferring to the C printer, I didn't see a nice way to do it > incrementally. I was afraid of that. For Ada, I have some hopes that I could re-implement val_print on top of value_print if I split ada_value_print. If that works out, and if we find we can transition all languages that way, perhaps that'll simplify the transition. While talking crazy-large cleanup projects, I have been having this idea in the back of my mind that I'd like the value printing to be done by a language-independent engine, with the language only providing decorations and hints. This is still very vague, and will require a lot of thinking before I can even start, but the triggering thought is varobj: varobj is already a generic object printing engine where, if you simplify a bit, the language only provides child access. Ideally, couldn't we extend that API to do exactly what each LANG-print.c does? For instance, the only difference between C structs and Ada records could be sumarized as: - C uses curly braces, while Ada uses parentheses - Ada likes to see the names of the fields So, if we could extract out the varobj engine, and then make varobj one formatter, and CLI-valprint another formatter, it seems like most of the valprint units such as ada-valprint could go away. -- Joel