1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
# Copyright (C) 2023-2024 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is part of the GDB testsuite. It tests a corner case
# where the executed GDB command enables the stdin while running
# inside a synchronous command, causing the GDB prompt to be displayed
# prematurely.
load_lib gdb-python.exp
load_lib gdbserver-support.exp
# We use the start command.
require !use_gdb_stub
require allow_python_tests allow_gdbserver_tests
standard_testfile
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
set bp_line [gdb_get_line_number "break-here"]
gdb_breakpoint $bp_line
set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "source $pyfile" "source the script"
set gdbserver [gdbserver_start "" [standard_output_file $binfile]]
set gdbserver_gdbport [lindex $gdbserver 1]
gdb_test_no_output "python the_listener.port = '${gdbserver_gdbport}'" \
"set the_listener.port value"
gdb_run_cmd
gdb_test_multiple "" "prompt is positioned correctly" {
-re -wrap "break-here \[^\r\n\]+" {
pass $gdb_test_name
}
}
# Clean up the gdbserver.
gdb_test "inferior 2" "Switching to inferior 2.*" \
"switch to gdbserver for clean up"
gdbserver_exit 0
|