From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29729 invoked by alias); 27 Oct 2010 17:28:55 -0000 Received: (qmail 29719 invoked by uid 22791); 27 Oct 2010 17:28:54 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Wed, 27 Oct 2010 17:28:47 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9RHSjst014978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Oct 2010 13:28:45 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o9RHSgtb006748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 27 Oct 2010 13:28:44 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o9RH3SWL011983; Wed, 27 Oct 2010 19:03:28 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o9RH3R79011982; Wed, 27 Oct 2010 13:03:27 -0400 Date: Wed, 27 Oct 2010 17:28:00 -0000 From: Jan Kratochvil To: Eran Ifrah Cc: gdb@sourceware.org Subject: Re: GDB/MI - var-update/create BUG Message-ID: <20101027170327.GA11455@host1.dyn.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00109.txt.bz2 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, normally you want to track that _variable_, not that _name_. Anywhere you are. You should use '@' instead of '*' for frame if you want to track it by name, see "floating" in: info '(gdb)GDB/MI Variable Objects' Thanks, Jan g++ -o 2 2.C -Wall -g gdb -nx -i=mi <2.cmd ./2 ==> 2.C <== #include void foo() { std::string mystr = " second value "; mystr += " appended content"; } int main(int argc, char **argv) { std::string mystr = " first value "; foo(); mystr += " appended content"; return 0; } ==> 2.cmd <== -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="0x601028 \" first value \"" ==> 2-floating.cmd <== -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="0x601058 \" second value \""