Avoid the use of gdb_start_cmd in gdb.ada/*.exp testcases.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / exec_changed.exp
CommitLineData
7b6bb8da 1# Copyright 2005, 2007, 2008, 2009, 2010, 2011 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
JB
15
16if $tracelevel then {
17 strace $tracelevel
18}
19
20load_lib "ada.exp"
21
ec3c07fc
NS
22if { [skip_ada_tests] } { return -1 }
23
8ed5dd9e
JB
24# This testcase verifies the behavior of the `start' command, which
25# does not work when we use the gdb stub...
26if [target_info exists use_gdb_stub] {
27 untested exec_changed.exp
28 return
29}
30
9f0d94e8
JB
31set testdir "exec_changed"
32file mkdir ${objdir}/${subdir}/${testdir}
33
34# Build the first test program (note that cygwin needs the $EXEEXT).
35set testfile1 "${testdir}/first"
36set srcfile1 ${srcdir}/${subdir}/${testfile1}.adb
37set binfile1 ${objdir}/${subdir}/${testfile1}$EXEEXT
38
ec3c07fc
NS
39if {[gdb_compile_ada "${srcfile1}" "${binfile1}" executable {debug}] != ""} {
40 return -1
9f0d94e8
JB
41}
42
43# Build the second test program
44set testfile2 "${testdir}/second"
45set srcfile2 ${srcdir}/${subdir}/${testfile2}.adb
46set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT
47
ec3c07fc
NS
48if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} {
49 return -1
9f0d94e8
JB
50}
51
52# Start with a fresh gdb.
53
54set testfile "${testdir}/common"
55set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
56
57gdb_start
58gdb_reinitialize_dir $srcdir/$subdir
59
60# Load the first executable.
61
de7ff789 62gdb_test "shell mv ${binfile1} ${binfile}" ".*" ""
9f0d94e8
JB
63gdb_load ${binfile}
64
65# Start the program, we should land in the program main procedure
b741e217
DJ
66if { [gdb_start_cmd] < 0 } {
67 untested start
68 return -1
69}
70
71gdb_test "" \
9f0d94e8
JB
72 "first \\(\\) at .*first.adb.*" \
73 "start first"
74
75# Restore first executable to its original name, and move
76# second executable into its place. Ensure that the new
77# executable is at least a second newer than the old.
78
de7ff789
MS
79gdb_test "shell mv ${binfile} ${binfile1}" ".*" ""
80gdb_test "shell mv ${binfile2} ${binfile}" ".*" ""
81gdb_test "shell sleep 1" ".*" ""
82gdb_test "shell touch ${binfile}" ".*" ""
9f0d94e8 83
9f0d94e8
JB
84# Start the program a second time, GDB should land in procedure Second
85# this time.
86
b741e217
DJ
87if { [gdb_start_cmd] < 0 } {
88 fail "start second"
9f0d94e8 89} else {
b741e217 90 gdb_test "" \
9f0d94e8
JB
91 "second \\(\\) at .*second.adb.*" \
92 "start second"
93}
This page took 0.521189 seconds and 4 git commands to generate.