From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9238 invoked by alias); 22 Nov 2013 13:28:39 -0000 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 Received: (qmail 9226 invoked by uid 89); 22 Nov 2013 13:28:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.2 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Nov 2013 13:28:36 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAMDSQD6031638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 22 Nov 2013 08:28:27 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rAMDSPcb002782; Fri, 22 Nov 2013 08:28:26 -0500 Message-ID: <528F5BF8.1020906@redhat.com> Date: Fri, 22 Nov 2013 13:28:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yao Qi CC: "gdb@sourceware.org" Subject: Re: semantics of dynamic varobj References: <528F5839.4050100@codesourcery.com> In-Reply-To: <528F5839.4050100@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-11/txt/msg00084.txt.bz2 On 11/22/2013 01:12 PM, Yao Qi wrote: > Nowadays, if a varobj's contents are provided by pretty-printer, it is > called dynamic varobj. However, it is unclear to me what is a dynamic > varobj? What is the "dynamic" part of dynamic varobj? the children? > > IIUC, the children of dynamic varobj vary. That is why returned > attributed 'numchild' of -var-create is "not necessarily reliable", right? Right. With a dynamic varobj, you don't know how many children are there upfront. You only know there may be more, so you fetch more until no more children are found. It works like an iterator. > I ask these questions because I am adding a new kind of dynamic varobj, > whose contents are provided by only available data. For example, > > struct foo > { > int a, b, c; > }; > struct foo foo; > > foo.a and foo.c is collected in traceframe #1, while foo.b is collected > in traceframe #2. We create a varobj foo for variable foo, if > traceframe is #1, foo has two children (foo.a and foo.c), if traceframe > is #2, foo has one child (foo.b). IMO, varobj foo behaves like a > dynamic varobj. Right. We only know whether a child is available or not when we go and try to read it, so we can't know which children are available upfront. The (Mentor) code for this was all modelled/shared on/with dynamic varobjs because of this. -- Pedro Alves