From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24723 invoked by alias); 27 Oct 2010 17:18:11 -0000 Received: (qmail 24706 invoked by uid 22791); 27 Oct 2010 17:18:09 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-qw0-f41.google.com (HELO mail-qw0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Oct 2010 17:18:02 +0000 Received: by qwi2 with SMTP id 2so933241qwi.0 for ; Wed, 27 Oct 2010 10:17:59 -0700 (PDT) Received: by 10.224.210.2 with SMTP id gi2mr2589313qab.34.1288199879850; Wed, 27 Oct 2010 10:17:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.191.131 with HTTP; Wed, 27 Oct 2010 10:17:39 -0700 (PDT) In-Reply-To: <20101027170327.GA11455@host1.dyn.jankratochvil.net> References: <20101027170327.GA11455@host1.dyn.jankratochvil.net> From: Eran Ifrah Date: Wed, 27 Oct 2010 17:18:00 -0000 Message-ID: Subject: Re: GDB/MI - var-update/create BUG To: Jan Kratochvil , gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2010-10/txt/msg00108.txt.bz2 On Wed, Oct 27, 2010 at 7:03 PM, Jan Kratochvil wrote: > On Tue, 26 Oct 2010 18:01:30 -0400, Eran Ifrah wrote: >> If I have a local variable with the same name in different scopes, >> when switching between the scopes the content of the variable object >> does not reflect the new variable. > > This is correct from the GDB's point of view, As you can see from the my signature I am coming from the IDE point-of-view. > normally you want to track that > _variable_, not that _name_. Anywhere you are. > Not really, thats depends on what you are trying to achieve - since variable object were designed to ease the task of the IDE, then I say this is incorrect (at least to me). In my case, I actually never want to track 'variable object' I want to track 'expressions' in the code. In codelite IDE, there are 3 main views which use the 'Variable Objects': - The Locals view - Watches (user adds expressions) - The debugger tooltip (codelite uses a tree form tree which suits perfectly with the variable object concept) As for the 'Locals' view, I would expect the variable-object to present the values based on the expression used during the creation of the variable object, otherwise it does not make any sense of putting it in the Locals view in the first place. For the 'watches' view (which are more of a 'persistent' entries) it make sense to use the scope of creation - but this is also debatable. I am currently using floating variable object in the watches view and it seems "natural" to me The tooltip - well its nature is a transient window, so it does not really matter - since the variable object is destroyed as soon as the tool tip is dismissed. > You should use '@' instead of '*' for frame if you want to track it by na= me, > see "floating" in: info '(gdb)GDB/MI Variable Objects' > Already did and it is working as expected > > Thanks, > Jan > > > g++ -o 2 2.C -Wall -g > gdb -nx -i=3Dmi <2.cmd ./2 > > =3D=3D> 2.C <=3D=3D > #include > void foo() { > =A0 =A0 =A0 =A0std::string mystr =3D " second value "; > =A0 =A0 =A0 =A0mystr +=3D " appended content"; > } > int main(int argc, char **argv) { > =A0 =A0 =A0 =A0std::string mystr =3D " first value "; > =A0 =A0 =A0 =A0foo(); > =A0 =A0 =A0 =A0mystr +=3D " appended content"; > =A0 =A0 =A0 =A0return 0; > } > > =3D=3D> 2.cmd <=3D=3D > -break-insert -t 8 > -exec-run > -var-create - * mystr._M_dataplus._M_p > -break-insert -t 4 > -exec-continue > -var-update * > -var-evaluate-expression "var1" > > -> > ^done,value=3D"0x601028 \" first value \"" > > =3D=3D> 2-floating.cmd <=3D=3D > -break-insert -t 8 > -exec-run > -var-create - @ mystr._M_dataplus._M_p > -break-insert -t 4 > -exec-continue > -var-update * > -var-evaluate-expression "var1" > > -> > ^done,value=3D"0x601058 \" second value \"" > --=20 Eran Ifrah Cross platform, open source C++ IDE: http://www.codelite.org