Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2005-2020 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 |
16 | load_lib "ada.exp" |
17 | ||
ec3c07fc NS |
18 | if { [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... | |
079670b9 | 22 | if [use_gdb_stub] { |
5b362f04 | 23 | untested "skipping tests due to use_gdb_stub" |
8ed5dd9e JB |
24 | return |
25 | } | |
26 | ||
8223e12c | 27 | standard_ada_testfile first |
9f0d94e8 JB |
28 | |
29 | # Build the first test program (note that cygwin needs the $EXEEXT). | |
8223e12c | 30 | if {[gdb_compile_ada "${srcfile}" "${binfile}$EXEEXT" executable {debug}] != ""} { |
ec3c07fc | 31 | return -1 |
9f0d94e8 JB |
32 | } |
33 | ||
34 | # Build the second test program | |
f0464b23 SM |
35 | set srcfile2 ${srcdir}/${subdir}/${testdir}/second.adb |
36 | set binfile2 [standard_output_file second$EXEEXT] | |
9f0d94e8 | 37 | |
ec3c07fc NS |
38 | if {[gdb_compile_ada "${srcfile2}" "${binfile2}" executable {debug}] != ""} { |
39 | return -1 | |
9f0d94e8 JB |
40 | } |
41 | ||
42 | # Start with a fresh gdb. | |
43 | ||
f0464b23 | 44 | set common_binfile [standard_output_file common$EXEEXT] |
9f0d94e8 JB |
45 | |
46 | gdb_start | |
47 | gdb_reinitialize_dir $srcdir/$subdir | |
48 | ||
49 | # Load the first executable. | |
50 | ||
8223e12c TT |
51 | gdb_test "shell mv ${binfile} ${common_binfile}" ".*" "" |
52 | gdb_load ${common_binfile} | |
9f0d94e8 JB |
53 | |
54 | # Start the program, we should land in the program main procedure | |
b741e217 DJ |
55 | if { [gdb_start_cmd] < 0 } { |
56 | untested start | |
57 | return -1 | |
58 | } | |
59 | ||
60 | gdb_test "" \ | |
9f0d94e8 JB |
61 | "first \\(\\) at .*first.adb.*" \ |
62 | "start first" | |
63 | ||
64 | # Restore first executable to its original name, and move | |
65 | # second executable into its place. Ensure that the new | |
66 | # executable is at least a second newer than the old. | |
67 | ||
8223e12c TT |
68 | gdb_test "shell mv ${common_binfile} ${binfile}" ".*" "" |
69 | gdb_test "shell mv ${binfile2} ${common_binfile}" ".*" "" | |
de7ff789 | 70 | gdb_test "shell sleep 1" ".*" "" |
8223e12c | 71 | gdb_test "shell touch ${common_binfile}" ".*" "" |
9f0d94e8 | 72 | |
9f0d94e8 JB |
73 | # Start the program a second time, GDB should land in procedure Second |
74 | # this time. | |
75 | ||
b741e217 DJ |
76 | if { [gdb_start_cmd] < 0 } { |
77 | fail "start second" | |
9f0d94e8 | 78 | } else { |
b741e217 | 79 | gdb_test "" \ |
9f0d94e8 JB |
80 | "second \\(\\) at .*second.adb.*" \ |
81 | "start second" | |
82 | } | |
85c3a371 DE |
83 | |
84 | # Try again, this time with just changing the file time of first. | |
85 | ||
86 | clean_restart "${binfile}$EXEEXT" | |
87 | ||
88 | # Ensure we don't accidently use the main symbol cache. | |
89 | gdb_test_no_output "mt set symbol-cache-size 0" | |
90 | ||
91 | # Put something in the symbol lookup cache that will get looked up when | |
92 | # starting after having re-read symbols. PR 17855. | |
93 | gdb_breakpoint break_me | |
94 | ||
95 | gdb_test "shell touch ${binfile}$EXEEXT" ".*" "" | |
96 | gdb_test "shell sleep 1" ".*" "" | |
97 | ||
98 | if { [gdb_start_cmd] < 0 } { | |
99 | # PR 17855: At this point gdb may have crashed or gotten an internal | |
100 | # error, but we still need to detect this. Just issue any simple command | |
101 | # to verify gdb is still running. This will establish in gdb.log whether | |
102 | # gdb is still running. | |
103 | gdb_test_no_output "set \$check_gdb_running = 0" "check gdb running" | |
104 | fail "start just first" | |
105 | } else { | |
106 | gdb_test "" \ | |
107 | "first \\(\\) at .*first.adb.*" \ | |
108 | "start just first" | |
109 | } |