From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30210 invoked by alias); 2 Jan 2012 21:03:42 -0000 Received: (qmail 30201 invoked by uid 22791); 2 Jan 2012 21:03:41 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Jan 2012 21:03:21 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q02L2u8B022389 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 2 Jan 2012 16:02:56 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q02L2tji012399; Mon, 2 Jan 2012 16:02:55 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q02L2rme021100; Mon, 2 Jan 2012 16:02:53 -0500 From: Tom Tromey To: Joel Brobecker Cc: gdb-patches@sourceware.org, vladimir@codesourcery.com Subject: Re: RFC: how to handle mutable types in varobj? References: <20111228155943.GD2632@adacore.com> Date: Mon, 02 Jan 2012 21:03:00 -0000 In-Reply-To: <20111228155943.GD2632@adacore.com> (Joel Brobecker's message of "Wed, 28 Dec 2011 19:59:43 +0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 X-SW-Source: 2012-01/txt/msg00066.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> Purely based on the reading of the documentation and then the code, Joel> I think that mutable types haven't been considered in the original Joel> design Yeah, I agree. The weird access protection stuff makes me think that perhaps C++ also wasn't considered -- IMNSHO this should be represented via attributes on the various fields, not phony intermediate varobjs. Joel> It also seems that support for Python pretty-printing Joel> has been crafted on to varobj, and indirectly introduced the notion Joel> of dynamicity, which is probably similar in some ways to our mutability. Joel> But I am also guessing that this support was implemented in a way Joel> that kept things compatible at the GDB/MI level. As a result, I am Joel> having a hard time building a good overal picture of how things work, Joel> partly because there are so many flags: children_requested, from, to, Joel> type_changed, updated, changedm children_changed, etc. The spaghetti is at least partly my fault. Sorry about that. TBH I found hacking varobj to be quite difficult. You are right that dynamic varobjs were introduced to maintain compatibility. If the client does not send -enable-pretty-printing, then no dynamic varobj will ever be created. The idea is that dynamic varobjs require some special client handling, so clients have to explicitly request them. Joel> The careful reader will also notice that I'm having trouble with Joel> figuring out some invariants regarding the `from' and `to' fields Joel> with respect to the `num_children' field... More stuff to be figured Joel> out later... 'from' and 'to' are set by the MI client. See -var-list-children and -var-set-update-range. I think these only really make sense for dynamic varobjs, but maybe they work with any varobj, I don't recall. I don't remember how 'num_children' is used any more. Pedro> So, I factored out the "listing dynamic varobj's Pedro> children" code behind a common interface, making use of a new Pedro> iterator "virtual" object (struct varobj_iter), and reimplemented Pedro> both pretty-printing varobjs and available-children-only varobjs using Pedro> that same interface. Sounds nice. Pedro> Implementing Ada mutable types support through this would mean mutable Pedro> varobjs would be exposed as dynamic=1 varobjs. I'm not sure that'd be Pedro> a problem? With frontends that currently support dynamic varobjs, Pedro> things should simply work. I think the only caveat is that it has to be requested. But, presumably Joel has a particular client in mind. And, anyway, clients not supporting dynamic varobjs are really missing out. Pedro> Non dynamic varobjs were kind of a mistake Pedro> anyway (a !dynamic varobj that is bound to an 10000000 element array Pedro> is wholly fetched in gdb memory at once...). Yeah. Tom