[gdb/testsuite] Use non-capturing parentheses for inferior_exited_re
authorTom de Vries <tdevries@suse.de>
Tue, 4 Feb 2020 08:53:50 +0000 (09:53 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 4 Feb 2020 08:53:50 +0000 (09:53 +0100)
The inferior_exited_re regexp uses capturing parentheses by default:
...
set inferior_exited_re "(\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
...

The parentheses are there to be able to use the expression as an atom, f.i.,
to have '+' apply to the whole regexp in "${inferior_exited_re}+".

But the capturing is not necessary, and it can be confusing because it's not
obvious in a regexp using "$inferior_exited_re (bla|bli)" that the first
captured expression is in $inferior_exited_re.

Replace by non-capturing parentheses.  If we still want to capture the
expression, we can simply (and more clearly) use "($inferior_exited_re)".

Build and reg-tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-02-04  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (inferior_exited_re): Use non-capturing parentheses.

Change-Id: I7640c6129b1ada617424d6a63730d4b119c58ef3

gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp

index 2b1a8ba7eeb6a46fc2d2da4033c809100ae706a6..bc616793873e8fdad7fe6074d31a351d5d0e72ab 100644 (file)
@@ -1,3 +1,7 @@
+2020-02-04  Tom de Vries  <tdevries@suse.de>
+
+       * lib/gdb.exp (inferior_exited_re): Use non-capturing parentheses.
+
 2020-02-03  Rogerio A. Cardoso  <rcardoso@linux.ibm.com>
 
        * gdb.arch/powerpc-power8.exp: Delete trailing whitespace of
index 2d230b791ee54882fc9bed3e6721e67cab56a44d..25bed7643218667b21fba80b90562bccc7119f5f 100644 (file)
@@ -117,7 +117,7 @@ if ![info exists env(EXEEXT)] {
 
 set octal "\[0-7\]+"
 
-set inferior_exited_re "(\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
+set inferior_exited_re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
 
 # A regular expression that matches a value history number.
 # E.g., $1, $2, etc.
This page took 0.03374 seconds and 4 git commands to generate.