This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use noncapturing subpattern/parens in gdb_test implementation


Hi Simon,

On Mon, 05 Jun 2017 14:07:36 +0200
Simon Marchi <simon.marchi@polymtl.ca> wrote:

> On 2017-06-03 03:56, Kevin Buettner wrote:

> > gdb/testsuite/ChangeLog:
> > 
> >     	* gdb.exp (gdb_test): Using noncapturing parens for the $pattern
> >     	subpattern.
> > ---
> >  gdb/testsuite/lib/gdb.exp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> > index 6633d24..bd61528 100644
> > --- a/gdb/testsuite/lib/gdb.exp
> > +++ b/gdb/testsuite/lib/gdb.exp
> > @@ -1000,7 +1000,7 @@ proc gdb_test { args } {
> >      }
> > 
> >      return [gdb_test_multiple $command $message {
> > -	-re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" {
> > +	-re "\[\r\n\]*(?:$pattern)\[\r\n\]+$gdb_prompt $" {
> >  	    if ![string match "" $message] then {
> >  		pass "$message"
> >              }  
> 
> The change makes sense to me.  I assume you've run the testsuite and 
> noticed no regressions?  Then it's fair to assume that no test were 
> using what those parentheses are currently capturing.

Thanks for looking it over.  I've pushed it.

I did check for regressions prior to submitting the patch.  I checked
again earlier today prior to pushing it.  None were found.

I don't think it's possible for the parens that I modified in gdb_test
to do any useful capturing.  Any backreferences that you might try
to use will be enclosed within those parens and therefore be a
recursive backreference.  In this case, the purpose of the parens
was to make sure that everything in the pattern stays grouped together.
This is important when the pattern passed to gdb_test has alternation
at the top level.

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]