1 |
330 |
jeremybenn |
# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
|
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 3 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, see .
|
15 |
|
|
|
16 |
|
|
# This file is part of the GDB testsuite. It tests 'finish' with
|
17 |
|
|
# reverse debugging.
|
18 |
|
|
|
19 |
|
|
if ![target_info exists gdb,can_reverse] {
|
20 |
|
|
return
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
set testfile "finish-reverse"
|
24 |
|
|
set srcfile ${testfile}.c
|
25 |
|
|
|
26 |
|
|
if { [prepare_for_testing $testfile.exp "$testfile" $srcfile] } {
|
27 |
|
|
return -1
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
runto main
|
31 |
|
|
|
32 |
|
|
if [target_info exists gdb,use_precord] {
|
33 |
|
|
# Activate process record/replay
|
34 |
|
|
gdb_test_no_output "record" "Turn on process record"
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
# Test finish from void func
|
38 |
|
|
|
39 |
|
|
set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
|
40 |
|
|
gdb_test "break void_func" \
|
41 |
|
|
"Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
|
42 |
|
|
"set breakpoint on void_func"
|
43 |
|
|
gdb_continue_to_breakpoint "void_func" ".*/$srcfile:$breakloc.*"
|
44 |
|
|
|
45 |
|
|
set test_msg "finish from void_func"
|
46 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
47 |
|
|
-re " call to void_func .*$gdb_prompt $" {
|
48 |
|
|
send_gdb "step\n"
|
49 |
|
|
exp_continue
|
50 |
|
|
}
|
51 |
|
|
-re " void_checkpoint .*$gdb_prompt $" {
|
52 |
|
|
pass "$test_msg"
|
53 |
|
|
}
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
# Test finish from char func
|
57 |
|
|
|
58 |
|
|
set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
|
59 |
|
|
gdb_test "break char_func" \
|
60 |
|
|
"Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
|
61 |
|
|
"set breakpoint on char_func"
|
62 |
|
|
gdb_continue_to_breakpoint "char_func" ".*/$srcfile:$breakloc.*"
|
63 |
|
|
|
64 |
|
|
set test_msg "finish from char_func"
|
65 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
66 |
|
|
-re " void_checkpoint .*$gdb_prompt $" {
|
67 |
|
|
send_gdb "step\n"
|
68 |
|
|
exp_continue
|
69 |
|
|
}
|
70 |
|
|
-re " char_checkpoint .*$gdb_prompt $" {
|
71 |
|
|
pass "$test_msg"
|
72 |
|
|
}
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
# Test finish from short func
|
76 |
|
|
|
77 |
|
|
set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
|
78 |
|
|
gdb_test "break short_func" \
|
79 |
|
|
"Breakpoint $decimal at .* line $breakloc\." \
|
80 |
|
|
"set breakpoint on short_func"
|
81 |
|
|
gdb_continue_to_breakpoint "short_func" ".*/$srcfile:$breakloc.*"
|
82 |
|
|
|
83 |
|
|
set test_msg "finish from short_func"
|
84 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
85 |
|
|
-re " char_checkpoint .*$gdb_prompt $" {
|
86 |
|
|
send_gdb "step\n"
|
87 |
|
|
exp_continue
|
88 |
|
|
}
|
89 |
|
|
-re " short_checkpoint .*$gdb_prompt $" {
|
90 |
|
|
pass "$test_msg"
|
91 |
|
|
}
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
# Test finish from int func
|
95 |
|
|
|
96 |
|
|
set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
|
97 |
|
|
gdb_test "break int_func" \
|
98 |
|
|
"Breakpoint $decimal at .* line $breakloc\." \
|
99 |
|
|
"set breakpoint on int_func"
|
100 |
|
|
gdb_continue_to_breakpoint "int_func" ".*/$srcfile:$breakloc.*"
|
101 |
|
|
|
102 |
|
|
set test_msg "finish from int_func"
|
103 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
104 |
|
|
-re " short_checkpoint .*$gdb_prompt $" {
|
105 |
|
|
send_gdb "step\n"
|
106 |
|
|
exp_continue
|
107 |
|
|
}
|
108 |
|
|
-re " int_checkpoint .*$gdb_prompt $" {
|
109 |
|
|
pass "$test_msg"
|
110 |
|
|
}
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
# Test finish from long func
|
114 |
|
|
|
115 |
|
|
set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
|
116 |
|
|
gdb_test "break long_func" \
|
117 |
|
|
"Breakpoint $decimal at .* line $breakloc\." \
|
118 |
|
|
"set breakpoint on long_func"
|
119 |
|
|
gdb_continue_to_breakpoint "long_func" ".*/$srcfile:$breakloc.*"
|
120 |
|
|
|
121 |
|
|
set test_msg "finish from long_func"
|
122 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
123 |
|
|
-re " int_checkpoint .*$gdb_prompt $" {
|
124 |
|
|
send_gdb "step\n"
|
125 |
|
|
exp_continue
|
126 |
|
|
}
|
127 |
|
|
-re " long_checkpoint .*$gdb_prompt $" {
|
128 |
|
|
pass "$test_msg"
|
129 |
|
|
}
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
# Test finish from long long func
|
133 |
|
|
|
134 |
|
|
set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
|
135 |
|
|
gdb_test "break long_long_func" \
|
136 |
|
|
"Breakpoint $decimal at .* line $breakloc\." \
|
137 |
|
|
"set breakpoint on long_long_func"
|
138 |
|
|
gdb_continue_to_breakpoint "long_long_func" ".*/$srcfile:$breakloc.*"
|
139 |
|
|
|
140 |
|
|
set test_msg "finish from long_long_func"
|
141 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
142 |
|
|
-re " long_checkpoint .*$gdb_prompt $" {
|
143 |
|
|
send_gdb "step\n"
|
144 |
|
|
exp_continue
|
145 |
|
|
}
|
146 |
|
|
-re " long_long_checkpoint .*$gdb_prompt $" {
|
147 |
|
|
pass "$test_msg"
|
148 |
|
|
}
|
149 |
|
|
}
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
###
|
153 |
|
|
###
|
154 |
|
|
###
|
155 |
|
|
|
156 |
|
|
# Now switch to reverse
|
157 |
|
|
gdb_test_no_output "set exec-dir reverse" "set reverse execution"
|
158 |
|
|
|
159 |
|
|
# Test reverse finish from long long func
|
160 |
|
|
|
161 |
|
|
set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
|
162 |
|
|
gdb_continue_to_breakpoint "long_long_func" ".*/$srcfile:$breakloc.*"
|
163 |
|
|
|
164 |
|
|
set test_msg "reverse finish from long_long_func"
|
165 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
166 |
|
|
-re ".* long_checkpoint.*$gdb_prompt $" {
|
167 |
|
|
pass "$test_msg"
|
168 |
|
|
}
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
# Test reverse finish from long func
|
172 |
|
|
|
173 |
|
|
set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
|
174 |
|
|
gdb_continue_to_breakpoint "long_func" ".*/$srcfile:$breakloc.*"
|
175 |
|
|
|
176 |
|
|
set test_msg "reverse finish from long_func"
|
177 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
178 |
|
|
-re ".* int_checkpoint.*$gdb_prompt $" {
|
179 |
|
|
pass "$test_msg"
|
180 |
|
|
}
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
# Test reverse finish from int func
|
184 |
|
|
|
185 |
|
|
set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
|
186 |
|
|
gdb_continue_to_breakpoint "int_func" ".*/$srcfile:$breakloc.*"
|
187 |
|
|
|
188 |
|
|
set test_msg "reverse finish from int_func"
|
189 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
190 |
|
|
-re ".* short_checkpoint.*$gdb_prompt $" {
|
191 |
|
|
pass "$test_msg"
|
192 |
|
|
}
|
193 |
|
|
}
|
194 |
|
|
|
195 |
|
|
# Test reverse finish from short func
|
196 |
|
|
|
197 |
|
|
set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
|
198 |
|
|
gdb_continue_to_breakpoint "short_func" ".*/$srcfile:$breakloc.*"
|
199 |
|
|
|
200 |
|
|
set test_msg "reverse finish from short_func"
|
201 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
202 |
|
|
-re ".* char_checkpoint.*$gdb_prompt $" {
|
203 |
|
|
pass "$test_msg"
|
204 |
|
|
}
|
205 |
|
|
}
|
206 |
|
|
|
207 |
|
|
# Test reverse finish from char func
|
208 |
|
|
|
209 |
|
|
set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
|
210 |
|
|
gdb_continue_to_breakpoint "char_func" ".*/$srcfile:$breakloc.*"
|
211 |
|
|
|
212 |
|
|
set test_msg "reverse finish from char_func"
|
213 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
214 |
|
|
-re ".* void_checkpoint.*$gdb_prompt $" {
|
215 |
|
|
pass "$test_msg"
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
# Test reverse finish from void func
|
220 |
|
|
|
221 |
|
|
set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
|
222 |
|
|
gdb_continue_to_breakpoint "void_func" ".*/$srcfile:$breakloc.*"
|
223 |
|
|
|
224 |
|
|
set test_msg "reverse finish from void_func"
|
225 |
|
|
gdb_test_multiple "finish" "$test_msg" {
|
226 |
|
|
-re ".* call to void_func.*$gdb_prompt $" {
|
227 |
|
|
pass "$test_msg"
|
228 |
|
|
}
|
229 |
|
|
}
|