public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Yao Qi <yao@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 10/11] Match dynamic="1" in the output of -var-list-children
Date: Tue, 21 Jan 2014 20:47:00 -0000	[thread overview]
Message-ID: <52DEDCF7.2040900@redhat.com> (raw)
In-Reply-To: <1385258996-26047-11-git-send-email-yao@codesourcery.com>

On 11/23/2013 06:09 PM, Yao Qi wrote:
> I am not satisfied with the regexp construction for each child in
> mi_child_regexp.

Agreed.

> 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"
>

That sounds reasonable. A slightly easier syntax to parse would use a 
list of lists for this optional argument. That would then generically 
allow flags to be used, further simplifying it to "{{type int} dynamic}".

But then just about anything is better than what we have now, which 
relies on the /length/ of the list to determine what to add to the 
regexp. Yuck!

> Since mi_list_varobj_children has been widely used in test suite, I'd
> like to defer the change after this patch series.

Agreed.

Just one little thing below. Otherwise, this looks okay to me.

Keith

> 2013-11-24  Yao Qi  <yao@codesourcery.com>
>
> 	* lib/mi-support.exp (mi_child_regexp): Append 'dynamic="1"' to
> 	children_exp.
> ---
>   gdb/testsuite/lib/mi-support.exp |   16 ++++++++++------
>   1 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
> index 0c3cdbe..99ff9a5 100644
> --- a/gdb/testsuite/lib/mi-support.exp
> +++ b/gdb/testsuite/lib/mi-support.exp
> @@ -1410,21 +1410,25 @@ 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\]+\")?}"
> +	    append line ",type=\"$type\""
>   	} else {
> -	    lappend children_exp\
> -		"$pre{name=\"$name\",exp=\"$exp\",numchild=\"$numchild\"(,thread-id=\"\[0-9\]+\")?}"
>   	}

This 'else' block is now empty and can be removed.

> +
> +	append line \
> +	    "(,thread-id=\"\[0-9\]+\")?(,dynamic=\"1\")?}"
> +
> +	lappend children_exp $line
>       }
>       return [join $children_exp ","]
>   }
>

  reply	other threads:[~2014-01-21 20:47 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24  5:04 [RCF 00/11] Visit varobj available children only in MI Yao Qi
2013-11-24  2:12 ` [PATCH 09/11] Delete varobj's children on traceframe is changed Yao Qi
2014-01-21 20:47   ` Keith Seitz
2013-11-24  2:12 ` [PATCH 04/11] Remove #if HAVE_PYTHON Yao Qi
2014-01-21 20:44   ` Keith Seitz
2013-11-24  2:12 ` [PATCH 10/11] Match dynamic="1" in the output of -var-list-children Yao Qi
2014-01-21 20:47   ` Keith Seitz [this message]
2013-11-24  2:12 ` [PATCH 07/11] MI option --available-children-only Yao Qi
2014-01-21 20:45   ` Keith Seitz
2013-11-24  2:12 ` [PATCH 03/11] Iterate over 'struct varobj_item' instead of PyObject Yao Qi
2014-01-21 20:44   ` Keith Seitz
2013-11-24  2:12 ` [PATCH 01/11] Use 'struct varobj_item' to represent name and value pair Yao Qi
2014-01-21 20:43   ` Keith Seitz
2014-01-22  1:00     ` Doug Evans
2014-01-23  4:08       ` Yao Qi
2014-01-23 16:08         ` Doug Evans
2013-11-24  2:12 ` [PATCH 08/11] Iterator varobj_items by their availability Yao Qi
2014-01-21 20:46   ` Keith Seitz
2013-11-24  2:12 ` [PATCH 06/11] Use varobj_is_dynamic_p more widely Yao Qi
2014-01-21 20:44   ` Keith Seitz
2013-11-24  2:12 ` [PATCH 02/11] Generalize varobj iterator Yao Qi
2014-01-21 20:44   ` Keith Seitz
2014-01-22  1:07     ` Doug Evans
2013-11-24  2:12 ` [PATCH 05/11] Rename varobj_pretty_printed_p to varobj_is_dynamic_p Yao Qi
2014-01-21 20:44   ` Keith Seitz
2013-11-24  2:12 ` [PATCH 11/11] Test case Yao Qi
2014-01-21 20:49   ` Keith Seitz
2013-12-02  9:09 ` [RCF 00/11] Visit varobj available children only in MI Yao Qi
2013-12-17 12:54 ` Yao Qi
2014-01-07 18:22 ` Keith Seitz
2014-01-08 11:41   ` Joel Brobecker
2014-01-08 14:27   ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52DEDCF7.2040900@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).