1 # Copyright 2005-2014 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 3 of the License, or
6 # (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
18 if { [skip_ada_tests] } { return -1 }
20 # This testcase verifies the behavior of the `start' command, which
21 # does not work when we use the gdb stub...
22 if [target_info exists use_gdb_stub] {
23 untested exec_changed.exp
27 standard_ada_testfile first
29 # Build the first test program (note that cygwin needs the $EXEEXT).
30 if {[gdb_compile_ada "${srcfile}" "${binfile}$EXEEXT" executable {debug}] != ""} {
34 # Build the second test program
35 set testfile2 "${testdir}/second"
36 set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb
37 set binfile2 [standard_output_file ${testfile2}$EXEEXT]
39 if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
43 # Start with a fresh gdb.
45 set common_binfile [standard_output_file ${testdir}/common$EXEEXT]
48 gdb_reinitialize_dir $srcdir/$subdir
50 # Load the first executable.
52 gdb_test "shell mv ${binfile} ${common_binfile}" ".*" ""
53 gdb_load ${common_binfile}
55 # Start the program, we should land in the program main procedure
56 if { [gdb_start_cmd] < 0 } {
62 "first \\(\\) at .*first.adb.*" \
65 # Restore first executable to its original name, and move
66 # second executable into its place. Ensure that the new
67 # executable is at least a second newer than the old.
69 gdb_test "shell mv ${common_binfile} ${binfile}" ".*" ""
70 gdb_test "shell mv ${binfile2} ${common_binfile}" ".*" ""
71 gdb_test "shell sleep 1" ".*" ""
72 gdb_test "shell touch ${common_binfile}" ".*" ""
74 # Start the program a second time, GDB should land in procedure Second
77 if { [gdb_start_cmd] < 0 } {
81 "second \\(\\) at .*second.adb.*" \