From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30443 invoked by alias); 14 Feb 2014 08:46:51 -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 30286 invoked by uid 89); 14 Feb 2014 08:46:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Feb 2014 08:46:49 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WEEQ2-0006ll-DQ from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 14 Feb 2014 00:46:46 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 14 Feb 2014 00:46:46 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Fri, 14 Feb 2014 00:46:45 -0800 From: Yao Qi To: Subject: [PATCH 10/12] Match dynamic="1" in the output of -var-list-children Date: Fri, 14 Feb 2014 08:46:00 -0000 Message-ID: <1392367471-13527-11-git-send-email-yao@codesourcery.com> In-Reply-To: <1392367471-13527-1-git-send-email-yao@codesourcery.com> References: <1392367471-13527-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00495.txt.bz2 When I play with pretty-printer and available-children-only, I get the following output, -var-list-children ss1 ^done,numchild="2",children=[child={name="ss1.a",exp="a",numchild="0",type="struct s",thread-id="1",dynamic="1"},child={name="ss1.b",exp="b",numchild="0",type="struct s",thread-id="1",dynamic="1"}],has_more="0" existing proc mi_child_regexp doesn't append "dynamic=1" to the pattern, so it doesn't match output. This patch adds "dynamic=1" to the pattern. I am not satisfied with the regexp construction for each child in mi_child_regexp. In each list, there are three mandatory fields, "name", "exp", and "numchild". There are also some optional fields, "value", "type" and "dynamic". The current regexp construction code is hard to be extended (add for "dynamic"). I suggest that we can pass the list to mi_list_varobj_children like this, { name exp numchild optional } the list has four elements, and OPTIONAL is an array, which index can be "value", "type" or "dynamic". The existing usage of mi_list_varobj_children like: mi_list_varobj_children "struct_declarations" { {struct_declarations.integer integer 0 int} } "test" will be rewritten to: mi_list_varobj_children "struct_declarations" { {struct_declarations.integer integer 0 {type int}} } "test" if we want to match "dynamic" attribute, we can write: mi_list_varobj_children "struct_declarations" { {struct_declarations.integer integer 0 {type int dynamic 1}} } "test" Since mi_list_varobj_children has been widely used in test suite, I'd like to defer the change after this patch series. V2: - Remove empty 'else' block. gdb/testsuite: 2014-02-14 Yao Qi * lib/mi-support.exp (mi_child_regexp): Append 'dynamic="1"' to children_exp. --- gdb/testsuite/lib/mi-support.exp | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 1e8fee6..df68bd2 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1410,21 +1410,24 @@ proc mi_child_regexp {children add_child} { set name [lindex $item 0] set exp [lindex $item 1] set numchild [lindex $item 2] + + set line "$pre{name=\"$name\",exp=\"$exp\",numchild=\"$numchild\"" + if {[llength $item] == 5} { set type [lindex $item 3] set value [lindex $item 4] - lappend children_exp\ - "$pre{name=\"$name\",exp=\"$exp\",numchild=\"$numchild\",value=\"$value\",type=\"$type\"(,thread-id=\"\[0-9\]+\")?}" + append line ",value=\"$value\",type=\"$type\"" } elseif {[llength $item] == 4} { set type [lindex $item 3] - lappend children_exp\ - "$pre{name=\"$name\",exp=\"$exp\",numchild=\"$numchild\",type=\"$type\"(,thread-id=\"\[0-9\]+\")?}" - } else { - lappend children_exp\ - "$pre{name=\"$name\",exp=\"$exp\",numchild=\"$numchild\"(,thread-id=\"\[0-9\]+\")?}" + append line ",type=\"$type\"" } + + append line \ + "(,thread-id=\"\[0-9\]+\")?(,dynamic=\"1\")?}" + + lappend children_exp $line } return [join $children_exp ","] } -- 1.7.7.6