From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3629 invoked by alias); 11 Jul 2002 00:31:12 -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 3622 invoked from network); 11 Jul 2002 00:31:12 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 11 Jul 2002 00:31:12 -0000 Received: from makita.cygnus.com (makita.sfbay.redhat.com [192.168.30.83]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id RAA04950; Wed, 10 Jul 2002 17:31:11 -0700 (PDT) Received: from localhost (keiths@localhost) by makita.cygnus.com (8.8.8+Sun/8.6.4) with ESMTP id RAA19557; Wed, 10 Jul 2002 17:31:11 -0700 (PDT) X-Authentication-Warning: makita.cygnus.com: keiths owned process doing -bs Date: Wed, 10 Jul 2002 17:31:00 -0000 From: Keith Seitz X-X-Sender: To: Mo DeJong cc: gdb Subject: Re: Problem with MI -var-evaluate-expression command In-Reply-To: <20020710171957.5e657753.supermo@bayarea.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-07/txt/msg00113.txt.bz2 On Wed, 10 Jul 2002, Mo DeJong wrote: > % cat S.c > struct S { > int v1; > int v2; > }; > > -var-create svar * "(struct S *) 0x8049560" > ^done,name="svar",numchild="2",type="struct S *" > (gdb) > -var-evaluate-expression svar > ^done,value="0x8049560" > (gdb) > -var-evaluate-expression svar.v1 > &"Variable object not found\n" > ^error,msg="Variable object not found" 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). Remember, we're dealing with VARiable OBJects here. You cannot do anything without a varobj. Insight is the major client for this code right now. (In fact varobj was originally written for Insight, but it appeared to be useful to someone else, and it was added to MI.) Here's what Insight does: Given the expression "svar" which is perhaps supplied by "info locals", "-stack-list-locals", or from the user inputting it as a watch, a UI would: 1) Create varobj for (the expression) "svar" 2) Ask the varobj for a display name and stuff this into a column of the display 3) Ask the varobj for its type and stuff that into a column 4) Ask the varobj for its value and stuff that into a column 5) Ask the varobj if it has any children. If it does, it puts a little "+" next to the name, so that the user can expand it. 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. In practice, I think it works quite well, but I may be a little biased, since I originally wrote varobj for Insight. ;-) Keith