Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.ada / exec_changed.exp
blobf9561eadf5de8f5efd4f0632524b4869a53bb4cc
1 # Copyright 2005 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 2 of the License, or
6 # (at your option) any later version.
7 #
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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 if $tracelevel then {
18 strace $tracelevel
21 load_lib "ada.exp"
23 set testdir "exec_changed"
24 file mkdir ${objdir}/${subdir}/${testdir}
26 # Build the first test program (note that cygwin needs the $EXEEXT).
27 set testfile1 "${testdir}/first"
28 set srcfile1 ${srcdir}/${subdir}/${testfile1}.adb
29 set binfile1 ${objdir}/${subdir}/${testfile1}$EXEEXT
31 if {[gdb_compile_ada "${srcfile1}" "${binfile1}" executable [list debug ]] != "" } {
32 return -1
35 # Build the second test program
36 set testfile2 "${testdir}/second"
37 set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb
38 set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT
40 if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable [list debug ]] != "" } {
41 return -1
44 # Start with a fresh gdb.
46 set testfile "${testdir}/common"
47 set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
49 gdb_start
50 gdb_reinitialize_dir $srcdir/$subdir
52 # Load the first executable.
54 gdb_test "shell mv ${binfile1} ${binfile}" "" ""
55 gdb_load ${binfile}
57 # Start the program, we should land in the program main procedure
58 gdb_test "start" \
59 "first \\(\\) at .*first.adb.*" \
60 "start first"
62 # Restore first executable to its original name, and move
63 # second executable into its place. Ensure that the new
64 # executable is at least a second newer than the old.
66 gdb_test "shell mv ${binfile} ${binfile1}" "" ""
67 gdb_test "shell mv ${binfile2} ${binfile}" "" ""
68 gdb_test "shell sleep 1" "" ""
69 gdb_test "shell touch ${binfile}" "" ""
71 # Stop GDB from asking confirmations. This test will restart the program
72 # and we don't need GDB to ask us to confirm that we want to kill the
73 # current process.
74 gdb_test "set confirm off" "" ""
76 # Start the program a second time, GDB should land in procedure Second
77 # this time.
79 if [is_remote target] {
80 unsupported "start the program a second time ";
81 } else {
82 # Start the program, we should land in the program main procedure
83 gdb_test "start" \
84 "second \\(\\) at .*second.adb.*" \
85 "start second"