From patchwork Tue Jan 2 15:31:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 25181 Received: (qmail 47392 invoked by alias); 2 Jan 2018 15:32:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 47288 invoked by uid 89); 2 Jan 2018 15:32:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:contain, sp2, 1428 X-HELO: mail-wr0-f178.google.com Received: from mail-wr0-f178.google.com (HELO mail-wr0-f178.google.com) (209.85.128.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 Jan 2018 15:32:00 +0000 Received: by mail-wr0-f178.google.com with SMTP id p17so25119363wre.7 for ; Tue, 02 Jan 2018 07:31:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4W6aevw1nSdpdq6ijKhSAdfV9i/raHxGx0D4+QKFKLQ=; b=UHzasImPkhR5mOSttn83aeqnr6prMrKbQCJOKToQ+E5bKKetO8jOXekszXllEkFofP +nb8pcgze3ZXc67JIiGqkXpqyIxZhCMqz2Fffkpb8fNFhzO8DhzZ0U+oPvRKKBxj2Kko OfkLf5v6iliwHuZSN+oBHKG6RLe/LJoaahe1paKe9UNATk95luZAsh4VvPxoSlCKKNLa C9Yipz8pNzEwG0o01/9Jhs6PPqdO07ObjLcE7uSdczOyx0hfComQw+l4HW0QXGgwAdUO XGVXmJyOChhlNAzpra123HCEiEli/Z+KIX6/FzLjp2eNII7VGfvb5Ma/98n/z+IdIbHY bsaQ== X-Gm-Message-State: AKGB3mJyW5ushfYTU4HgKP5g6NTWdzknhmw0ucSxis++Jj2fmvd5sWmW lWmieeDWhUyGGtVPos5Rhg0jL+Q2 X-Google-Smtp-Source: ACJfBot2dh9r7QugGqyaWKiV473r4kOwLVu1ftqCpg7s2lIk3hH4GV1/iYSyrU6o1fUN/sNi1P2zPQ== X-Received: by 10.223.174.174 with SMTP id y43mr43554980wrc.196.1514907117985; Tue, 02 Jan 2018 07:31:57 -0800 (PST) Received: from localhost ([81.141.199.69]) by smtp.gmail.com with ESMTPSA id f19sm14456816wmf.5.2018.01.02.07.31.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2018 07:31:57 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: donb@codesourcery.com, simark@simark.ca, palves@redhat.com, Andrew Burgess Subject: [PATCHv5 5/5] gdb: Don't store a thread-id for floating varobj Date: Tue, 2 Jan 2018 15:31:48 +0000 Message-Id: <51d6a9615ebc346b6a6b7051238172fe9809f8fe.1514905848.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes 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 9ea5784bcad..a5310ecc819 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 0ecc5dfa13d..bbe1266724a 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 7d3800b2a48..97d9f5b6c5c 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -336,7 +336,8 @@ varobj_create (const char *objname, } var->format = variable_default_display (var.get ()); - 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;