1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2015-2019 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test restarting programs with the R packet.
20 load_lib gdbserver-support.exp
22 standard_testfile server.c
24 if { [skip_gdbserver_tests] } {
28 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
32 # Make sure we're disconnected, in case we're testing with an
33 # extended-remote board, therefore already connected.
34 gdb_test "disconnect" ".*"
36 set target_exec [gdbserver_download_current_prog]
37 gdbserver_start_extended
39 gdb_test_no_output "set remote exec-file $target_exec" "set remote exec-file"
42 gdb_test "run" "Breakpoint.* main .*" "run to main"
44 # Restart the process.
45 with_test_prefix "restart" {
46 # Disable vRun packet and clear remote exec-file, so that GDB will
47 # use R packet to restart the process.
48 gdb_test_no_output "set remote run-packet off"
49 gdb_test_no_output "set remote exec-file"
51 set test "run to main"
52 gdb_test_multiple "run" $test {
53 -re {Start it from the beginning\? \(y or n\) $} {
57 -re "Breakpoint.* main .*\r\n$gdb_prompt $" {
63 gdb_test "kill" "" "kill" "Kill the program being debugged. .y or n. " "y"
65 gdb_test_no_output "monitor exit"