diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.ada/operator_call.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/command-line-input.exp | 60 | ||||
-rw-r--r-- | gdb/testsuite/gdb.reverse/i386-avx-reverse.c | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.reverse/i386-avx-reverse.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/main-2.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.tui/tuiterm.exp | 46 | ||||
-rw-r--r-- | gdb/testsuite/lib/tuiterm.exp | 91 |
7 files changed, 183 insertions, 28 deletions
diff --git a/gdb/testsuite/gdb.ada/operator_call.exp b/gdb/testsuite/gdb.ada/operator_call.exp index e96107b..dc7f679 100644 --- a/gdb/testsuite/gdb.ada/operator_call.exp +++ b/gdb/testsuite/gdb.ada/operator_call.exp @@ -71,6 +71,12 @@ proc test_with_menu {command result} { fail $command } } + "Argument to arithmetic operation not a number or boolean." { + fail $command + } + -re "No definition of \".*\" in current context." { + fail $command + } timeout { fail "$command (timeout)" } diff --git a/gdb/testsuite/gdb.base/command-line-input.exp b/gdb/testsuite/gdb.base/command-line-input.exp index af228dc..9760f1a 100644 --- a/gdb/testsuite/gdb.base/command-line-input.exp +++ b/gdb/testsuite/gdb.base/command-line-input.exp @@ -18,19 +18,59 @@ # Test issuing a command split in multiple lines with continuation # characters. -gdb_exit -gdb_start +clean_restart -set test "print 1\\\\n + 2" -gdb_test_multiple "print 1\\\n + 2" $test { - -re "^print 1\\\\\r\n \\+ 2\r\n\\\$$decimal = 3\r\n$gdb_prompt $" { - pass $test +set bs "\\" +set re_bs [string_to_regexp $bs] +set re_dollar [string_to_regexp $] + +set re \ + [multi_line \ + ^[string_to_regexp "print 1$bs"] \ + [string_to_regexp " + 2"] \ + "$re_dollar$decimal = 3" \ + "$gdb_prompt $"] +gdb_test_multiple "print 1$bs\n + 2" "print 1$bs${bs}n + 2" { + -re $re { + pass $gdb_test_name + } +} + +set re \ + [multi_line \ + ^[string_to_regexp "print 1$bs"] \ + "2" \ + "$re_dollar$decimal = 12" \ + "$gdb_prompt $"] +gdb_test_multiple "print 1$bs\n2" "print 1$bs${bs}n2" { + -re $re { + pass $gdb_test_name } } -set test "print 1\\\\n2" -gdb_test_multiple "print 1\\\n2" $test { - -re "^print 1\\\\\r\n2\r\n\\\$$decimal = 12\r\n$gdb_prompt $" { - pass $test +with_test_prefix "cancel multiline" { + send_gdb "print$bs\n 1" + gdb_test_multiple "" "setup" { + -re "print$re_bs\r\n 1" { + pass $gdb_test_name + } + } + + send_gdb "\003" + gdb_test_multiple "" "cancel" { + -re -wrap "" { + pass $gdb_test_name + } + } + + # Regression test for PR cli/33063. + gdb_test_multiple "print 2" "command after cancel" { + -re -wrap " = 2" { + pass $gdb_test_name + } + -re -wrap "" { + # Avoid undefined command error. + fail $gdb_test_name + } } } diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c index a3d6427..bf6cb77 100644 --- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c +++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c @@ -299,10 +299,10 @@ vpbroadcast_test () asm volatile ("vbroadcastss %xmm1, %xmm0"); asm volatile ("vbroadcastss %xmm1, %ymm15"); asm volatile ("vbroadcastss %0, %%ymm0" : : "m" (global_buf0)); - asm volatile ("vbroadcastss %0, %%xmm15": : "m" (dyn_buf0)); + asm volatile ("vbroadcastss %0, %%xmm15": : "m" (*dyn_buf0)); asm volatile ("vbroadcastsd %xmm1, %ymm0"); asm volatile ("vbroadcastsd %0, %%ymm15": : "m" (global_buf0)); - asm volatile ("vbroadcastf128 %0, %%ymm0" : : "m" (dyn_buf0)); + asm volatile ("vbroadcastf128 %0, %%ymm0" : : "m" (*dyn_buf0)); /* We have a return statement to deal with epilogue in different compilers. */ diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp index 7e75542..fb04260 100644 --- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp +++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp @@ -395,7 +395,7 @@ if {[record_full_function "vpbroadcast"] == true} { test_one_register "vbroadcastf128" "ymm0" \ "0x17161514131211101716151413121110, 0x17161514131211101716151413121110" test_one_register "vbroadcastsd" "ymm15" \ - "0x404060004040600040406000404060, 0x0" + "0x23222120232221202322212023222120, 0x0" test_one_register "vbroadcastsd" "ymm0" \ "0x13121110131211101312111013121110, 0x13121110131211101312111013121110" diff --git a/gdb/testsuite/gdb.tui/main-2.exp b/gdb/testsuite/gdb.tui/main-2.exp index 2b0fb6b..71ad03b 100644 --- a/gdb/testsuite/gdb.tui/main-2.exp +++ b/gdb/testsuite/gdb.tui/main-2.exp @@ -41,7 +41,7 @@ if {![Term::enter_tui]} { set line " return 0;" set nr [gdb_get_line_number $line] -set screen_line [Term::get_line_with_attrs 6] +set screen_line [Term::get_string_with_attrs 6 1 79] verbose -log "screen line 6: '$screen_line'" gdb_assert { [regexp "$nr <reverse:1>$line<reverse:0>" $screen_line] } \ "highlighted line in middle of source window" diff --git a/gdb/testsuite/gdb.tui/tuiterm.exp b/gdb/testsuite/gdb.tui/tuiterm.exp index 9dc2402..6cd65f3 100644 --- a/gdb/testsuite/gdb.tui/tuiterm.exp +++ b/gdb/testsuite/gdb.tui/tuiterm.exp @@ -102,7 +102,7 @@ proc test_backspace {} { Term::_move_cursor 1 2 - Term::_ctl_0x08 + Term::_ctl_0x08 0 check "backspace one" { "abcdefgh" "ijklmnop" @@ -111,13 +111,22 @@ proc test_backspace {} { } 0 2 # Cursor should not move if it is already at column 0. - Term::_ctl_0x08 + Term::_ctl_0x08 0 check "backspace 2" { "abcdefgh" "ijklmnop" "qrstuvwx" "yz01234 " } 0 2 + + # Cursor should wrap to previous line. + Term::_ctl_0x08 1 + check "backspace 3" { + "abcdefgh" + "ijklmnop" + "qrstuvwx" + "yz01234 " + } 7 1 } proc test_linefeed { } { @@ -435,6 +444,30 @@ proc test_horizontal_absolute { } { "qrstuvwx" "yz01234 " } 3 2 + + Term::_csi_G 8 + check "cursor horizontal absolute 3" { + "abcdefgh" + "ijklmnop" + "qrstuvwx" + "yz01234 " + } 7 2 + + Term::_csi_G 9 + check "cursor horizontal absolute 4" { + "abcdefgh" + "ijklmnop" + "qrstuvwx" + "yz01234 " + } 7 2 + + Term::_csi_` + check "horizontal position absolute 1" { + "abcdefgh" + "ijklmnop" + "qrstuvwx" + "yz01234 " + } 0 2 } proc test_cursor_position { } { @@ -750,6 +783,15 @@ proc test_attrs {} { set line [Term::get_line_with_attrs 0] gdb_assert { [regexp $re $line] } "attribute: $attr" } + + # Regression test: Check that _csi_m works without arguments. + setup_terminal 4 1 + Term::_csi_m 7 + Term::_insert "a" + Term::_csi_m + Term::_insert "a" + set line [Term::get_line_with_attrs 0] + gdb_assert { [string equal $line "<reverse:1>a<reverse:0>a "] } } # Run proc TEST_PROC_NAME with a "small" terminal. diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index a0cd199..cc8e852 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -45,9 +45,16 @@ namespace eval Term { set orig_cur_row $_cur_row set orig_cur_col $_cur_col - uplevel $body + set code [catch {uplevel $body} result] _log "$what, cursor: ($orig_cur_row, $orig_cur_col) -> ($_cur_row, $_cur_col)" + + if { $code == 1 } { + global errorInfo errorCode + return -code $code -errorinfo $errorInfo -errorcode $errorCode $result + } else { + return -code $code $result + } } # If ARG is empty, return DEF: otherwise ARG. This is useful for @@ -83,14 +90,40 @@ namespace eval Term { proc _ctl_0x07 {} { } + # Return 1 if tuiterm has the bw/auto_left_margin enabled. + proc _have_bw {} { + return [string equal $Term::_TERM "ansiw"] + } + # Backspace. - proc _ctl_0x08 {} { - _log_cur "Backspace" { + proc _ctl_0x08 { {bw -1} } { + if { $bw == -1 } { + set bw [_have_bw] + } + _log_cur "Backspace, bw == $bw" { variable _cur_col + variable _cur_row + variable _cols - if {$_cur_col > 0} { + if { $_cur_col > 0 } { + # No wrapping needed. incr _cur_col -1 + return + } + + if { ! $bw } { + # Wrapping not enabled. + return } + + if { $_cur_row == 0 } { + # Can't wrap. + return + } + + # Wrap to previous line. + set _cur_col [expr $_cols - 1] + incr _cur_row -1 } } @@ -155,6 +188,14 @@ namespace eval Term { } } + # Horizontal Position Absolute. + # + # https://vt100.net/docs/vt510-rm/HPA.html + proc _csi_` {args} { + # Same as Cursor Horizontal Absolute. + return [Term::_csi_G {*}$args] + } + # Cursor Up. # # https://vt100.net/docs/vt510-rm/CUU.html @@ -251,7 +292,7 @@ namespace eval Term { variable _cur_col variable _cols - set _cur_col [expr {min ($arg - 1, $_cols)}] + set _cur_col [expr {min ($arg, $_cols)} - 1] } } @@ -597,6 +638,11 @@ namespace eval Term { # # https://vt100.net/docs/vt510-rm/SGR.html proc _csi_m {args} { + if { [llength $args] == 0 } { + # Apply default. + set args [list 0] + } + _log_cur "Select Graphic Rendition ([join $args {, }])" { variable _attrs @@ -740,7 +786,7 @@ namespace eval Term { _log "wait_for: unsupported escape" error "unsupported escape" } - -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" { + -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@`\])" { set cmd $expect_out(2,string) set params [split $expect_out(1,string) ";"] _log "wait_for: _csi_$cmd <<<$expect_out(1,string)>>>" @@ -844,8 +890,16 @@ namespace eval Term { # BODY. proc with_tuiterm {rows cols body} { global env stty_init + variable _TERM save_vars {env(TERM) env(NO_COLOR) stty_init} { - setenv TERM ansi + if { [ishost *-*-*bsd*] } { + setenv TERM ansiw + } else { + setenv TERM ansi + } + # Save active TERM variable. + set Term::_TERM $env(TERM) + setenv NO_COLOR "" _setup $rows $cols @@ -955,10 +1009,10 @@ namespace eval Term { return $res } - # Return the text of screen line N. Lines are 0-based. If C is given, - # stop before column C. Columns are also zero-based. If ATTRS, annotate - # with attributes. - proc get_line_1 {n c attrs} { + # Return the text of screen line N. Lines are 0-based. Start at column + # X. If C is non-empty, stop before column C. Columns are also + # zero-based. If ATTRS, annotate with attributes. + proc get_string {n x c {attrs 0}} { variable _rows # This can happen during resizing, if the cursor seems to # temporarily be off-screen. @@ -970,7 +1024,6 @@ namespace eval Term { variable _cols variable _chars set c [_default $c $_cols] - set x 0 if { $attrs } { _reset_attrs line_attrs } @@ -990,6 +1043,20 @@ namespace eval Term { return $result } + # Return the text of screen line N. Lines are 0-based. Start at column + # X. If C is non-empty, stop before column C. Columns are also + # zero-based. Annotate with attributes. + proc get_string_with_attrs { n x c } { + return [get_string $n $x $c 1] + } + + # Return the text of screen line N. Lines are 0-based. If C is + # non-empty, stop before column C. Columns are also zero-based. If + # ATTRS, annotate with attributes. + proc get_line_1 {n c attrs} { + return [get_string $n 0 $c $attrs] + } + # Return the text of screen line N, without attributes. Lines are # 0-based. If C is given, stop before column C. Columns are also # zero-based. |