]>
Commit | Line | Data |
---|---|---|
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 | ||
17 | if $tracelevel then { | |
18 | strace $tracelevel | |
19 | } | |
20 | ||
21 | load_lib "ada.exp" | |
22 | ||
23 | set testdir "exec_changed" | |
24 | file mkdir ${objdir}/${subdir}/${testdir} | |
25 | ||
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 | |
30 | ||
81d2cbae NS |
31 | if {[gdb_compile_ada "${srcfile1}" "${binfile1}" executable [list debug ]] != "" } { |
32 | return -1 | |
9f0d94e8 JB |
33 | } |
34 | ||
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 | |
39 | ||
81d2cbae NS |
40 | if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable [list debug ]] != "" } { |
41 | return -1 | |
9f0d94e8 JB |
42 | } |
43 | ||
44 | # Start with a fresh gdb. | |
45 | ||
46 | set testfile "${testdir}/common" | |
47 | set binfile ${objdir}/${subdir}/${testfile}$EXEEXT | |
48 | ||
49 | gdb_start | |
50 | gdb_reinitialize_dir $srcdir/$subdir | |
51 | ||
52 | # Load the first executable. | |
53 | ||
54 | gdb_test "shell mv ${binfile1} ${binfile}" "" "" | |
55 | gdb_load ${binfile} | |
56 | ||
57 | # Start the program, we should land in the program main procedure | |
b741e217 DJ |
58 | if { [gdb_start_cmd] < 0 } { |
59 | untested start | |
60 | return -1 | |
61 | } | |
62 | ||
63 | gdb_test "" \ | |
9f0d94e8 JB |
64 | "first \\(\\) at .*first.adb.*" \ |
65 | "start first" | |
66 | ||
67 | # Restore first executable to its original name, and move | |
68 | # second executable into its place. Ensure that the new | |
69 | # executable is at least a second newer than the old. | |
70 | ||
71 | gdb_test "shell mv ${binfile} ${binfile1}" "" "" | |
72 | gdb_test "shell mv ${binfile2} ${binfile}" "" "" | |
73 | gdb_test "shell sleep 1" "" "" | |
74 | gdb_test "shell touch ${binfile}" "" "" | |
75 | ||
76 | # Stop GDB from asking confirmations. This test will restart the program | |
77 | # and we don't need GDB to ask us to confirm that we want to kill the | |
78 | # current process. | |
79 | gdb_test "set confirm off" "" "" | |
80 | ||
81 | # Start the program a second time, GDB should land in procedure Second | |
82 | # this time. | |
83 | ||
b741e217 DJ |
84 | if { [gdb_start_cmd] < 0 } { |
85 | fail "start second" | |
9f0d94e8 | 86 | } else { |
b741e217 | 87 | gdb_test "" \ |
9f0d94e8 JB |
88 | "second \\(\\) at .*second.adb.*" \ |
89 | "start second" | |
90 | } |