1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2008-2023 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 class NextOverThrowDerivates
33 // Single throw an exception in this function.
34 void function1 (int val
)
39 // Throw an exception in another function.
40 void function2 (int val
)
45 // Throw an exception in another function, but handle it
47 void function3 (int val
)
56 cout
<< "Caught and handled function1 exception" << endl
;
61 void rethrow (int val
)
75 // We use this to test that a "finish" here does not end up in
76 // this frame, but in the one above.
84 function1 (val
); // marker for until
90 function1 (val
); // until here
93 void resumebpt (int val
)
106 NextOverThrowDerivates next_cases
;
110 resumebpt_test (int x
)
114 next_cases
.resumebpt (x
); // Start: resumebpt
115 next_cases
.resumebpt (x
+ 1); // Second: resumebpt
132 next_cases
.function1 (0); // Start: first test
137 testval
= val
; // End: first test
142 next_cases
.function2 (1); // Start: nested throw
147 testval
= val
; // End: nested throw
152 // This is duplicated so we can next over one but step into
154 next_cases
.function2 (2); // Start: step in test
159 testval
= val
; // End: step in test
162 next_cases
.function3 (3); // Start: next past catch
164 testval
= 3; // End: next past catch
168 next_cases
.rethrow (4); // Start: rethrow
173 testval
= val
; // End: rethrow
178 // Another duplicate so we can test "finish".
179 next_cases
.function2 (5); // Start: first finish
184 testval
= val
; // End: first finish
187 // Another test for "finish".
190 next_cases
.finish (6); // Start: second finish
195 testval
= val
; // End: second finish
201 next_cases
.finish (7); // Start: first until
206 testval
= val
; // End: first until
209 // Test of "until" with an argument.
212 next_cases
.until (8); // Start: second until
217 testval
= val
; // End: second until
220 // Test of "advance".
223 next_cases
.until (9); // Start: advance
228 testval
= val
; // End: advance
231 // Test of "resumebpt".
232 testval
= resumebpt_test (10);
234 testval
= 32; // done