Fix null pointer dereference in process_debug_info()
[binutils-gdb.git] / gdb / testsuite / gdb.tui / tuiterm-2.exp
blobbf829581a76a191447d331e8b0b233f03ad61092
1 # Copyright 2023-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Check tuiterm procs that interact with gdb as well as tuiterm.
18 tuiterm_env
20 proc test_accept_gdb_output { } {
21 if { $::action_cnt == [llength $::actions] } {
22 return 0
24 set action [lindex $::actions $::action_cnt]
25 incr ::action_cnt
27 uplevel $action
29 return 1
32 proc test_send_gdb { string } {
33 set expected [lindex $::expect_send $::send_cnt]
34 gdb_assert { [string equal $string $expected] }
36 incr ::send_cnt
39 with_override Term::accept_gdb_output test_accept_gdb_output {
40 with_override send_gdb test_send_gdb {
42 foreach_with_prefix border { "" "|" } {
43 with_test_prefix "Term::command match" {
44 Term::_setup 4 20
45 set send_cnt 0
46 set expect_send { foo\n }
47 set action_cnt 0
48 set actions {
50 Term::_insert "${::border}(gdb) foo"
53 Term::_ctl_0x0d
54 Term::_ctl_0x0a
55 Term::_insert "${::border}(gdb) "
58 gdb_assert { [Term::command "foo"] }
61 with_test_prefix "Term::command mismatch" {
62 Term::_setup 4 20
63 set send_cnt 0
64 set expect_send { foo\n }
65 set action_cnt 0
66 set actions {
68 Term::_insert "$::border (gdb) foo"
71 Term::_ctl_0x0d
72 Term::_ctl_0x0a
73 Term::_insert "${::border}(gdb) "
76 gdb_assert { ![Term::command "foo"] }
79 with_test_prefix "Term::command mismatch 2" {
80 Term::_setup 4 20
81 set send_cnt 0
82 set expect_send { foo\n }
83 set action_cnt 0
84 set actions {
86 Term::_insert "${::border}(gdb) foo"
89 Term::_ctl_0x0d
90 Term::_ctl_0x0a
91 Term::_insert "${::border} (gdb) "
94 gdb_assert { ![Term::command "foo"] }
97 with_test_prefix Term::wait_for {
98 Term::_setup 4 20
99 set send_cnt 0
100 set expect_send {}
101 set action_cnt 0
102 set actions {
104 Term::_insert "(gdb) "
107 gdb_assert { [Term::wait_for ""] }