[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-04  Tom de Vries  <tdevries@suse.de>

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

Change-Id: Id7b1dcecd8c7fda3d1ab34b4fa1364d301748333
This commit is contained in:
Tom de Vries 2020-02-04 17:30:05 +01:00
parent 24872cb302
commit f90ac7c2bb
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2020-02-04 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (inferior_exited_re): Use "\[^\n\r\]*" instead of ".*".
2020-02-04 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (inferior_exited_re): Use non-capturing parentheses.

View 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\]+ \\(\[^\n\r\]*\\) exited)"
# A regular expression that matches a value history number.
# E.g., $1, $2, etc.