[gdb/testsuite] Fix gdb.tui/basic.exp with check-read1

Message ID 20190808092120.GA20911@delia
State New, archived
Headers

Commit Message

Tom de Vries Aug. 8, 2019, 9:21 a.m. UTC
  Hi,

With gdb.tui/basic.exp and check-read1, we run into (using -v for
verbose log):
...
^[[0+++ _csi_0 <<<>>>
ERROR: (DejaGnu) proc "_csi_0" does not exist.
...

In contrast, without check-read1, we have:
...
^[[0;10m<SNIP>+++ _csi_m <<<0;10>>>
...

The problem is that this regexp in _accept:
...
           -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" {
...
while matching the longer sequence '^[' '[' '0' ';' '1' '0' 'm', also matches
the shorter sequence '^[' '[' '0'.

The regexp attempts to match a CSI (Control Sequence Introducer) sequence, and
the final byte of such a sequence cannot be a digit.

Fix the regexp accordingly:
...
-           -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" {
+           -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" {
...

Tested on x86_64-linux.

OK for trunk?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.tui/basic.exp with check-read1

gdb/testsuite/ChangeLog:

2019-08-08  Tom de Vries  <tdevries@suse.de>

	PR testsuite/24862
	* lib/tuiterm.exp (_accept): Fix CSI regexp.

---
 gdb/testsuite/lib/tuiterm.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tom Tromey Aug. 8, 2019, 4:59 p.m. UTC | #1
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> 2019-08-08  Tom de Vries  <tdevries@suse.de>

Tom> 	PR testsuite/24862
Tom> 	* lib/tuiterm.exp (_accept): Fix CSI regexp.

Thank you for the patch and the explanation.
This is ok.

Tom
  

Patch

diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index d94fd431d8..cd728156fc 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -392,7 +392,7 @@  namespace eval Term {
 		verbose "+++ unsupported escape"
 		error "unsupported escape"
 	    }
-	    -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" {
+	    -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" {
 		set cmd $expect_out(2,string)
 		set params [split $expect_out(1,string) ";"]
 		verbose "+++ _csi_$cmd <<<$expect_out(1,string)>>>"