1 |
578 |
markom |
# Copyright (C) 1997, 1998 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 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 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
18 |
|
|
# bug-gdb@prep.ai.mit.edu
|
19 |
|
|
|
20 |
|
|
#
|
21 |
|
|
# tests for exception-handling support
|
22 |
|
|
# Written by Satish Pai 1997-07-23
|
23 |
|
|
|
24 |
|
|
# This file is part of the gdb testsuite
|
25 |
|
|
|
26 |
|
|
# Note: These tests are geared to the HP aCC compiler,
|
27 |
|
|
# which has an idiosyncratic way of emitting debug info
|
28 |
|
|
# for exceptions -- it uses a callback mechanism, which
|
29 |
|
|
# is different from the way g++ records exception info
|
30 |
|
|
# for debugging
|
31 |
|
|
|
32 |
|
|
# The tests are in two parts; the first part deals with
|
33 |
|
|
# statically linked (archive-bound) executables, and the
|
34 |
|
|
# second part repeats those tests with dynamically linked
|
35 |
|
|
# (shared bound) executables. (In the latter case we use
|
36 |
|
|
# a different mechanism to get the address of the notification
|
37 |
|
|
# hook in the C++ support library.) The tests themselves are
|
38 |
|
|
# the same in both parts.
|
39 |
|
|
#
|
40 |
|
|
# IMPORTANT:
|
41 |
|
|
# ---------
|
42 |
|
|
# IF YOU CHANGE A TEST IN ONE PART MAKE SURE YOU CHANGE IT
|
43 |
|
|
# --------------------------------------------------------
|
44 |
|
|
# IN THE OTHER PART TOO!
|
45 |
|
|
# ----------------------
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
if $tracelevel then {
|
50 |
|
|
strace $tracelevel
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
if { [skip_hp_tests] } then { continue }
|
54 |
|
|
|
55 |
|
|
#
|
56 |
|
|
# test running programs
|
57 |
|
|
#
|
58 |
|
|
|
59 |
|
|
# Part I : Archive-bound executables
|
60 |
|
|
# ----------------------------------
|
61 |
|
|
|
62 |
|
|
set testfile "exception"
|
63 |
|
|
set srcfile ${testfile}.cc
|
64 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
65 |
|
|
|
66 |
|
|
if [get_compiler_info ${binfile} "c++"] {
|
67 |
|
|
return -1;
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
if { $gcc_compiled } then { continue }
|
72 |
|
|
|
73 |
|
|
set cmdline "$CXX_FOR_TARGET ${srcdir}/${subdir}/${srcfile} +A -Wl,-a,archive -g -o ${binfile}"
|
74 |
|
|
|
75 |
|
|
remote_exec build $cmdline
|
76 |
|
|
|
77 |
|
|
# Start with a fresh gdb
|
78 |
|
|
|
79 |
|
|
set prms_id 0
|
80 |
|
|
set bug_id 0
|
81 |
|
|
|
82 |
|
|
gdb_exit
|
83 |
|
|
gdb_start
|
84 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
85 |
|
|
gdb_load ${binfile}
|
86 |
|
|
|
87 |
|
|
if ![runto_main] then {
|
88 |
|
|
perror "couldn't run to breakpoint"
|
89 |
|
|
continue
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
# Set a catch catchpoint
|
93 |
|
|
|
94 |
|
|
send_gdb "catch catch\n"
|
95 |
|
|
gdb_expect {
|
96 |
|
|
-re "Catchpoint \[0-9\]* \\(catch\\)\r\n$gdb_prompt $" {
|
97 |
|
|
pass "catch catch (static executable)"
|
98 |
|
|
}
|
99 |
|
|
-re ".*$gdb_prompt $" { fail "catch catch (static executable)" }
|
100 |
|
|
timeout { fail "(timeout) catch catch (static executable)" }
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
# Set a throw catchpoint
|
104 |
|
|
|
105 |
|
|
send_gdb "catch throw\n"
|
106 |
|
|
gdb_expect {
|
107 |
|
|
-re "Catchpoint \[0-9\]* \\(throw\\)\r\n$gdb_prompt $" {
|
108 |
|
|
pass "catch throw (static executable)"
|
109 |
|
|
}
|
110 |
|
|
-re ".*$gdb_prompt $" { fail "catch throw (static executable)" }
|
111 |
|
|
timeout { fail "(timeout) catch throw (static executable)" }
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
# The catchpoints should be listed in the list of breakpoints.
|
115 |
|
|
|
116 |
|
|
send_gdb "info break\n"
|
117 |
|
|
gdb_expect {
|
118 |
|
|
-re ".*\[0-9\]*\[ \]*catch catch\[ \]*keep y\[ \]*exception catch\[ \]*\r\n\[0-9\]*\[ \]*catch throw\[ \]*keep y\[ \]*exception throw\[ \]*\r\n$gdb_prompt $" {
|
119 |
|
|
pass "info break with catchpoints (static executable)"
|
120 |
|
|
}
|
121 |
|
|
-re ".*$gdb_prompt $" { fail "info break (static executable)" }
|
122 |
|
|
timeout { fail "(timeout) info break (static executable)" }
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
# Info catch currently does not work with HP aCC. No easy way to
|
126 |
|
|
# list the active handlers on the stack.
|
127 |
|
|
|
128 |
|
|
send_gdb "info catch\n"
|
129 |
|
|
gdb_expect {
|
130 |
|
|
-re "Info catch not supported with this target/compiler combination.\r\n$gdb_prompt $" {
|
131 |
|
|
pass "info catch (static executable)"
|
132 |
|
|
}
|
133 |
|
|
-re ".*$gdb_prompt $" { fail "info catch (static executable)" }
|
134 |
|
|
timeout { fail "(timeout) info catch (static executable)" }
|
135 |
|
|
}
|
136 |
|
|
|
137 |
|
|
# Get the first exception thrown
|
138 |
|
|
|
139 |
|
|
send_gdb "continue\n"
|
140 |
|
|
gdb_expect {
|
141 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:28\r\n.*$gdb_prompt $" {
|
142 |
|
|
pass "caught a throw (static executable)"
|
143 |
|
|
}
|
144 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a throw (static executable)" }
|
145 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a throw? (static executable)" }
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
send_gdb "backtrace\n"
|
149 |
|
|
gdb_expect {
|
150 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=__EH_NOTIFY_THROW.*\r\n#2\[ \]*$hex in __eh_notify_throw.*\r\n#3\[ \]*$hex in foo \\(i=20\\) at .*exception\\.cc:8\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:26\r\n$gdb_prompt $" {
|
151 |
|
|
pass "backtrace after throw (static executable)"
|
152 |
|
|
}
|
153 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=\[0-9\].*\r\n#2\[ \]*$hex in __eh_notify_throw.*\r\n#3\[ \]*$hex in foo \\(i=20\\) at .*exception\\.cc:8\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:26\r\n$gdb_prompt $" {
|
154 |
|
|
pass "backtrace after throw (static executable)"
|
155 |
|
|
}
|
156 |
|
|
-re ".*$gdb_prompt $" { fail "backtrace after throw (static executable)" }
|
157 |
|
|
timeout { fail "(timeout) backtrace after throw (static executable)" }
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
# Now intercept it when it is caught.
|
161 |
|
|
|
162 |
|
|
send_gdb "continue\n"
|
163 |
|
|
gdb_expect {
|
164 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception caught\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:28\r\n.*$gdb_prompt $" {
|
165 |
|
|
pass "caught a catch (static executable)"
|
166 |
|
|
}
|
167 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a catch (static executable)" }
|
168 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a catch? (static executable)" }
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
send_gdb "backtrace\n"
|
172 |
|
|
gdb_expect {
|
173 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=__EH_NOTIFY_CATCH.*\r\n.*\r\n#3\[ \]*$hex in __throw__.*\r\n#4\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#5\[ \]*$hex in main.* at .*exception.cc:26\r\n$gdb_prompt $" {
|
174 |
|
|
pass "backtrace after catch (static executable)"
|
175 |
|
|
}
|
176 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=\[0-9\].*\r\n.*\r\n#3\[ \]*$hex in __throw__.*\r\n#4\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#5\[ \]*$hex in main.* at .*exception.cc:26\r\n$gdb_prompt $" {
|
177 |
|
|
pass "backtrace after catch (static executable)"
|
178 |
|
|
}
|
179 |
|
|
-re ".*$gdb_prompt $" { fail "backtrace after catch (static executable)" }
|
180 |
|
|
timeout { fail "(timeout) backtrace after catch (static executable)" }
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
send_gdb "continue\n"
|
184 |
|
|
gdb_expect {
|
185 |
|
|
-re "Continuing\\.\r\nGot.*\r\nCatchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:36\r\n.*$gdb_prompt $" {
|
186 |
|
|
pass "caught a throw (2) (static executable)"
|
187 |
|
|
}
|
188 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a throw (2) (static executable)" }
|
189 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a throw (2)? (static executable)" }
|
190 |
|
|
}
|
191 |
|
|
|
192 |
|
|
send_gdb "continue\n"
|
193 |
|
|
gdb_expect {
|
194 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception caught\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:36\r\n.*$gdb_prompt $" {
|
195 |
|
|
pass "caught a catch (2) (static executable)"
|
196 |
|
|
}
|
197 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a catch (2) (static executable)" }
|
198 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a catch (2)? (static executable)" }
|
199 |
|
|
}
|
200 |
|
|
|
201 |
|
|
# Now the exception will be rethrown.
|
202 |
|
|
|
203 |
|
|
send_gdb "continue\n"
|
204 |
|
|
gdb_expect {
|
205 |
|
|
-re "Continuing\\.\r\nGot.*\r\nCatchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:38, catch location .*exception\\.cc:41\r\n.*$gdb_prompt $" {
|
206 |
|
|
pass "caught a rethrow (static executable)"
|
207 |
|
|
}
|
208 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a rethrow (static executable)" }
|
209 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a rethrow? (static executable)" }
|
210 |
|
|
}
|
211 |
|
|
|
212 |
|
|
send_gdb "continue\n"
|
213 |
|
|
gdb_expect {
|
214 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception caught\\), throw location.*exception\\.cc:3\[68\], catch location .*exception\\.cc:41\r\n.*$gdb_prompt $" {
|
215 |
|
|
# FIXME: guo: why XFAIL? need comment
|
216 |
|
|
xfail "caught a catch (3) (static executable)"
|
217 |
|
|
}
|
218 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a catch (3) (static executable)" }
|
219 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a catch (3)? (static executable)" }
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
send_gdb "backtrace\n"
|
223 |
|
|
gdb_expect {
|
224 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=__EH_NOTIFY_CATCH.*\r\n.*\r\n#3\[ \]*$hex in __rethrow.*\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:3\[68\]\r\n#5\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#6\[ \]*$hex in main.* at .*exception.cc:34\r\n$gdb_prompt $" {
|
225 |
|
|
# FIXME: guo: why XFAIL? need comment
|
226 |
|
|
xfail "backtrace after catch (3) (static executable)"
|
227 |
|
|
}
|
228 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=\[0-9\].*\r\n.*\r\n#3\[ \]*$hex in __rethrow.*\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:3\[68\]\r\n#5\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#6\[ \]*$hex in main.* at .*exception.cc:34\r\n$gdb_prompt $" {
|
229 |
|
|
# FIXME: guo: why XFAIL? need comment
|
230 |
|
|
xfail "backtrace after catch (3) (static executable)"
|
231 |
|
|
}
|
232 |
|
|
-re ".*$gdb_prompt $" { fail "backtrace after catch (3) (static executable)" }
|
233 |
|
|
timeout { fail "(timeout) backtrace after catch (3) (static executable)" }
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
# Now the exception will be thrown, but not catch-able anywhere.
|
237 |
|
|
|
238 |
|
|
send_gdb "continue\n"
|
239 |
|
|
gdb_expect {
|
240 |
|
|
-re "Continuing\\.\r\nGot.*\r\nCatchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:8, catch location unknown\r\n.*$gdb_prompt $" {
|
241 |
|
|
pass "caught an uncatchable throw (static executable)"
|
242 |
|
|
}
|
243 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch an uncatchable throw (static executable)" }
|
244 |
|
|
timeout { fail "(timeout) after continue -- didn't catch an uncatchable throw? (static executable)" }
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
# Part II : Shared-bound executables
|
248 |
|
|
# ----------------------------------
|
249 |
|
|
|
250 |
|
|
# Start with a fresh gdb
|
251 |
|
|
gdb_exit
|
252 |
|
|
gdb_start
|
253 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
254 |
|
|
|
255 |
|
|
set prms_id 0
|
256 |
|
|
set bug_id 0
|
257 |
|
|
|
258 |
|
|
set testfile "exception"
|
259 |
|
|
set srcfile ${testfile}.cc
|
260 |
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
261 |
|
|
|
262 |
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
263 |
|
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will a
|
264 |
|
|
utomatically fail."
|
265 |
|
|
}
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
gdb_exit
|
269 |
|
|
gdb_start
|
270 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
271 |
|
|
gdb_load ${binfile}
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
if ![runto_main] then {
|
275 |
|
|
perror "couldn't run to breakpoint"
|
276 |
|
|
continue
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
# Set a catch catchpoint
|
280 |
|
|
|
281 |
|
|
send_gdb "catch catch\n"
|
282 |
|
|
gdb_expect {
|
283 |
|
|
-re "Catchpoint \[0-9\]* \\(catch\\)\r\n$gdb_prompt $" {
|
284 |
|
|
pass "catch catch (dynamic executable)"
|
285 |
|
|
}
|
286 |
|
|
-re ".*$gdb_prompt $" { fail "catch catch (dynamic executable)" }
|
287 |
|
|
timeout { fail "(timeout) catch catch (dynamic executable)" }
|
288 |
|
|
}
|
289 |
|
|
|
290 |
|
|
# Set a throw catchpoint
|
291 |
|
|
|
292 |
|
|
send_gdb "catch throw\n"
|
293 |
|
|
gdb_expect {
|
294 |
|
|
-re "Catchpoint \[0-9\]* \\(throw\\)\r\n$gdb_prompt $" {
|
295 |
|
|
pass "catch throw (dynamic executable)"
|
296 |
|
|
}
|
297 |
|
|
-re ".*$gdb_prompt $" { fail "catch throw (dynamic executable)" }
|
298 |
|
|
timeout { fail "(timeout) catch throw (dynamic executable)" }
|
299 |
|
|
}
|
300 |
|
|
|
301 |
|
|
# The catchpoints should be listed in the list of breakpoints.
|
302 |
|
|
|
303 |
|
|
send_gdb "info break\n"
|
304 |
|
|
gdb_expect {
|
305 |
|
|
-re ".*\[0-9\]*\[ \]*catch catch\[ \]*keep y\[ \]*exception catch\[ \]*\r\n\[0-9\]*\[ \]*catch throw\[ \]*keep y\[ \]*exception throw\[ \]*\r\n$gdb_prompt $" {
|
306 |
|
|
pass "info break with catchpoints (dynamic executable)"
|
307 |
|
|
}
|
308 |
|
|
-re ".*$gdb_prompt $" { fail "info break (dynamic executable)" }
|
309 |
|
|
timeout { fail "(timeout) info break (dynamic executable)" }
|
310 |
|
|
}
|
311 |
|
|
|
312 |
|
|
# Info catch currently does not work with HP aCC. No easy way to
|
313 |
|
|
# list the active handlers on the stack.
|
314 |
|
|
|
315 |
|
|
send_gdb "info catch\n"
|
316 |
|
|
gdb_expect {
|
317 |
|
|
-re "Info catch not supported with this target/compiler combination.\r\n$gdb_prompt $" {
|
318 |
|
|
pass "info catch (dynamic executable)"
|
319 |
|
|
}
|
320 |
|
|
-re ".*$gdb_prompt $" { fail "info catch (dynamic executable)" }
|
321 |
|
|
timeout { fail "(timeout) info catch (dynamic executable)" }
|
322 |
|
|
}
|
323 |
|
|
|
324 |
|
|
# Get the first exception thrown
|
325 |
|
|
|
326 |
|
|
send_gdb "continue\n"
|
327 |
|
|
gdb_expect {
|
328 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:28\r\n.*$gdb_prompt $" {
|
329 |
|
|
pass "caught a throw (dynamic executable)"
|
330 |
|
|
}
|
331 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a throw (dynamic executable)" }
|
332 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a throw? (dynamic executable)" }
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
send_gdb "backtrace\n"
|
336 |
|
|
gdb_expect {
|
337 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=__EH_NOTIFY_THROW.*\r\n#2\[ \]*$hex in __eh_notify_throw.*\r\n#3\[ \]*$hex in foo \\(i=20\\) at .*exception\\.cc:8\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:26\r\n$gdb_prompt $" {
|
338 |
|
|
pass "backtrace after throw (dynamic executable)"
|
339 |
|
|
}
|
340 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=\[0-9\].*\r\n#2\[ \]*$hex in __eh_notify_throw.*\r\n#3\[ \]*$hex in foo \\(i=20\\) at .*exception\\.cc:8\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:26\r\n$gdb_prompt $" {
|
341 |
|
|
pass "backtrace after throw (dynamic executable)"
|
342 |
|
|
}
|
343 |
|
|
-re ".*$gdb_prompt $" { fail "backtrace after throw (dynamic executable)" }
|
344 |
|
|
timeout { fail "(timeout) backtrace after throw (dynamic executable)" }
|
345 |
|
|
}
|
346 |
|
|
|
347 |
|
|
# Now intercept it when it is caught.
|
348 |
|
|
|
349 |
|
|
send_gdb "continue\n"
|
350 |
|
|
gdb_expect {
|
351 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception caught\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:28\r\n.*$gdb_prompt $" {
|
352 |
|
|
pass "caught a catch (dynamic executable)"
|
353 |
|
|
}
|
354 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a catch (dynamic executable)" }
|
355 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a catch? (dynamic executable)" }
|
356 |
|
|
}
|
357 |
|
|
|
358 |
|
|
send_gdb "backtrace\n"
|
359 |
|
|
gdb_expect {
|
360 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=__EH_NOTIFY_CATCH.*\r\n.*\r\n#3\[ \]*$hex in __throw__.*\r\n#4\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#5\[ \]*$hex in main.* at .*exception.cc:26\r\n$gdb_prompt $" {
|
361 |
|
|
pass "backtrace after catch (dynamic executable)"
|
362 |
|
|
}
|
363 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=\[0-9\].*\r\n.*\r\n#3\[ \]*$hex in __throw__.*\r\n#4\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#5\[ \]*$hex in main.* at .*exception.cc:26\r\n$gdb_prompt $" {
|
364 |
|
|
pass "backtrace after catch (dynamic executable)"
|
365 |
|
|
}
|
366 |
|
|
-re ".*$gdb_prompt $" { fail "backtrace after catch (dynamic executable)" }
|
367 |
|
|
timeout { fail "(timeout) backtrace after catch (dynamic executable)" }
|
368 |
|
|
}
|
369 |
|
|
|
370 |
|
|
send_gdb "continue\n"
|
371 |
|
|
gdb_expect {
|
372 |
|
|
-re "Continuing\\.\r\nGot.*\r\nCatchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:36\r\n.*$gdb_prompt $" {
|
373 |
|
|
pass "caught a throw (2) (dynamic executable)"
|
374 |
|
|
}
|
375 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a throw (2) (dynamic executable)" }
|
376 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a throw (2)? (dynamic executable)" }
|
377 |
|
|
}
|
378 |
|
|
|
379 |
|
|
send_gdb "continue\n"
|
380 |
|
|
gdb_expect {
|
381 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception caught\\), throw location.*exception\\.cc:8, catch location .*exception\\.cc:36\r\n.*$gdb_prompt $" {
|
382 |
|
|
pass "caught a catch (2) (dynamic executable)"
|
383 |
|
|
}
|
384 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a catch (2) (dynamic executable)" }
|
385 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a catch (2)? (dynamic executable)" }
|
386 |
|
|
}
|
387 |
|
|
|
388 |
|
|
# Now the exception will be rethrown.
|
389 |
|
|
|
390 |
|
|
send_gdb "continue\n"
|
391 |
|
|
gdb_expect {
|
392 |
|
|
-re "Continuing\\.\r\nGot.*\r\nCatchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:38, catch location .*exception\\.cc:41\r\n.*$gdb_prompt $" {
|
393 |
|
|
pass "caught a rethrow (dynamic executable)"
|
394 |
|
|
}
|
395 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a rethrow (dynamic executable)" }
|
396 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a rethrow? (dynamic executable)" }
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
#DTS CLLbs14858
|
400 |
|
|
#The throw location should be at line 38 instead of 36.
|
401 |
|
|
setup_xfail hppa*-*-* CLLbs14858
|
402 |
|
|
send_gdb "continue\n"
|
403 |
|
|
gdb_expect {
|
404 |
|
|
-re "Continuing.*Catchpoint \[0-9\]* \\(exception caught\\), throw location.*exception\\.cc:3\[68\], catch location .*exception\\.cc:41\r\n.*$gdb_prompt $" {
|
405 |
|
|
# FIXME: guo: according to comment above the RE is wrong!
|
406 |
|
|
pass "caught a catch (3) (dynamic executable)"
|
407 |
|
|
}
|
408 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch a catch (3) (dynamic executable)" }
|
409 |
|
|
timeout { fail "(timeout) after continue -- didn't catch a catch (3)? (dynamic executable)" }
|
410 |
|
|
}
|
411 |
|
|
|
412 |
|
|
#DTS CLLbs14858
|
413 |
|
|
#The line number for main() should be at exception.cc:38 instead of exception.cc:36
|
414 |
|
|
setup_xfail hppa*-*-* CLLbs14858
|
415 |
|
|
send_gdb "backtrace\n"
|
416 |
|
|
gdb_expect {
|
417 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=__EH_NOTIFY_CATCH.*\r\n.*\r\n#3\[ \]*$hex in __rethrow.*\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:3\[68\]\r\n#5\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#6\[ \]*$hex in main.* at .*exception.cc:34\r\n$gdb_prompt $" {
|
418 |
|
|
# FIXME: guo: according to comment above the RE is wrong!
|
419 |
|
|
pass "backtrace after catch (3) (dynamic executable)"
|
420 |
|
|
}
|
421 |
|
|
-re "#0\[ \]*__d_eh_break.*\r\n#1\[ \]*$hex in __d_eh_notify_callback \\(eh_type=\[0-9\].*\r\n.*\r\n#3\[ \]*$hex in __rethrow.*\r\n#4\[ \]*$hex in main.* at .*exception\\.cc:3\[68\]\r\n#5\[ \]*$hex in foo \\(i=20\\) at .*exception.cc:8\r\n#6\[ \]*$hex in main.* at .*exception.cc:34\r\n$gdb_prompt $" {
|
422 |
|
|
# FIXME: guo: according to comment above the RE is wrong!
|
423 |
|
|
pass "backtrace after catch (3) (dynamic executable)"
|
424 |
|
|
}
|
425 |
|
|
-re ".*$gdb_prompt $" { fail "backtrace after catch (3) (dynamic executable)" }
|
426 |
|
|
timeout { fail "(timeout) backtrace after catch (3) (dynamic executable)" }
|
427 |
|
|
}
|
428 |
|
|
|
429 |
|
|
# Now the exception will be thrown, but not catch-able anywhere.
|
430 |
|
|
|
431 |
|
|
send_gdb "continue\n"
|
432 |
|
|
gdb_expect {
|
433 |
|
|
-re "Continuing\\.\r\nGot.*\r\nCatchpoint \[0-9\]* \\(exception thrown\\), throw location.*exception\\.cc:8, catch location unknown\r\n.*$gdb_prompt $" {
|
434 |
|
|
pass "caught an uncatchable throw (dynamic executable)"
|
435 |
|
|
}
|
436 |
|
|
-re ".*$gdb_prompt $" { fail "didn't catch an uncatchable throw (dynamic executable)" }
|
437 |
|
|
timeout { fail "(timeout) after continue -- didn't catch an uncatchable throw? (dynamic executable)" }
|
438 |
|
|
}
|
439 |
|
|
|