From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21099 invoked by alias); 11 Jul 2002 19:13:45 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21092 invoked from network); 11 Jul 2002 19:13:44 -0000 Received: from unknown (HELO mta6.snfc21.pbi.net) (206.13.28.240) by sources.redhat.com with SMTP; 11 Jul 2002 19:13:44 -0000 Received: from modrick ([66.120.11.181]) by mta6.snfc21.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with SMTP id <0GZ300I3MMQPG4@mta6.snfc21.pbi.net> for gdb@sources.redhat.com; Thu, 11 Jul 2002 12:13:44 -0700 (PDT) Date: Thu, 11 Jul 2002 12:13:00 -0000 From: Mo DeJong Subject: Re: Problem with MI -var-evaluate-expression command In-reply-to: To: gdb@sources.redhat.com Message-id: <20020711121839.275ae39f.supermo@bayarea.net> Organization: House of Mirth MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit References: <20020710171957.5e657753.supermo@bayarea.net> X-SW-Source: 2002-07/txt/msg00117.txt.bz2 On Wed, 10 Jul 2002 17:31:11 -0700 (PDT) Keith Seitz wrote: > How is a UI to know what the children of svar are? You do, because you're > a human, but a UI reacting programmatically could not automatically know > that svar has a child named "v1" _until_ it asks svar for its children > (thus creating the varobjs). ... > Now, when the user hits the "+", Insight will ask the varobj for its > children. It gets back a list of varobjs. It then repeats steps 2-5 for > each of these new varobjs. It sounds like that works just fine for a watch window where each child will be displayed. I just wonder if that is the only valid use case. I am looking at building a scripting interface to the gdb/mi, so I don't need watch window semantics just now. My reading of the docs seems to indicate that the variable objects interface is an improvement over just evaluating plain expressions since the same "syntax" would be used to access C, C++, or Java objects with children. I also liked the fact that you could set the format of the returned value and then pass the whole "var object" around from one function to another. That said, this -var-evaluate-expression children thing has got me thinking that I should just stick with -data-evaluate-expression and skip the -var-* methods. Here is why. One can evaluate an expression like so quite easily: -data-evaluate-expression "objPtr->member1->dataPtr->bytes" But to do this same thing with a variable object I would need to send these commands. -var-create objPtr * "objPtr" -var-list-children objPtr -var-list-children objPtr.member1 -var-list-children objPtr.member1.dataPtr -var-evaluate-expression objPtr.member1.dataPtr.bytes Now, I could keep my own record of the variables that "know" what their children are and check this record every time a variable is accessed from my API. But, that just strikes me as really ugly and it seems to waste a lot of bandwidth. I don't have a problem with leaving support for the -var-* methods out of my wrapper because of this issue, I just thought I would bring it up. In any event, the docs for the -var-evaluate-expression should be updated to explicitly state that the user needs to call -var-list-children for a variable object before accessing any children. Mo