From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 105856 invoked by alias); 12 Nov 2017 21:00:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 105819 invoked by uid 89); 12 Nov 2017 21:00:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 12 Nov 2017 21:00:31 +0000 Received: from [10.0.0.11] (192-222-251-162.qc.cable.ebox.net [192.222.251.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A3BC81E030; Sun, 12 Nov 2017 16:00:29 -0500 (EST) Subject: Re: [PATCHv4 5/5] gdb: Don't store a thread-id for floating varobj To: Andrew Burgess , gdb-patches@sourceware.org Cc: donb@codesourcery.com References: <13a59257b858ddb9d6689afd5f454c479a6f9c5d.1508418720.git.andrew.burgess@embecosm.com> From: Simon Marchi Message-ID: <82ababed-f013-5b49-f6ec-354e17b33c90@simark.ca> Date: Sun, 12 Nov 2017 21:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <13a59257b858ddb9d6689afd5f454c479a6f9c5d.1508418720.git.andrew.burgess@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-11/txt/msg00230.txt.bz2 On 2017-10-19 09:27 AM, Andrew Burgess wrote: > When creating a varobj with -var-create a user can create either fixed > varobj, or floating varobj. > > A fixed varobj will always be evaluated within the thread/frame/block in > which the varobj was created, if that thread/frame/block is no longer > available then the varobj is considered out of scope. > > A floating varobj will always be evaluated within the current > thread/frame/block. > > Despite never using them GDB was storing the thread/frame/block into a > floating varobj, and the thread-id would then be displayed when GDB > reported on the state of the varobj, this could confuse a user into > thinking that the thread-id was relevant. > > This commit prevents GDB storing the thread/frame/block onto floating > varobj, and updates the few tests where this impacts the results. > > gdb/ChangeLog: > > * varobj.c (varobj_create): Don't set valid_block when creating a > floating varobj. > > gdb/testsuite/ChangeLog: > > * gdb.python/py-mi.exp: Don't expect a thread-id for floating > varobj. > * gdb.mi/mi-var-create-rtti.exp: Likewise. > --- > gdb/ChangeLog | 5 +++++ > gdb/testsuite/ChangeLog | 6 ++++++ > gdb/testsuite/gdb.mi/mi-var-create-rtti.exp | 2 +- > gdb/testsuite/gdb.python/py-mi.exp | 12 ++++++------ > gdb/varobj.c | 3 ++- > 5 files changed, 20 insertions(+), 8 deletions(-) > > diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp > index afc9c248ae..85ead72e7b 100644 > --- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp > +++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp > @@ -52,6 +52,6 @@ mi_gdb_test "-var-create sp1 * ((void*)\$sp)" \ > "\\^done,name=\"sp1\",numchild=\"0\",value=\"$hex\",type=\"void \\*\",thread-id=\"$decimal\",has_more=\"0\"" \ > "-var-create sp1 * \$sp" > mi_gdb_test "-var-create sp2 @ ((void*)\$sp)" \ > - "\\^done,name=\"sp2\",numchild=\"0\",value=\"$hex\",type=\"void \\*\",thread-id=\"$decimal\",has_more=\"0\"" \ > + "\\^done,name=\"sp2\",numchild=\"0\",value=\"$hex\",type=\"void \\*\",has_more=\"0\"" \ > "-var-create sp2 @ \$sp" > gdb_exit > diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp > index 736dc7a0d6..aa9a2f12a2 100644 > --- a/gdb/testsuite/gdb.python/py-mi.exp > +++ b/gdb/testsuite/gdb.python/py-mi.exp > @@ -101,7 +101,7 @@ mi_varobj_update_dynamic container "varobj update 1" { > type_changed false new_num_children 1 dynamic 1 has_more 0 > } { > } { > - { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 } > + { name {container.\[0\]} exp {\[0\]} numchild 0 type int } > } > > mi_next "next over update 2" > @@ -110,7 +110,7 @@ mi_varobj_update_dynamic container "varobj update 2" { > type_changed false new_num_children 2 dynamic 1 has_more 0 > } { > } { > - { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 } > + { name {container.\[1\]} exp {\[1\]} numchild 0 type int } > } > > mi_gdb_test "-var-set-visualizer container None" \ > @@ -129,8 +129,8 @@ mi_varobj_update_dynamic container "varobj update after choosing default" { > type_changed false new_num_children 2 dynamic 1 has_more 0 > } { > } { > - { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 } > - { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 } > + { name {container.\[0\]} exp {\[0\]} numchild 0 type int } > + { name {container.\[1\]} exp {\[1\]} numchild 0 type int } > } > > mi_gdb_test "-var-set-visualizer container ContainerPrinter" \ > @@ -142,8 +142,8 @@ mi_varobj_update_dynamic container \ > type_changed false new_num_children 2 dynamic 1 has_more 0 > } { > } { > - { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 } > - { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 } > + { name {container.\[0\]} exp {\[0\]} numchild 0 type int } > + { name {container.\[1\]} exp {\[1\]} numchild 0 type int } > } > > mi_list_varobj_children_range container 1 2 2 { > diff --git a/gdb/varobj.c b/gdb/varobj.c > index d8b927ef4f..ee555b39ac 100644 > --- a/gdb/varobj.c > +++ b/gdb/varobj.c > @@ -351,7 +351,8 @@ varobj_create (const char *objname, > } > > var->format = variable_default_display (var); > - var->root->valid_block = innermost_block.block (); > + var->root->valid_block = > + var->root->floating ? NULL : innermost_block.block (); > var->name = expression; > /* For a root var, the name and the expr are the same. */ > var->path_expr = expression; > This LGTM. Simon