GNU Binutils with patches for OS216
Revision | b366739fd4ad21a76b7f39bf28243a315124d885 (tree) |
---|---|
Time | 2016-09-24 01:57:50 |
Author | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
Get rid of gdb_exception::message copying/xstrdup'ing
Gets rid of all gdb_exception (and thus gdb_exception::message)
copying introduded by the previous patch, by:
- using rethrow_exception whenever we want to rethrow from within a
- making throw_exception take an rval reference, in order to allow
Actually, now that I think more about this, since we're always going
to end up copying the exception, it may be better to instead rely on
copy elision, and keep things simpler by always passing by value
around. The rethrow_exception bits should still be useful though.
@@ -556,7 +556,7 @@ aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_cache) | ||
556 | 556 | CATCH (const gdb_error &ex) |
557 | 557 | { |
558 | 558 | if (ex.error != NOT_AVAILABLE_ERROR) |
559 | - throw_exception (ex); | |
559 | + rethrow_exception (); | |
560 | 560 | } |
561 | 561 | END_CATCH |
562 | 562 |
@@ -683,7 +683,7 @@ aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache) | ||
683 | 683 | CATCH (const gdb_error &ex) |
684 | 684 | { |
685 | 685 | if (ex.error != NOT_AVAILABLE_ERROR) |
686 | - throw_exception (ex); | |
686 | + rethrow_exception (); | |
687 | 687 | } |
688 | 688 | END_CATCH |
689 | 689 |
@@ -2541,7 +2541,7 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2541 | 2541 | CATCH (const gdb_error &ex) |
2542 | 2542 | { |
2543 | 2543 | if (ex.error != NOT_AVAILABLE_ERROR) |
2544 | - throw_exception (ex); | |
2544 | + rethrow_exception (); | |
2545 | 2545 | } |
2546 | 2546 | END_CATCH |
2547 | 2547 |
@@ -2669,7 +2669,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2669 | 2669 | CATCH (const gdb_error &ex) |
2670 | 2670 | { |
2671 | 2671 | if (ex.error != NOT_AVAILABLE_ERROR) |
2672 | - throw_exception (ex); | |
2672 | + rethrow_exception (); | |
2673 | 2673 | } |
2674 | 2674 | END_CATCH |
2675 | 2675 |
@@ -2850,7 +2850,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2850 | 2850 | CATCH (const gdb_error &ex) |
2851 | 2851 | { |
2852 | 2852 | if (ex.error != NOT_AVAILABLE_ERROR) |
2853 | - throw_exception (ex); | |
2853 | + rethrow_exception (); | |
2854 | 2854 | } |
2855 | 2855 | END_CATCH |
2856 | 2856 |
@@ -243,7 +243,7 @@ re_set_exception_catchpoint (struct breakpoint *self) | ||
243 | 243 | /* NOT_FOUND_ERROR just means the breakpoint will be |
244 | 244 | pending, so let it through. */ |
245 | 245 | if (ex.error != NOT_FOUND_ERROR) |
246 | - throw_exception (ex); | |
246 | + rethrow_exception (); | |
247 | 247 | } |
248 | 248 | END_CATCH |
249 | 249 | } |
@@ -9809,7 +9809,7 @@ create_breakpoint (struct gdbarch *gdbarch, | ||
9809 | 9809 | error. */ |
9810 | 9810 | |
9811 | 9811 | if (pending_break_support == AUTO_BOOLEAN_FALSE) |
9812 | - throw_exception (e); | |
9812 | + rethrow_exception (); | |
9813 | 9813 | |
9814 | 9814 | exception_print (gdb_stderr, e); |
9815 | 9815 |
@@ -9827,7 +9827,7 @@ create_breakpoint (struct gdbarch *gdbarch, | ||
9827 | 9827 | pending = 1; |
9828 | 9828 | } |
9829 | 9829 | else |
9830 | - throw_exception (e); | |
9830 | + rethrow_exception (); | |
9831 | 9831 | } |
9832 | 9832 | END_CATCH |
9833 | 9833 |
@@ -11464,7 +11464,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty, | ||
11464 | 11464 | CATCH (const gdb_exception &e) |
11465 | 11465 | { |
11466 | 11466 | delete_breakpoint (b); |
11467 | - throw_exception (e); | |
11467 | + rethrow_exception (); | |
11468 | 11468 | } |
11469 | 11469 | END_CATCH |
11470 | 11470 |
@@ -14425,11 +14425,11 @@ location_to_sals (struct breakpoint *b, struct event_location *location, | ||
14425 | 14425 | { |
14426 | 14426 | b->ops->decode_location (b, location, search_pspace, &sals); |
14427 | 14427 | } |
14428 | - CATCH (const gdb_error &e) | |
14428 | + CATCH (gdb_error &e) | |
14429 | 14429 | { |
14430 | 14430 | int not_found_and_ok = 0; |
14431 | 14431 | |
14432 | - exception = e; | |
14432 | + exception = gdb::move (e); | |
14433 | 14433 | |
14434 | 14434 | /* For pending breakpoints, it's expected that parsing will |
14435 | 14435 | fail until the right shared library is loaded. User has |
@@ -14457,7 +14457,7 @@ location_to_sals (struct breakpoint *b, struct event_location *location, | ||
14457 | 14457 | happens only when a binary has changed, I don't know |
14458 | 14458 | which approach is better. */ |
14459 | 14459 | b->enable_state = bp_disabled; |
14460 | - throw_exception (e); | |
14460 | + rethrow_exception (); | |
14461 | 14461 | } |
14462 | 14462 | } |
14463 | 14463 | END_CATCH |
@@ -15774,7 +15774,7 @@ save_breakpoints (char *filename, int from_tty, | ||
15774 | 15774 | CATCH (const gdb_exception &ex) |
15775 | 15775 | { |
15776 | 15776 | ui_out_redirect (current_uiout, NULL); |
15777 | - throw_exception (ex); | |
15777 | + rethrow_exception (); | |
15778 | 15778 | } |
15779 | 15779 | END_CATCH |
15780 | 15780 |
@@ -958,7 +958,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp, | ||
958 | 958 | |
959 | 959 | btrace_finalize_ftrace_pt (decoder, tp, level); |
960 | 960 | |
961 | - throw_exception (error); | |
961 | + rethrow_exception (); | |
962 | 962 | } |
963 | 963 | END_CATCH |
964 | 964 |
@@ -2499,8 +2499,7 @@ btrace_maint_update_pt_packets (struct btrace_thread_info *btinfo) | ||
2499 | 2499 | { |
2500 | 2500 | pt_pkt_free_decoder (decoder); |
2501 | 2501 | |
2502 | - if (except.reason < 0) | |
2503 | - throw_exception (except); | |
2502 | + rethrow_exception (); | |
2504 | 2503 | } |
2505 | 2504 | END_CATCH |
2506 | 2505 |
@@ -1116,7 +1116,7 @@ process_next_line (char *p, struct command_line **command, int parse_commands, | ||
1116 | 1116 | CATCH (const gdb_exception &ex) |
1117 | 1117 | { |
1118 | 1118 | xfree (*command); |
1119 | - throw_exception (ex); | |
1119 | + rethrow_exception (); | |
1120 | 1120 | } |
1121 | 1121 | END_CATCH |
1122 | 1122 | } |
@@ -208,7 +208,7 @@ exception_try_scope_exit (void *saved_state) | ||
208 | 208 | exception is not caught. */ |
209 | 209 | |
210 | 210 | void |
211 | -exception_rethrow (void) | |
211 | +rethrow_exception () | |
212 | 212 | { |
213 | 213 | /* Run this scope's cleanups before re-throwing to the next |
214 | 214 | outermost scope. */ |
@@ -257,16 +257,6 @@ throw_it (enum return_reason reason, enum errors error, const char *fmt, | ||
257 | 257 | } |
258 | 258 | |
259 | 259 | void |
260 | -throw_exception (const gdb_exception &exception) | |
261 | -{ | |
262 | - const char *message = (exception.message != NULL | |
263 | - ? xstrdup (exception.message) | |
264 | - : NULL); | |
265 | - | |
266 | - throw_exception (exception.reason, exception.error, message); | |
267 | -} | |
268 | - | |
269 | -void | |
270 | 260 | throw_exception (gdb_exception_rval_ref exception) |
271 | 261 | { |
272 | 262 | const char *message = exception.message; |
@@ -262,7 +262,6 @@ extern struct gdb_exception exceptions_state_mc_catch (); | ||
262 | 262 | |
263 | 263 | extern void *exception_try_scope_entry (void); |
264 | 264 | extern void exception_try_scope_exit (void *saved_state); |
265 | -extern void exception_rethrow (void); | |
266 | 265 | |
267 | 266 | /* Macro to wrap up standard try/catch behavior. |
268 | 267 |
@@ -351,7 +350,7 @@ struct exception_try_scope | ||
351 | 350 | #define END_CATCH \ |
352 | 351 | catch (...) \ |
353 | 352 | { \ |
354 | - exception_rethrow (); \ | |
353 | + rethrow_exception (); \ | |
355 | 354 | } |
356 | 355 | |
357 | 356 | #else |
@@ -403,13 +402,13 @@ struct gdb_quit_bad_alloc | ||
403 | 402 | /* *INDENT-ON* */ |
404 | 403 | |
405 | 404 | /* Throw an exception (as described by "struct gdb_exception"). */ |
406 | -extern void throw_exception (const gdb_exception &exception) | |
407 | - ATTRIBUTE_NORETURN; | |
408 | - | |
409 | -/* Likewise, but take an rval reference. */ | |
410 | 405 | extern void throw_exception (gdb_exception_rval_ref exception) |
411 | 406 | ATTRIBUTE_NORETURN; |
412 | 407 | |
408 | +/* Rethrow the currently caught exception. Wrapper around "throw;" | |
409 | + that also handles cleanups. */ | |
410 | +extern void rethrow_exception (void); | |
411 | + | |
413 | 412 | /* Throw an exception by executing a LONG JUMP to the inner most |
414 | 413 | containing exception handler established using TRY_SJLJ. Works the |
415 | 414 | same regardless of whether GDB is built as a C program or a C++ |
@@ -185,7 +185,7 @@ compile_object_run (struct compile_module *module) | ||
185 | 185 | gdb_assert (!(dtor_found && executed)); |
186 | 186 | if (!dtor_found && !executed) |
187 | 187 | do_module_cleanup (data, 0); |
188 | - throw_exception (ex); | |
188 | + rethrow_exception (); | |
189 | 189 | } |
190 | 190 | END_CATCH |
191 | 191 |
@@ -82,7 +82,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr, | ||
82 | 82 | CATCH (const gdb_error &ex) |
83 | 83 | { |
84 | 84 | if (ex.error != NOT_AVAILABLE_ERROR) |
85 | - throw_exception (ex); | |
85 | + rethrow_exception (); | |
86 | 86 | |
87 | 87 | throw_error (NOT_AVAILABLE_ERROR, |
88 | 88 | _("Cannot determine virtual baseclass offset " |
@@ -1137,7 +1137,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
1137 | 1137 | return cache; |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - throw_exception (ex); | |
1140 | + rethrow_exception (); | |
1141 | 1141 | } |
1142 | 1142 | END_CATCH |
1143 | 1143 |
@@ -1080,7 +1080,7 @@ call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc, | ||
1080 | 1080 | return NULL; |
1081 | 1081 | } |
1082 | 1082 | else |
1083 | - throw_exception (e); | |
1083 | + rethrow_exception (); | |
1084 | 1084 | } |
1085 | 1085 | END_CATCH |
1086 | 1086 |
@@ -2349,7 +2349,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, | ||
2349 | 2349 | return allocate_optimized_out_value (type); |
2350 | 2350 | } |
2351 | 2351 | else |
2352 | - throw_exception (ex); | |
2352 | + rethrow_exception (); | |
2353 | 2353 | } |
2354 | 2354 | END_CATCH |
2355 | 2355 |
@@ -238,7 +238,7 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp, | ||
238 | 238 | if (!preserve_errors) |
239 | 239 | break; |
240 | 240 | default: |
241 | - throw_exception (ex); | |
241 | + rethrow_exception (); | |
242 | 242 | break; |
243 | 243 | } |
244 | 244 | } |
@@ -780,7 +780,7 @@ evaluate_subexp_standard (struct type *expect_type, | ||
780 | 780 | ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol), |
781 | 781 | not_lval); |
782 | 782 | else |
783 | - throw_exception (except); | |
783 | + rethrow_exception (); | |
784 | 784 | } |
785 | 785 | END_CATCH |
786 | 786 |
@@ -1460,7 +1460,7 @@ evaluate_subexp_standard (struct type *expect_type, | ||
1460 | 1460 | if (except.error == NOT_FOUND_ERROR) |
1461 | 1461 | break; |
1462 | 1462 | else |
1463 | - throw_exception (except); | |
1463 | + rethrow_exception (); | |
1464 | 1464 | } |
1465 | 1465 | END_CATCH |
1466 | 1466 |
@@ -1887,7 +1887,7 @@ evaluate_subexp_standard (struct type *expect_type, | ||
1887 | 1887 | if (except.error == NOT_FOUND_ERROR) |
1888 | 1888 | break; |
1889 | 1889 | else |
1890 | - throw_exception (except); | |
1890 | + rethrow_exception (); | |
1891 | 1891 | } |
1892 | 1892 | END_CATCH |
1893 | 1893 |
@@ -182,9 +182,9 @@ catch_exceptions_with_msg (struct ui_out *func_uiout, | ||
182 | 182 | { |
183 | 183 | val = (*func) (current_uiout, func_args); |
184 | 184 | } |
185 | - CATCH (const gdb_exception &ex) | |
185 | + CATCH (gdb_exception &ex) | |
186 | 186 | { |
187 | - exception = ex; | |
187 | + exception = gdb::move (ex); | |
188 | 188 | } |
189 | 189 | END_CATCH |
190 | 190 |
@@ -195,7 +195,7 @@ catch_exceptions_with_msg (struct ui_out *func_uiout, | ||
195 | 195 | { |
196 | 196 | /* The caller didn't request that the event be caught. |
197 | 197 | Rethrow. */ |
198 | - throw_exception (exception); | |
198 | + throw_exception (gdb::move (exception)); | |
199 | 199 | } |
200 | 200 | |
201 | 201 | exception_print (gdb_stderr, exception); |
@@ -235,9 +235,9 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, | ||
235 | 235 | { |
236 | 236 | val = func (func_args); |
237 | 237 | } |
238 | - CATCH (const gdb_exception &ex) | |
238 | + CATCH (gdb_exception &ex) | |
239 | 239 | { |
240 | - exception = ex; | |
240 | + exception = gdb::move (ex); | |
241 | 241 | } |
242 | 242 | END_CATCH |
243 | 243 |
@@ -248,7 +248,7 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring, | ||
248 | 248 | { |
249 | 249 | /* The caller didn't request that the event be caught. |
250 | 250 | Rethrow. */ |
251 | - throw_exception (exception); | |
251 | + throw_exception (gdb::move (exception)); | |
252 | 252 | } |
253 | 253 | |
254 | 254 | exception_fprintf (gdb_stderr, exception, "%s", errstring); |
@@ -117,7 +117,7 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache, | ||
117 | 117 | do_cleanups (old_cleanup); |
118 | 118 | return 0; |
119 | 119 | } |
120 | - throw_exception (ex); | |
120 | + rethrow_exception (); | |
121 | 121 | } |
122 | 122 | END_CATCH |
123 | 123 |
@@ -892,7 +892,7 @@ frame_unwind_pc (struct frame_info *this_frame) | ||
892 | 892 | this_frame->level); |
893 | 893 | } |
894 | 894 | else |
895 | - throw_exception (ex); | |
895 | + rethrow_exception (); | |
896 | 896 | } |
897 | 897 | END_CATCH |
898 | 898 |
@@ -2058,7 +2058,7 @@ get_prev_frame_always (struct frame_info *this_frame) | ||
2058 | 2058 | prev_frame = NULL; |
2059 | 2059 | } |
2060 | 2060 | else |
2061 | - throw_exception (ex); | |
2061 | + rethrow_exception (); | |
2062 | 2062 | } |
2063 | 2063 | END_CATCH |
2064 | 2064 |
@@ -2301,7 +2301,7 @@ get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc) | ||
2301 | 2301 | if (ex.error == NOT_AVAILABLE_ERROR) |
2302 | 2302 | return 0; |
2303 | 2303 | else |
2304 | - throw_exception (ex); | |
2304 | + rethrow_exception (); | |
2305 | 2305 | } |
2306 | 2306 | END_CATCH |
2307 | 2307 |
@@ -2383,7 +2383,7 @@ get_frame_address_in_block_if_available (struct frame_info *this_frame, | ||
2383 | 2383 | { |
2384 | 2384 | if (ex.error == NOT_AVAILABLE_ERROR) |
2385 | 2385 | return 0; |
2386 | - throw_exception (ex); | |
2386 | + rethrow_exception (); | |
2387 | 2387 | } |
2388 | 2388 | END_CATCH |
2389 | 2389 |
@@ -2671,7 +2671,7 @@ get_frame_language (struct frame_info *frame) | ||
2671 | 2671 | CATCH (const gdb_error &ex) |
2672 | 2672 | { |
2673 | 2673 | if (ex.error != NOT_AVAILABLE_ERROR) |
2674 | - throw_exception (ex); | |
2674 | + rethrow_exception (); | |
2675 | 2675 | } |
2676 | 2676 | END_CATCH |
2677 | 2677 |
@@ -123,16 +123,16 @@ write_gcore_file (bfd *obfd) | ||
123 | 123 | { |
124 | 124 | write_gcore_file_1 (obfd); |
125 | 125 | } |
126 | - CATCH (const gdb_exception &e) | |
126 | + CATCH (gdb_exception &e) | |
127 | 127 | { |
128 | - except = e; | |
128 | + except = gdb::move (e); | |
129 | 129 | } |
130 | 130 | END_CATCH |
131 | 131 | |
132 | 132 | target_done_generating_core (); |
133 | 133 | |
134 | 134 | if (except.reason < 0) |
135 | - throw_exception (except); | |
135 | + throw_exception (gdb::move (except)); | |
136 | 136 | } |
137 | 137 | |
138 | 138 | static void |
@@ -1527,7 +1527,7 @@ linux_detach_one_lwp (struct lwp_info *lwp) | ||
1527 | 1527 | CATCH (const gdb_error &ex) |
1528 | 1528 | { |
1529 | 1529 | if (!check_ptrace_stopped_lwp_gone (lwp)) |
1530 | - throw_exception (ex); | |
1530 | + rethrow_exception (); | |
1531 | 1531 | } |
1532 | 1532 | END_CATCH |
1533 | 1533 |
@@ -4586,7 +4586,7 @@ linux_resume_one_lwp (struct lwp_info *lwp, | ||
4586 | 4586 | CATCH (const gdb_error &ex) |
4587 | 4587 | { |
4588 | 4588 | if (!check_ptrace_stopped_lwp_gone (lwp)) |
4589 | - throw_exception (ex); | |
4589 | + rethrow_exception (); | |
4590 | 4590 | } |
4591 | 4591 | END_CATCH |
4592 | 4592 | } |
@@ -3534,9 +3534,9 @@ types_deeply_equal (struct type *type1, struct type *type2) | ||
3534 | 3534 | { |
3535 | 3535 | result = check_types_worklist (&worklist, cache); |
3536 | 3536 | } |
3537 | - CATCH (const gdb_exception &ex) | |
3537 | + CATCH (gdb_exception &ex) | |
3538 | 3538 | { |
3539 | - except = ex; | |
3539 | + except = gdb::move (ex); | |
3540 | 3540 | } |
3541 | 3541 | END_CATCH |
3542 | 3542 |
@@ -3545,7 +3545,7 @@ types_deeply_equal (struct type *type1, struct type *type2) | ||
3545 | 3545 | |
3546 | 3546 | /* Rethrow if there was a problem. */ |
3547 | 3547 | if (except.reason < 0) |
3548 | - throw_exception (except); | |
3548 | + throw_exception (gdb::move (except)); | |
3549 | 3549 | |
3550 | 3550 | return result; |
3551 | 3551 | } |
@@ -2076,7 +2076,7 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2076 | 2076 | CATCH (const gdb_error &ex) |
2077 | 2077 | { |
2078 | 2078 | if (ex.error != NOT_AVAILABLE_ERROR) |
2079 | - throw_exception (ex); | |
2079 | + rethrow_exception (); | |
2080 | 2080 | } |
2081 | 2081 | END_CATCH |
2082 | 2082 |
@@ -2256,7 +2256,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2256 | 2256 | CATCH (const gdb_error &ex) |
2257 | 2257 | { |
2258 | 2258 | if (ex.error != NOT_AVAILABLE_ERROR) |
2259 | - throw_exception (ex); | |
2259 | + rethrow_exception (); | |
2260 | 2260 | } |
2261 | 2261 | END_CATCH |
2262 | 2262 |
@@ -2452,7 +2452,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
2452 | 2452 | CATCH (const gdb_error &ex) |
2453 | 2453 | { |
2454 | 2454 | if (ex.error != NOT_AVAILABLE_ERROR) |
2455 | - throw_exception (ex); | |
2455 | + rethrow_exception (); | |
2456 | 2456 | } |
2457 | 2457 | END_CATCH |
2458 | 2458 |
@@ -606,9 +606,9 @@ run_inferior_call (struct call_thread_fsm *sm, | ||
606 | 606 | target supports asynchronous execution. */ |
607 | 607 | wait_sync_command_done (); |
608 | 608 | } |
609 | - CATCH (const gdb_exception &e) | |
609 | + CATCH (gdb_exception &e) | |
610 | 610 | { |
611 | - caught_error = e; | |
611 | + caught_error = gdb::move (e); | |
612 | 612 | } |
613 | 613 | END_CATCH |
614 | 614 |
@@ -1209,7 +1209,7 @@ When the function is done executing, GDB will silently stop."), | ||
1209 | 1209 | e.message, name); |
1210 | 1210 | case RETURN_QUIT: |
1211 | 1211 | default: |
1212 | - throw_exception (e); | |
1212 | + throw_exception (gdb::move (e)); | |
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 |
@@ -431,7 +431,7 @@ post_create_inferior (struct target_ops *target, int from_tty) | ||
431 | 431 | CATCH (const gdb_error &ex) |
432 | 432 | { |
433 | 433 | if (ex.error != NOT_AVAILABLE_ERROR) |
434 | - throw_exception (ex); | |
434 | + rethrow_exception (); | |
435 | 435 | } |
436 | 436 | END_CATCH |
437 | 437 |
@@ -1905,7 +1905,7 @@ displaced_step_prepare (ptid_t ptid) | ||
1905 | 1905 | |
1906 | 1906 | if (ex.error != MEMORY_ERROR |
1907 | 1907 | && ex.error != NOT_SUPPORTED_ERROR) |
1908 | - throw_exception (ex); | |
1908 | + rethrow_exception (); | |
1909 | 1909 | |
1910 | 1910 | if (debug_infrun) |
1911 | 1911 | { |
@@ -2296,9 +2296,9 @@ parse_linespec (linespec_parser *parser, const char *arg) | ||
2296 | 2296 | = symtabs_from_filename (user_filename, |
2297 | 2297 | PARSER_STATE (parser)->search_pspace); |
2298 | 2298 | } |
2299 | - CATCH (const gdb_error &ex) | |
2299 | + CATCH (gdb_error &ex) | |
2300 | 2300 | { |
2301 | - file_exception = ex; | |
2301 | + file_exception = gdb::move (ex); | |
2302 | 2302 | } |
2303 | 2303 | END_CATCH |
2304 | 2304 |
@@ -2348,7 +2348,7 @@ parse_linespec (linespec_parser *parser, const char *arg) | ||
2348 | 2348 | /* The linespec didn't parse. Re-throw the file exception if |
2349 | 2349 | there was one. */ |
2350 | 2350 | if (file_exception.reason < 0) |
2351 | - throw_exception (file_exception); | |
2351 | + throw_exception (gdb::move (file_exception)); | |
2352 | 2352 | |
2353 | 2353 | /* Otherwise, the symbol is not found. */ |
2354 | 2354 | symbol_not_found_error (PARSER_EXPLICIT (parser)->function_name, |
@@ -2498,15 +2498,7 @@ event_location_to_sals (linespec_parser *parser, | ||
2498 | 2498 | case LINESPEC_LOCATION: |
2499 | 2499 | { |
2500 | 2500 | PARSER_STATE (parser)->is_linespec = 1; |
2501 | - TRY | |
2502 | - { | |
2503 | - result = parse_linespec (parser, get_linespec_location (location)); | |
2504 | - } | |
2505 | - CATCH (const gdb_error &except) | |
2506 | - { | |
2507 | - throw_exception (except); | |
2508 | - } | |
2509 | - END_CATCH | |
2501 | + result = parse_linespec (parser, get_linespec_location (location)); | |
2510 | 2502 | } |
2511 | 2503 | break; |
2512 | 2504 |
@@ -3372,7 +3364,7 @@ find_linespec_symbols (struct linespec_state *state, | ||
3372 | 3364 | CATCH (const gdb_error &except) |
3373 | 3365 | { |
3374 | 3366 | if (except.error != NOT_FOUND_ERROR) |
3375 | - throw_exception (except); | |
3367 | + rethrow_exception (); | |
3376 | 3368 | } |
3377 | 3369 | END_CATCH |
3378 | 3370 | } |
@@ -1441,7 +1441,7 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p) | ||
1441 | 1441 | CATCH (const gdb_error &ex) |
1442 | 1442 | { |
1443 | 1443 | if (!check_ptrace_stopped_lwp_gone (lp)) |
1444 | - throw_exception (ex); | |
1444 | + rethrow_exception (); | |
1445 | 1445 | } |
1446 | 1446 | END_CATCH |
1447 | 1447 |
@@ -1634,7 +1634,7 @@ linux_resume_one_lwp (struct lwp_info *lp, int step, enum gdb_signal signo) | ||
1634 | 1634 | CATCH (const gdb_error &ex) |
1635 | 1635 | { |
1636 | 1636 | if (!check_ptrace_stopped_lwp_gone (lp)) |
1637 | - throw_exception (ex); | |
1637 | + rethrow_exception (); | |
1638 | 1638 | } |
1639 | 1639 | END_CATCH |
1640 | 1640 | } |
@@ -3589,7 +3589,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, void *data) | ||
3589 | 3589 | CATCH (const gdb_error &ex) |
3590 | 3590 | { |
3591 | 3591 | if (!check_ptrace_stopped_lwp_gone (lp)) |
3592 | - throw_exception (ex); | |
3592 | + rethrow_exception (); | |
3593 | 3593 | } |
3594 | 3594 | END_CATCH |
3595 | 3595 | } |
@@ -1227,7 +1227,7 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc, | ||
1227 | 1227 | if (! parse_completion) |
1228 | 1228 | { |
1229 | 1229 | xfree (ps.expout); |
1230 | - throw_exception (except); | |
1230 | + rethrow_exception (); | |
1231 | 1231 | } |
1232 | 1232 | } |
1233 | 1233 | END_CATCH |
@@ -1421,7 +1421,7 @@ record_btrace_insert_breakpoint (struct target_ops *ops, | ||
1421 | 1421 | CATCH (const gdb_exception &except) |
1422 | 1422 | { |
1423 | 1423 | replay_memory_access = old; |
1424 | - throw_exception (except); | |
1424 | + rethrow_exception (); | |
1425 | 1425 | } |
1426 | 1426 | END_CATCH |
1427 | 1427 | replay_memory_access = old; |
@@ -1454,7 +1454,7 @@ record_btrace_remove_breakpoint (struct target_ops *ops, | ||
1454 | 1454 | CATCH (const gdb_exception &except) |
1455 | 1455 | { |
1456 | 1456 | replay_memory_access = old; |
1457 | - throw_exception (except); | |
1457 | + rethrow_exception (); | |
1458 | 1458 | } |
1459 | 1459 | END_CATCH |
1460 | 1460 | replay_memory_access = old; |
@@ -1943,7 +1943,7 @@ get_thread_current_frame (struct thread_info *tp) | ||
1943 | 1943 | /* Restore the previous inferior_ptid. */ |
1944 | 1944 | inferior_ptid = old_inferior_ptid; |
1945 | 1945 | |
1946 | - throw_exception (except); | |
1946 | + rethrow_exception (); | |
1947 | 1947 | } |
1948 | 1948 | END_CATCH |
1949 | 1949 |
@@ -2031,7 +2031,7 @@ record_btrace_start_replaying (struct thread_info *tp) | ||
2031 | 2031 | |
2032 | 2032 | registers_changed_ptid (tp->ptid); |
2033 | 2033 | |
2034 | - throw_exception (except); | |
2034 | + rethrow_exception (); | |
2035 | 2035 | } |
2036 | 2036 | END_CATCH |
2037 | 2037 |
@@ -2913,7 +2913,7 @@ cmd_record_btrace_bts_start (char *args, int from_tty) | ||
2913 | 2913 | CATCH (const gdb_exception &exception) |
2914 | 2914 | { |
2915 | 2915 | record_btrace_conf.format = BTRACE_FORMAT_NONE; |
2916 | - throw_exception (exception); | |
2916 | + rethrow_exception (); | |
2917 | 2917 | } |
2918 | 2918 | END_CATCH |
2919 | 2919 | } |
@@ -2935,7 +2935,7 @@ cmd_record_btrace_pt_start (char *args, int from_tty) | ||
2935 | 2935 | CATCH (const gdb_exception &exception) |
2936 | 2936 | { |
2937 | 2937 | record_btrace_conf.format = BTRACE_FORMAT_NONE; |
2938 | - throw_exception (exception); | |
2938 | + rethrow_exception (); | |
2939 | 2939 | } |
2940 | 2940 | END_CATCH |
2941 | 2941 | } |
@@ -2965,7 +2965,7 @@ cmd_record_btrace_start (char *args, int from_tty) | ||
2965 | 2965 | CATCH (const gdb_exception &exception) |
2966 | 2966 | { |
2967 | 2967 | record_btrace_conf.format = BTRACE_FORMAT_NONE; |
2968 | - throw_exception (exception); | |
2968 | + rethrow_exception (); | |
2969 | 2969 | } |
2970 | 2970 | END_CATCH |
2971 | 2971 | } |
@@ -5088,7 +5088,7 @@ remote_open_1 (const char *name, int from_tty, | ||
5088 | 5088 | remote_unpush_target (); |
5089 | 5089 | if (target_async_permitted) |
5090 | 5090 | wait_forever_enabled_p = 1; |
5091 | - throw_exception (ex); | |
5091 | + rethrow_exception (); | |
5092 | 5092 | } |
5093 | 5093 | END_CATCH |
5094 | 5094 | } |
@@ -8988,7 +8988,7 @@ remote_kill_k (void) | ||
8988 | 8988 | /* Otherwise, something went wrong. We didn't actually kill |
8989 | 8989 | the target. Just propagate the exception, and let the |
8990 | 8990 | user or higher layers decide what to do. */ |
8991 | - throw_exception (ex); | |
8991 | + rethrow_exception (); | |
8992 | 8992 | } |
8993 | 8993 | END_CATCH |
8994 | 8994 | } |
@@ -12199,7 +12199,7 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts) | ||
12199 | 12199 | exception_fprintf (gdb_stderr, ex, "qTStatus: "); |
12200 | 12200 | return -1; |
12201 | 12201 | } |
12202 | - throw_exception (ex); | |
12202 | + rethrow_exception (); | |
12203 | 12203 | } |
12204 | 12204 | END_CATCH |
12205 | 12205 |
@@ -3296,7 +3296,7 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
3296 | 3296 | CATCH (const gdb_error &ex) |
3297 | 3297 | { |
3298 | 3298 | if (ex.error != NOT_AVAILABLE_ERROR) |
3299 | - throw_exception (ex); | |
3299 | + rethrow_exception (); | |
3300 | 3300 | return (struct rs6000_frame_cache *) (*this_cache); |
3301 | 3301 | } |
3302 | 3302 | END_CATCH |
@@ -3526,7 +3526,7 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
3526 | 3526 | CATCH (const gdb_error &ex) |
3527 | 3527 | { |
3528 | 3528 | if (ex.error != NOT_AVAILABLE_ERROR) |
3529 | - throw_exception (ex); | |
3529 | + rethrow_exception (); | |
3530 | 3530 | } |
3531 | 3531 | END_CATCH |
3532 | 3532 |
@@ -2359,7 +2359,7 @@ s390_frame_unwind_cache (struct frame_info *this_frame, | ||
2359 | 2359 | CATCH (const gdb_error &ex) |
2360 | 2360 | { |
2361 | 2361 | if (ex.error != NOT_AVAILABLE_ERROR) |
2362 | - throw_exception (ex); | |
2362 | + rethrow_exception (); | |
2363 | 2363 | } |
2364 | 2364 | END_CATCH |
2365 | 2365 |
@@ -142,7 +142,7 @@ append_ocl_sos (struct so_list **link_ptr) | ||
142 | 142 | case MEMORY_ERROR: |
143 | 143 | break; |
144 | 144 | default: |
145 | - throw_exception (ex); | |
145 | + rethrow_exception (); | |
146 | 146 | break; |
147 | 147 | } |
148 | 148 | } |
@@ -2121,16 +2121,16 @@ print_frame_local_vars (struct frame_info *frame, int num_tabs, | ||
2121 | 2121 | do_print_variable_and_value, |
2122 | 2122 | &cb_data); |
2123 | 2123 | } |
2124 | - CATCH (const gdb_exception &ex) | |
2124 | + CATCH (gdb_exception &ex) | |
2125 | 2125 | { |
2126 | - except = ex; | |
2126 | + except = gdb::move (ex); | |
2127 | 2127 | } |
2128 | 2128 | END_CATCH |
2129 | 2129 | |
2130 | 2130 | /* Restore the selected frame, and then rethrow if there was a problem. */ |
2131 | 2131 | select_frame (frame_find_by_id (cb_data.frame_id)); |
2132 | 2132 | if (except.reason < 0) |
2133 | - throw_exception (except); | |
2133 | + throw_exception (gdb::move (except)); | |
2134 | 2134 | |
2135 | 2135 | /* do_print_variable_and_value invalidates FRAME. */ |
2136 | 2136 | frame = NULL; |
@@ -5520,7 +5520,7 @@ default_make_symbol_completion_list_break_on (const char *text, | ||
5520 | 5520 | CATCH (const gdb_error &except) |
5521 | 5521 | { |
5522 | 5522 | if (except.error != MAX_COMPLETIONS_REACHED_ERROR) |
5523 | - throw_exception (except); | |
5523 | + rethrow_exception (); | |
5524 | 5524 | } |
5525 | 5525 | END_CATCH |
5526 | 5526 |
@@ -5686,7 +5686,7 @@ make_file_symbol_completion_list (const char *text, const char *word, | ||
5686 | 5686 | CATCH (const gdb_error &except) |
5687 | 5687 | { |
5688 | 5688 | if (except.error != MAX_COMPLETIONS_REACHED_ERROR) |
5689 | - throw_exception (except); | |
5689 | + rethrow_exception (); | |
5690 | 5690 | } |
5691 | 5691 | END_CATCH |
5692 | 5692 |
@@ -922,7 +922,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) | ||
922 | 922 | objfile_name (objfile), ex.message); |
923 | 923 | break; |
924 | 924 | default: |
925 | - throw_exception (ex); | |
925 | + rethrow_exception (); | |
926 | 926 | break; |
927 | 927 | } |
928 | 928 | } |
@@ -529,7 +529,7 @@ tfile_open (const char *arg, int from_tty) | ||
529 | 529 | { |
530 | 530 | /* Remove the partially set up target. */ |
531 | 531 | unpush_target (&tfile_ops); |
532 | - throw_exception (ex); | |
532 | + rethrow_exception (); | |
533 | 533 | } |
534 | 534 | END_CATCH |
535 | 535 |
@@ -3616,7 +3616,7 @@ value_rtti_indirect_type (struct value *v, int *full, | ||
3616 | 3616 | type. */ |
3617 | 3617 | return NULL; |
3618 | 3618 | } |
3619 | - throw_exception (except); | |
3619 | + rethrow_exception (); | |
3620 | 3620 | } |
3621 | 3621 | END_CATCH |
3622 | 3622 | } |
@@ -321,9 +321,9 @@ gdb_xml_start_element_wrapper (void *data, const XML_Char *name, | ||
321 | 321 | { |
322 | 322 | gdb_xml_start_element (data, name, attrs); |
323 | 323 | } |
324 | - CATCH (const gdb_exception &ex) | |
324 | + CATCH (gdb_exception &ex) | |
325 | 325 | { |
326 | - parser->error = ex; | |
326 | + parser->error = gdb::move (ex); | |
327 | 327 | #ifdef HAVE_XML_STOPPARSER |
328 | 328 | XML_StopParser (parser->expat_parser, XML_FALSE); |
329 | 329 | #endif |
@@ -404,9 +404,9 @@ gdb_xml_end_element_wrapper (void *data, const XML_Char *name) | ||
404 | 404 | { |
405 | 405 | gdb_xml_end_element (data, name); |
406 | 406 | } |
407 | - CATCH (const gdb_exception &ex) | |
407 | + CATCH (gdb_exception &ex) | |
408 | 408 | { |
409 | - parser->error = ex; | |
409 | + parser->error = gdb::move (ex); | |
410 | 410 | #ifdef HAVE_XML_STOPPARSER |
411 | 411 | XML_StopParser (parser->expat_parser, XML_FALSE); |
412 | 412 | #endif |
@@ -584,7 +584,7 @@ gdb_xml_parse (struct gdb_xml_parser *parser, const char *buffer) | ||
584 | 584 | else |
585 | 585 | { |
586 | 586 | gdb_assert (parser->error.reason < 0); |
587 | - throw_exception (parser->error); | |
587 | + throw_exception (gdb::move (parser->error)); | |
588 | 588 | } |
589 | 589 | |
590 | 590 | if (parser->last_line != 0) |