# 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 . # 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