Update year range in copyright notice of all files owned by the GDB project.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / exec_changed.exp
CommitLineData
32d0add0 1# Copyright 2005-2015 Free Software Foundation, Inc.
9f0d94e8
JB
2
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
9f0d94e8 6# (at your option) any later version.
e22f8b7c 7#
9f0d94e8
JB
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.
e22f8b7c 12#
9f0d94e8 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
9f0d94e8 15
9f0d94e8
JB
16load_lib "ada.exp"
17
ec3c07fc
NS
18if { [skip_ada_tests] } { return -1 }
19
8ed5dd9e
JB
20# This testcase verifies the behavior of the `start' command, which
21# does not work when we use the gdb stub...
22if [target_info exists use_gdb_stub] {
23 untested exec_changed.exp
24 return
25}
26
8223e12c 27standard_ada_testfile first
9f0d94e8
JB
28
29# Build the first test program (note that cygwin needs the $EXEEXT).
8223e12c 30if {[gdb_compile_ada "${srcfile}" "${binfile}$EXEEXT" executable {debug}] != ""} {
ec3c07fc 31 return -1
9f0d94e8
JB
32}
33
34# Build the second test program
35set testfile2 "${testdir}/second"
36set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb
8223e12c 37set binfile2 [standard_output_file ${testfile2}$EXEEXT]
9f0d94e8 38
ec3c07fc
NS
39if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
40 return -1
9f0d94e8
JB
41}
42
43# Start with a fresh gdb.
44
8223e12c 45set common_binfile [standard_output_file ${testdir}/common$EXEEXT]
9f0d94e8
JB
46
47gdb_start
48gdb_reinitialize_dir $srcdir/$subdir
49
50# Load the first executable.
51
8223e12c
TT
52gdb_test "shell mv ${binfile} ${common_binfile}" ".*" ""
53gdb_load ${common_binfile}
9f0d94e8
JB
54
55# Start the program, we should land in the program main procedure
b741e217
DJ
56if { [gdb_start_cmd] < 0 } {
57 untested start
58 return -1
59}
60
61gdb_test "" \
9f0d94e8
JB
62 "first \\(\\) at .*first.adb.*" \
63 "start first"
64
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.
68
8223e12c
TT
69gdb_test "shell mv ${common_binfile} ${binfile}" ".*" ""
70gdb_test "shell mv ${binfile2} ${common_binfile}" ".*" ""
de7ff789 71gdb_test "shell sleep 1" ".*" ""
8223e12c 72gdb_test "shell touch ${common_binfile}" ".*" ""
9f0d94e8 73
9f0d94e8
JB
74# Start the program a second time, GDB should land in procedure Second
75# this time.
76
b741e217
DJ
77if { [gdb_start_cmd] < 0 } {
78 fail "start second"
9f0d94e8 79} else {
b741e217 80 gdb_test "" \
9f0d94e8
JB
81 "second \\(\\) at .*second.adb.*" \
82 "start second"
83}
This page took 1.009812 seconds and 4 git commands to generate.