Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [review] [gdb/testsuite] Make inferior_exited_re match a single line
@ 2020-02-03 15:15 Tom de Vries (Code Review)
  2020-02-04  4:38 ` Simon Marchi (Code Review)
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Tom de Vries (Code Review) @ 2020-02-03 15:15 UTC (permalink / raw)
  To: gdb-patches

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/764
......................................................................

[gdb/testsuite] Make inferior_exited_re match a single line

The current inferior_exited_re regexp contains a '.*':
...
set inferior_exited_re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
...

This means that while matching a single line:
...
$ tclsh
% set re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
(?:\[Inferior [0-9]+ \(.*\) exited)
% set line "\[Inferior 1 (process 33) exited\]\n"
[Inferior 1 (process 33) exited]

% regexp $re $line
1
...
it also matches more than one line:
...
$ tclsh
% set re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
(?:\[Inferior [0-9]+ \(.*\) exited)
% set line "\[Inferior 1 (process 33) exited\]\n\[Inferior 2 (process 44) exited\]\n"
[Inferior 1 (process 33) exited]
[Inferior 2 (process 44) exited]

% regexp $re $line
1
...

Fix this by using "\[^\n\r]*" instead of ".*".

Build and reg-tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/gdb.exp (inferior_exited_re): Use "\[^\n\r]*" instead of ".*".

Change-Id: Id7b1dcecd8c7fda3d1ab34b4fa1364d301748333
---
M gdb/testsuite/lib/gdb.exp
1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 25bed76..14d752b 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -117,7 +117,7 @@
 
 set octal "\[0-7\]+"
 
-set inferior_exited_re "(?:\\\[Inferior \[0-9\]+ \\(.*\\) exited)"
+set inferior_exited_re "(?:\\\[Inferior \[0-9\]+ \\(\[^\n\r]*\\) exited)"
 
 # A regular expression that matches a value history number.
 # E.g., $1, $2, etc.

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Id7b1dcecd8c7fda3d1ab34b4fa1364d301748333
Gerrit-Change-Number: 764
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-MessageType: newchange


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-04 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 15:15 [review] [gdb/testsuite] Make inferior_exited_re match a single line Tom de Vries (Code Review)
2020-02-04  4:38 ` Simon Marchi (Code Review)
2020-02-04  9:31 ` Tom de Vries (Code Review)
2020-02-04  9:32 ` [review v2] " Tom de Vries (Code Review)
2020-02-04 14:23 ` Simon Marchi (Code Review)
2020-02-04 16:32 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2020-02-04 16:32 ` Sourceware to Gerrit sync (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox