Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.server / ext-restart.exp
CommitLineData
51aee833
YQ
1# This testcase is part of GDB, the GNU debugger.
2
88b9d363 3# Copyright 2015-2022 Free Software Foundation, Inc.
51aee833
YQ
4
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.
9#
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.
14#
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/>.
17
18# Test restarting programs with the R packet.
19
20load_lib gdbserver-support.exp
21
22standard_testfile server.c
23
24if { [skip_gdbserver_tests] } {
25 return 0
26}
27
8dc558a0
SM
28save_vars { GDBFLAGS } {
29 # If GDB and GDBserver are both running locally, set the sysroot to avoid
30 # reading files via the remote protocol.
31 if { ![is_remote host] && ![is_remote target] } {
32 set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\""
33 }
34
35 if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
36 return -1
37 }
51aee833
YQ
38}
39
40# Make sure we're disconnected, in case we're testing with an
41# extended-remote board, therefore already connected.
42gdb_test "disconnect" ".*"
43
44set target_exec [gdbserver_download_current_prog]
45gdbserver_start_extended
46
47gdb_test_no_output "set remote exec-file $target_exec" "set remote exec-file"
48
49gdb_breakpoint main
50gdb_test "run" "Breakpoint.* main .*" "run to main"
51
52# Restart the process.
53with_test_prefix "restart" {
54 # Disable vRun packet and clear remote exec-file, so that GDB will
55 # use R packet to restart the process.
56 gdb_test_no_output "set remote run-packet off"
57 gdb_test_no_output "set remote exec-file"
58
59 set test "run to main"
60 gdb_test_multiple "run" $test {
61 -re {Start it from the beginning\? \(y or n\) $} {
62 send_gdb "y\n"
63 exp_continue
64 }
65 -re "Breakpoint.* main .*\r\n$gdb_prompt $" {
66 pass $test
67 }
68 }
69}
70
5ed7a928 71gdb_test "kill" "" "kill" "Kill the program being debugged. .y or n. " "y"
51aee833
YQ
72
73gdb_test_no_output "monitor exit"
This page took 0.976574 seconds and 4 git commands to generate.