[gdb/testsuite] Fix TUI tests on freebsd

While re-testing the TUI tests on x86_64-freebsd, I found that commit
06a53717f7 ("[gdb/testsuite] Handle unrecognized escape sequences better in
tuiterm") broke most test-cases.

Fix this by rewriting this gdb_test_multiple clause:
...
 	-re "^($re_csi_prefix?)($re_csi_args*)($re_csi_cmd)" {
...
into:
...
	-re "^($re_csi_cmd)" {
  ...
	-re "^($re_csi_args*)($re_csi_cmd)" {
  ...
 	-re "^($re_csi_prefix?)($re_csi_args*)($re_csi_cmd)" {
...

Tested on x86_64-linux and x86_64-freebsd.
This commit is contained in:
Tom de Vries
2025-08-16 20:32:37 +02:00
parent 06a53717f7
commit e579b53735

View File

@@ -1078,19 +1078,25 @@ proc Term::accept_gdb_output { {warn 1} } {
set re_csi_args {[0-9;]}
set re_csi_cmd {[a-zA-Z@`]}
gdb_expect {
-re "^($re_csi_cmd)" {
set cmd $expect_out(1,string)
_log "wait_for: _csi_$cmd"
eval _csi_$cmd
}
-re "^($re_csi_args*)($re_csi_cmd)" {
set params [split $expect_out(1,string) ";"]
set cmd $expect_out(2,string)
_log "wait_for: _csi_$cmd <<<$params>>>"
eval _csi_$cmd $params
}
-re "^($re_csi_prefix?)($re_csi_args*)($re_csi_cmd)" {
set prefix $expect_out(1,string)
set cmd $expect_out(3,string)
set params [split $expect_out(2,string) ";"]
if { $prefix == "" } {
_log "wait_for: _csi_$cmd <<<$expect_out(1,string)>>>"
eval _csi_$cmd $params
} else {
scan $prefix %c val
set hexval [format "%02x" $val]
_log "wait_for: _csi_0x${hexval}_$cmd <<<$expect_out(1,string)>>>"
eval _csi_0x${hexval}_$cmd $params
}
set cmd $expect_out(3,string)
scan $prefix %c val
set hexval [format "%02x" $val]
_log "wait_for: _csi_0x${hexval}_$cmd <<<$expect_out(1,string)>>>"
eval _csi_0x${hexval}_$cmd $params
}
timeout {