]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.ada/exec_changed.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / exec_changed.exp
CommitLineData
6aba47ca 1# Copyright 2005, 2007 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
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.
12#
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.
16
17if $tracelevel then {
18 strace $tracelevel
19}
20
21load_lib "ada.exp"
22
23set testdir "exec_changed"
24file mkdir ${objdir}/${subdir}/${testdir}
25
26# Build the first test program (note that cygwin needs the $EXEEXT).
27set testfile1 "${testdir}/first"
28set srcfile1 ${srcdir}/${subdir}/${testfile1}.adb
29set binfile1 ${objdir}/${subdir}/${testfile1}$EXEEXT
30
31if {[gdb_compile_ada "${srcfile1}" "${binfile1}" executable [list debug ]] != "" } {
32 return -1
33}
34
35# Build the second test program
36set testfile2 "${testdir}/second"
37set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb
38set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT
39
40if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable [list debug ]] != "" } {
41 return -1
42}
43
44# Start with a fresh gdb.
45
46set testfile "${testdir}/common"
47set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
48
49gdb_start
50gdb_reinitialize_dir $srcdir/$subdir
51
52# Load the first executable.
53
54gdb_test "shell mv ${binfile1} ${binfile}" "" ""
55gdb_load ${binfile}
56
57# Start the program, we should land in the program main procedure
58gdb_test "start" \
59 "first \\(\\) at .*first.adb.*" \
60 "start first"
61
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.
65
66gdb_test "shell mv ${binfile} ${binfile1}" "" ""
67gdb_test "shell mv ${binfile2} ${binfile}" "" ""
68gdb_test "shell sleep 1" "" ""
69gdb_test "shell touch ${binfile}" "" ""
70
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.
74gdb_test "set confirm off" "" ""
75
76# Start the program a second time, GDB should land in procedure Second
77# this time.
78
79if [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"
86}
87