• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisionb366739fd4ad21a76b7f39bf28243a315124d885 (tree)
Time2016-09-24 01:57:50
AuthorPedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

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

catch block. rethrow_exception does "throw;", which throws the
original exception object.

- making throw_exception take an rval reference, in order to allow

moving the original exception's message string into the thrown
exception object.
I thought of making throw_exception take a non-const lval reference,
which should work too, but it feels like forcing callers to use
gdb::move is less surprising. Otherwise, there'd be no visible clue
at the caller site that would make it obvious that throw_exception
destroys its argument.

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.

Change Summary

Incremental Difference

--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -556,7 +556,7 @@ aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
556556 CATCH (const gdb_error &ex)
557557 {
558558 if (ex.error != NOT_AVAILABLE_ERROR)
559- throw_exception (ex);
559+ rethrow_exception ();
560560 }
561561 END_CATCH
562562
@@ -683,7 +683,7 @@ aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache)
683683 CATCH (const gdb_error &ex)
684684 {
685685 if (ex.error != NOT_AVAILABLE_ERROR)
686- throw_exception (ex);
686+ rethrow_exception ();
687687 }
688688 END_CATCH
689689
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2541,7 +2541,7 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
25412541 CATCH (const gdb_error &ex)
25422542 {
25432543 if (ex.error != NOT_AVAILABLE_ERROR)
2544- throw_exception (ex);
2544+ rethrow_exception ();
25452545 }
25462546 END_CATCH
25472547
@@ -2669,7 +2669,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
26692669 CATCH (const gdb_error &ex)
26702670 {
26712671 if (ex.error != NOT_AVAILABLE_ERROR)
2672- throw_exception (ex);
2672+ rethrow_exception ();
26732673 }
26742674 END_CATCH
26752675
@@ -2850,7 +2850,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
28502850 CATCH (const gdb_error &ex)
28512851 {
28522852 if (ex.error != NOT_AVAILABLE_ERROR)
2853- throw_exception (ex);
2853+ rethrow_exception ();
28542854 }
28552855 END_CATCH
28562856
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -243,7 +243,7 @@ re_set_exception_catchpoint (struct breakpoint *self)
243243 /* NOT_FOUND_ERROR just means the breakpoint will be
244244 pending, so let it through. */
245245 if (ex.error != NOT_FOUND_ERROR)
246- throw_exception (ex);
246+ rethrow_exception ();
247247 }
248248 END_CATCH
249249 }
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9809,7 +9809,7 @@ create_breakpoint (struct gdbarch *gdbarch,
98099809 error. */
98109810
98119811 if (pending_break_support == AUTO_BOOLEAN_FALSE)
9812- throw_exception (e);
9812+ rethrow_exception ();
98139813
98149814 exception_print (gdb_stderr, e);
98159815
@@ -9827,7 +9827,7 @@ create_breakpoint (struct gdbarch *gdbarch,
98279827 pending = 1;
98289828 }
98299829 else
9830- throw_exception (e);
9830+ rethrow_exception ();
98319831 }
98329832 END_CATCH
98339833
@@ -11464,7 +11464,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
1146411464 CATCH (const gdb_exception &e)
1146511465 {
1146611466 delete_breakpoint (b);
11467- throw_exception (e);
11467+ rethrow_exception ();
1146811468 }
1146911469 END_CATCH
1147011470
@@ -14425,11 +14425,11 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
1442514425 {
1442614426 b->ops->decode_location (b, location, search_pspace, &sals);
1442714427 }
14428- CATCH (const gdb_error &e)
14428+ CATCH (gdb_error &e)
1442914429 {
1443014430 int not_found_and_ok = 0;
1443114431
14432- exception = e;
14432+ exception = gdb::move (e);
1443314433
1443414434 /* For pending breakpoints, it's expected that parsing will
1443514435 fail until the right shared library is loaded. User has
@@ -14457,7 +14457,7 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
1445714457 happens only when a binary has changed, I don't know
1445814458 which approach is better. */
1445914459 b->enable_state = bp_disabled;
14460- throw_exception (e);
14460+ rethrow_exception ();
1446114461 }
1446214462 }
1446314463 END_CATCH
@@ -15774,7 +15774,7 @@ save_breakpoints (char *filename, int from_tty,
1577415774 CATCH (const gdb_exception &ex)
1577515775 {
1577615776 ui_out_redirect (current_uiout, NULL);
15777- throw_exception (ex);
15777+ rethrow_exception ();
1577815778 }
1577915779 END_CATCH
1578015780
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -958,7 +958,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
958958
959959 btrace_finalize_ftrace_pt (decoder, tp, level);
960960
961- throw_exception (error);
961+ rethrow_exception ();
962962 }
963963 END_CATCH
964964
@@ -2499,8 +2499,7 @@ btrace_maint_update_pt_packets (struct btrace_thread_info *btinfo)
24992499 {
25002500 pt_pkt_free_decoder (decoder);
25012501
2502- if (except.reason < 0)
2503- throw_exception (except);
2502+ rethrow_exception ();
25042503 }
25052504 END_CATCH
25062505
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1116,7 +1116,7 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
11161116 CATCH (const gdb_exception &ex)
11171117 {
11181118 xfree (*command);
1119- throw_exception (ex);
1119+ rethrow_exception ();
11201120 }
11211121 END_CATCH
11221122 }
--- a/gdb/common/common-exceptions.c
+++ b/gdb/common/common-exceptions.c
@@ -208,7 +208,7 @@ exception_try_scope_exit (void *saved_state)
208208 exception is not caught. */
209209
210210 void
211-exception_rethrow (void)
211+rethrow_exception ()
212212 {
213213 /* Run this scope's cleanups before re-throwing to the next
214214 outermost scope. */
@@ -257,16 +257,6 @@ throw_it (enum return_reason reason, enum errors error, const char *fmt,
257257 }
258258
259259 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
270260 throw_exception (gdb_exception_rval_ref exception)
271261 {
272262 const char *message = exception.message;
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -262,7 +262,6 @@ extern struct gdb_exception exceptions_state_mc_catch ();
262262
263263 extern void *exception_try_scope_entry (void);
264264 extern void exception_try_scope_exit (void *saved_state);
265-extern void exception_rethrow (void);
266265
267266 /* Macro to wrap up standard try/catch behavior.
268267
@@ -351,7 +350,7 @@ struct exception_try_scope
351350 #define END_CATCH \
352351 catch (...) \
353352 { \
354- exception_rethrow (); \
353+ rethrow_exception (); \
355354 }
356355
357356 #else
@@ -403,13 +402,13 @@ struct gdb_quit_bad_alloc
403402 /* *INDENT-ON* */
404403
405404 /* 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. */
410405 extern void throw_exception (gdb_exception_rval_ref exception)
411406 ATTRIBUTE_NORETURN;
412407
408+/* Rethrow the currently caught exception. Wrapper around "throw;"
409+ that also handles cleanups. */
410+extern void rethrow_exception (void);
411+
413412 /* Throw an exception by executing a LONG JUMP to the inner most
414413 containing exception handler established using TRY_SJLJ. Works the
415414 same regardless of whether GDB is built as a C program or a C++
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -185,7 +185,7 @@ compile_object_run (struct compile_module *module)
185185 gdb_assert (!(dtor_found && executed));
186186 if (!dtor_found && !executed)
187187 do_module_cleanup (data, 0);
188- throw_exception (ex);
188+ rethrow_exception ();
189189 }
190190 END_CATCH
191191
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -82,7 +82,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
8282 CATCH (const gdb_error &ex)
8383 {
8484 if (ex.error != NOT_AVAILABLE_ERROR)
85- throw_exception (ex);
85+ rethrow_exception ();
8686
8787 throw_error (NOT_AVAILABLE_ERROR,
8888 _("Cannot determine virtual baseclass offset "
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1137,7 +1137,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
11371137 return cache;
11381138 }
11391139
1140- throw_exception (ex);
1140+ rethrow_exception ();
11411141 }
11421142 END_CATCH
11431143
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1080,7 +1080,7 @@ call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
10801080 return NULL;
10811081 }
10821082 else
1083- throw_exception (e);
1083+ rethrow_exception ();
10841084 }
10851085 END_CATCH
10861086
@@ -2349,7 +2349,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
23492349 return allocate_optimized_out_value (type);
23502350 }
23512351 else
2352- throw_exception (ex);
2352+ rethrow_exception ();
23532353 }
23542354 END_CATCH
23552355
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -238,7 +238,7 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
238238 if (!preserve_errors)
239239 break;
240240 default:
241- throw_exception (ex);
241+ rethrow_exception ();
242242 break;
243243 }
244244 }
@@ -780,7 +780,7 @@ evaluate_subexp_standard (struct type *expect_type,
780780 ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol),
781781 not_lval);
782782 else
783- throw_exception (except);
783+ rethrow_exception ();
784784 }
785785 END_CATCH
786786
@@ -1460,7 +1460,7 @@ evaluate_subexp_standard (struct type *expect_type,
14601460 if (except.error == NOT_FOUND_ERROR)
14611461 break;
14621462 else
1463- throw_exception (except);
1463+ rethrow_exception ();
14641464 }
14651465 END_CATCH
14661466
@@ -1887,7 +1887,7 @@ evaluate_subexp_standard (struct type *expect_type,
18871887 if (except.error == NOT_FOUND_ERROR)
18881888 break;
18891889 else
1890- throw_exception (except);
1890+ rethrow_exception ();
18911891 }
18921892 END_CATCH
18931893
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -182,9 +182,9 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
182182 {
183183 val = (*func) (current_uiout, func_args);
184184 }
185- CATCH (const gdb_exception &ex)
185+ CATCH (gdb_exception &ex)
186186 {
187- exception = ex;
187+ exception = gdb::move (ex);
188188 }
189189 END_CATCH
190190
@@ -195,7 +195,7 @@ catch_exceptions_with_msg (struct ui_out *func_uiout,
195195 {
196196 /* The caller didn't request that the event be caught.
197197 Rethrow. */
198- throw_exception (exception);
198+ throw_exception (gdb::move (exception));
199199 }
200200
201201 exception_print (gdb_stderr, exception);
@@ -235,9 +235,9 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
235235 {
236236 val = func (func_args);
237237 }
238- CATCH (const gdb_exception &ex)
238+ CATCH (gdb_exception &ex)
239239 {
240- exception = ex;
240+ exception = gdb::move (ex);
241241 }
242242 END_CATCH
243243
@@ -248,7 +248,7 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
248248 {
249249 /* The caller didn't request that the event be caught.
250250 Rethrow. */
251- throw_exception (exception);
251+ throw_exception (gdb::move (exception));
252252 }
253253
254254 exception_fprintf (gdb_stderr, exception, "%s", errstring);
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -117,7 +117,7 @@ frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
117117 do_cleanups (old_cleanup);
118118 return 0;
119119 }
120- throw_exception (ex);
120+ rethrow_exception ();
121121 }
122122 END_CATCH
123123
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -892,7 +892,7 @@ frame_unwind_pc (struct frame_info *this_frame)
892892 this_frame->level);
893893 }
894894 else
895- throw_exception (ex);
895+ rethrow_exception ();
896896 }
897897 END_CATCH
898898
@@ -2058,7 +2058,7 @@ get_prev_frame_always (struct frame_info *this_frame)
20582058 prev_frame = NULL;
20592059 }
20602060 else
2061- throw_exception (ex);
2061+ rethrow_exception ();
20622062 }
20632063 END_CATCH
20642064
@@ -2301,7 +2301,7 @@ get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc)
23012301 if (ex.error == NOT_AVAILABLE_ERROR)
23022302 return 0;
23032303 else
2304- throw_exception (ex);
2304+ rethrow_exception ();
23052305 }
23062306 END_CATCH
23072307
@@ -2383,7 +2383,7 @@ get_frame_address_in_block_if_available (struct frame_info *this_frame,
23832383 {
23842384 if (ex.error == NOT_AVAILABLE_ERROR)
23852385 return 0;
2386- throw_exception (ex);
2386+ rethrow_exception ();
23872387 }
23882388 END_CATCH
23892389
@@ -2671,7 +2671,7 @@ get_frame_language (struct frame_info *frame)
26712671 CATCH (const gdb_error &ex)
26722672 {
26732673 if (ex.error != NOT_AVAILABLE_ERROR)
2674- throw_exception (ex);
2674+ rethrow_exception ();
26752675 }
26762676 END_CATCH
26772677
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -123,16 +123,16 @@ write_gcore_file (bfd *obfd)
123123 {
124124 write_gcore_file_1 (obfd);
125125 }
126- CATCH (const gdb_exception &e)
126+ CATCH (gdb_exception &e)
127127 {
128- except = e;
128+ except = gdb::move (e);
129129 }
130130 END_CATCH
131131
132132 target_done_generating_core ();
133133
134134 if (except.reason < 0)
135- throw_exception (except);
135+ throw_exception (gdb::move (except));
136136 }
137137
138138 static void
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1527,7 +1527,7 @@ linux_detach_one_lwp (struct lwp_info *lwp)
15271527 CATCH (const gdb_error &ex)
15281528 {
15291529 if (!check_ptrace_stopped_lwp_gone (lwp))
1530- throw_exception (ex);
1530+ rethrow_exception ();
15311531 }
15321532 END_CATCH
15331533
@@ -4586,7 +4586,7 @@ linux_resume_one_lwp (struct lwp_info *lwp,
45864586 CATCH (const gdb_error &ex)
45874587 {
45884588 if (!check_ptrace_stopped_lwp_gone (lwp))
4589- throw_exception (ex);
4589+ rethrow_exception ();
45904590 }
45914591 END_CATCH
45924592 }
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3534,9 +3534,9 @@ types_deeply_equal (struct type *type1, struct type *type2)
35343534 {
35353535 result = check_types_worklist (&worklist, cache);
35363536 }
3537- CATCH (const gdb_exception &ex)
3537+ CATCH (gdb_exception &ex)
35383538 {
3539- except = ex;
3539+ except = gdb::move (ex);
35403540 }
35413541 END_CATCH
35423542
@@ -3545,7 +3545,7 @@ types_deeply_equal (struct type *type1, struct type *type2)
35453545
35463546 /* Rethrow if there was a problem. */
35473547 if (except.reason < 0)
3548- throw_exception (except);
3548+ throw_exception (gdb::move (except));
35493549
35503550 return result;
35513551 }
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2076,7 +2076,7 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
20762076 CATCH (const gdb_error &ex)
20772077 {
20782078 if (ex.error != NOT_AVAILABLE_ERROR)
2079- throw_exception (ex);
2079+ rethrow_exception ();
20802080 }
20812081 END_CATCH
20822082
@@ -2256,7 +2256,7 @@ i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
22562256 CATCH (const gdb_error &ex)
22572257 {
22582258 if (ex.error != NOT_AVAILABLE_ERROR)
2259- throw_exception (ex);
2259+ rethrow_exception ();
22602260 }
22612261 END_CATCH
22622262
@@ -2452,7 +2452,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
24522452 CATCH (const gdb_error &ex)
24532453 {
24542454 if (ex.error != NOT_AVAILABLE_ERROR)
2455- throw_exception (ex);
2455+ rethrow_exception ();
24562456 }
24572457 END_CATCH
24582458
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -606,9 +606,9 @@ run_inferior_call (struct call_thread_fsm *sm,
606606 target supports asynchronous execution. */
607607 wait_sync_command_done ();
608608 }
609- CATCH (const gdb_exception &e)
609+ CATCH (gdb_exception &e)
610610 {
611- caught_error = e;
611+ caught_error = gdb::move (e);
612612 }
613613 END_CATCH
614614
@@ -1209,7 +1209,7 @@ When the function is done executing, GDB will silently stop."),
12091209 e.message, name);
12101210 case RETURN_QUIT:
12111211 default:
1212- throw_exception (e);
1212+ throw_exception (gdb::move (e));
12131213 }
12141214 }
12151215
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -431,7 +431,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
431431 CATCH (const gdb_error &ex)
432432 {
433433 if (ex.error != NOT_AVAILABLE_ERROR)
434- throw_exception (ex);
434+ rethrow_exception ();
435435 }
436436 END_CATCH
437437
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1905,7 +1905,7 @@ displaced_step_prepare (ptid_t ptid)
19051905
19061906 if (ex.error != MEMORY_ERROR
19071907 && ex.error != NOT_SUPPORTED_ERROR)
1908- throw_exception (ex);
1908+ rethrow_exception ();
19091909
19101910 if (debug_infrun)
19111911 {
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2296,9 +2296,9 @@ parse_linespec (linespec_parser *parser, const char *arg)
22962296 = symtabs_from_filename (user_filename,
22972297 PARSER_STATE (parser)->search_pspace);
22982298 }
2299- CATCH (const gdb_error &ex)
2299+ CATCH (gdb_error &ex)
23002300 {
2301- file_exception = ex;
2301+ file_exception = gdb::move (ex);
23022302 }
23032303 END_CATCH
23042304
@@ -2348,7 +2348,7 @@ parse_linespec (linespec_parser *parser, const char *arg)
23482348 /* The linespec didn't parse. Re-throw the file exception if
23492349 there was one. */
23502350 if (file_exception.reason < 0)
2351- throw_exception (file_exception);
2351+ throw_exception (gdb::move (file_exception));
23522352
23532353 /* Otherwise, the symbol is not found. */
23542354 symbol_not_found_error (PARSER_EXPLICIT (parser)->function_name,
@@ -2498,15 +2498,7 @@ event_location_to_sals (linespec_parser *parser,
24982498 case LINESPEC_LOCATION:
24992499 {
25002500 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));
25102502 }
25112503 break;
25122504
@@ -3372,7 +3364,7 @@ find_linespec_symbols (struct linespec_state *state,
33723364 CATCH (const gdb_error &except)
33733365 {
33743366 if (except.error != NOT_FOUND_ERROR)
3375- throw_exception (except);
3367+ rethrow_exception ();
33763368 }
33773369 END_CATCH
33783370 }
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1441,7 +1441,7 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p)
14411441 CATCH (const gdb_error &ex)
14421442 {
14431443 if (!check_ptrace_stopped_lwp_gone (lp))
1444- throw_exception (ex);
1444+ rethrow_exception ();
14451445 }
14461446 END_CATCH
14471447
@@ -1634,7 +1634,7 @@ linux_resume_one_lwp (struct lwp_info *lp, int step, enum gdb_signal signo)
16341634 CATCH (const gdb_error &ex)
16351635 {
16361636 if (!check_ptrace_stopped_lwp_gone (lp))
1637- throw_exception (ex);
1637+ rethrow_exception ();
16381638 }
16391639 END_CATCH
16401640 }
@@ -3589,7 +3589,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
35893589 CATCH (const gdb_error &ex)
35903590 {
35913591 if (!check_ptrace_stopped_lwp_gone (lp))
3592- throw_exception (ex);
3592+ rethrow_exception ();
35933593 }
35943594 END_CATCH
35953595 }
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1227,7 +1227,7 @@ parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
12271227 if (! parse_completion)
12281228 {
12291229 xfree (ps.expout);
1230- throw_exception (except);
1230+ rethrow_exception ();
12311231 }
12321232 }
12331233 END_CATCH
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1421,7 +1421,7 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
14211421 CATCH (const gdb_exception &except)
14221422 {
14231423 replay_memory_access = old;
1424- throw_exception (except);
1424+ rethrow_exception ();
14251425 }
14261426 END_CATCH
14271427 replay_memory_access = old;
@@ -1454,7 +1454,7 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
14541454 CATCH (const gdb_exception &except)
14551455 {
14561456 replay_memory_access = old;
1457- throw_exception (except);
1457+ rethrow_exception ();
14581458 }
14591459 END_CATCH
14601460 replay_memory_access = old;
@@ -1943,7 +1943,7 @@ get_thread_current_frame (struct thread_info *tp)
19431943 /* Restore the previous inferior_ptid. */
19441944 inferior_ptid = old_inferior_ptid;
19451945
1946- throw_exception (except);
1946+ rethrow_exception ();
19471947 }
19481948 END_CATCH
19491949
@@ -2031,7 +2031,7 @@ record_btrace_start_replaying (struct thread_info *tp)
20312031
20322032 registers_changed_ptid (tp->ptid);
20332033
2034- throw_exception (except);
2034+ rethrow_exception ();
20352035 }
20362036 END_CATCH
20372037
@@ -2913,7 +2913,7 @@ cmd_record_btrace_bts_start (char *args, int from_tty)
29132913 CATCH (const gdb_exception &exception)
29142914 {
29152915 record_btrace_conf.format = BTRACE_FORMAT_NONE;
2916- throw_exception (exception);
2916+ rethrow_exception ();
29172917 }
29182918 END_CATCH
29192919 }
@@ -2935,7 +2935,7 @@ cmd_record_btrace_pt_start (char *args, int from_tty)
29352935 CATCH (const gdb_exception &exception)
29362936 {
29372937 record_btrace_conf.format = BTRACE_FORMAT_NONE;
2938- throw_exception (exception);
2938+ rethrow_exception ();
29392939 }
29402940 END_CATCH
29412941 }
@@ -2965,7 +2965,7 @@ cmd_record_btrace_start (char *args, int from_tty)
29652965 CATCH (const gdb_exception &exception)
29662966 {
29672967 record_btrace_conf.format = BTRACE_FORMAT_NONE;
2968- throw_exception (exception);
2968+ rethrow_exception ();
29692969 }
29702970 END_CATCH
29712971 }
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5088,7 +5088,7 @@ remote_open_1 (const char *name, int from_tty,
50885088 remote_unpush_target ();
50895089 if (target_async_permitted)
50905090 wait_forever_enabled_p = 1;
5091- throw_exception (ex);
5091+ rethrow_exception ();
50925092 }
50935093 END_CATCH
50945094 }
@@ -8988,7 +8988,7 @@ remote_kill_k (void)
89888988 /* Otherwise, something went wrong. We didn't actually kill
89898989 the target. Just propagate the exception, and let the
89908990 user or higher layers decide what to do. */
8991- throw_exception (ex);
8991+ rethrow_exception ();
89928992 }
89938993 END_CATCH
89948994 }
@@ -12199,7 +12199,7 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
1219912199 exception_fprintf (gdb_stderr, ex, "qTStatus: ");
1220012200 return -1;
1220112201 }
12202- throw_exception (ex);
12202+ rethrow_exception ();
1220312203 }
1220412204 END_CATCH
1220512205
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3296,7 +3296,7 @@ rs6000_frame_cache (struct frame_info *this_frame, void **this_cache)
32963296 CATCH (const gdb_error &ex)
32973297 {
32983298 if (ex.error != NOT_AVAILABLE_ERROR)
3299- throw_exception (ex);
3299+ rethrow_exception ();
33003300 return (struct rs6000_frame_cache *) (*this_cache);
33013301 }
33023302 END_CATCH
@@ -3526,7 +3526,7 @@ rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
35263526 CATCH (const gdb_error &ex)
35273527 {
35283528 if (ex.error != NOT_AVAILABLE_ERROR)
3529- throw_exception (ex);
3529+ rethrow_exception ();
35303530 }
35313531 END_CATCH
35323532
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -2359,7 +2359,7 @@ s390_frame_unwind_cache (struct frame_info *this_frame,
23592359 CATCH (const gdb_error &ex)
23602360 {
23612361 if (ex.error != NOT_AVAILABLE_ERROR)
2362- throw_exception (ex);
2362+ rethrow_exception ();
23632363 }
23642364 END_CATCH
23652365
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -142,7 +142,7 @@ append_ocl_sos (struct so_list **link_ptr)
142142 case MEMORY_ERROR:
143143 break;
144144 default:
145- throw_exception (ex);
145+ rethrow_exception ();
146146 break;
147147 }
148148 }
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2121,16 +2121,16 @@ print_frame_local_vars (struct frame_info *frame, int num_tabs,
21212121 do_print_variable_and_value,
21222122 &cb_data);
21232123 }
2124- CATCH (const gdb_exception &ex)
2124+ CATCH (gdb_exception &ex)
21252125 {
2126- except = ex;
2126+ except = gdb::move (ex);
21272127 }
21282128 END_CATCH
21292129
21302130 /* Restore the selected frame, and then rethrow if there was a problem. */
21312131 select_frame (frame_find_by_id (cb_data.frame_id));
21322132 if (except.reason < 0)
2133- throw_exception (except);
2133+ throw_exception (gdb::move (except));
21342134
21352135 /* do_print_variable_and_value invalidates FRAME. */
21362136 frame = NULL;
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5520,7 +5520,7 @@ default_make_symbol_completion_list_break_on (const char *text,
55205520 CATCH (const gdb_error &except)
55215521 {
55225522 if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
5523- throw_exception (except);
5523+ rethrow_exception ();
55245524 }
55255525 END_CATCH
55265526
@@ -5686,7 +5686,7 @@ make_file_symbol_completion_list (const char *text, const char *word,
56865686 CATCH (const gdb_error &except)
56875687 {
56885688 if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
5689- throw_exception (except);
5689+ rethrow_exception ();
56905690 }
56915691 END_CATCH
56925692
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -922,7 +922,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
922922 objfile_name (objfile), ex.message);
923923 break;
924924 default:
925- throw_exception (ex);
925+ rethrow_exception ();
926926 break;
927927 }
928928 }
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -529,7 +529,7 @@ tfile_open (const char *arg, int from_tty)
529529 {
530530 /* Remove the partially set up target. */
531531 unpush_target (&tfile_ops);
532- throw_exception (ex);
532+ rethrow_exception ();
533533 }
534534 END_CATCH
535535
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3616,7 +3616,7 @@ value_rtti_indirect_type (struct value *v, int *full,
36163616 type. */
36173617 return NULL;
36183618 }
3619- throw_exception (except);
3619+ rethrow_exception ();
36203620 }
36213621 END_CATCH
36223622 }
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -321,9 +321,9 @@ gdb_xml_start_element_wrapper (void *data, const XML_Char *name,
321321 {
322322 gdb_xml_start_element (data, name, attrs);
323323 }
324- CATCH (const gdb_exception &ex)
324+ CATCH (gdb_exception &ex)
325325 {
326- parser->error = ex;
326+ parser->error = gdb::move (ex);
327327 #ifdef HAVE_XML_STOPPARSER
328328 XML_StopParser (parser->expat_parser, XML_FALSE);
329329 #endif
@@ -404,9 +404,9 @@ gdb_xml_end_element_wrapper (void *data, const XML_Char *name)
404404 {
405405 gdb_xml_end_element (data, name);
406406 }
407- CATCH (const gdb_exception &ex)
407+ CATCH (gdb_exception &ex)
408408 {
409- parser->error = ex;
409+ parser->error = gdb::move (ex);
410410 #ifdef HAVE_XML_STOPPARSER
411411 XML_StopParser (parser->expat_parser, XML_FALSE);
412412 #endif
@@ -584,7 +584,7 @@ gdb_xml_parse (struct gdb_xml_parser *parser, const char *buffer)
584584 else
585585 {
586586 gdb_assert (parser->error.reason < 0);
587- throw_exception (parser->error);
587+ throw_exception (gdb::move (parser->error));
588588 }
589589
590590 if (parser->last_line != 0)