[18/20] Replace throw_exception with throw in some cases

Message ID 20190213212927.9474-19-tom@tromey.com
State New
Headers show
Series
  • Remove cleanups
Related show

Commit Message

Tom Tromey Feb. 13, 2019, 9:29 p.m.
This replaces throw_exception with "throw;" when possible.  This was
written by script.  The rule that is followed is that uses of the
form:

   catch (... &name)
     {
       ...
       throw_exception (name);
     }

... can be rewritten.  It's possible (though IMO unlikely) that such a
case could be wrong, if the exception object is rewritten in the body
of the catch.  (One option here might be to catch a const & instead.)

gdb/ChangeLog
2019-02-13  Tom Tromey  <tom@tromey.com>

	* valops.c (value_rtti_indirect_type): Replace throw_exception
	with throw.
	* tracefile-tfile.c (tfile_target_open): Replace throw_exception
	with throw.
	* thread.c (thr_try_catch_cmd): Replace throw_exception with
	throw.
	* target.c (target_translate_tls_address): Replace throw_exception
	with throw.
	* stack.c (frame_apply_command_count): Replace throw_exception
	with throw.
	* solib-spu.c (append_ocl_sos): Replace throw_exception with
	throw.
	* s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception
	with throw.
	* rs6000-tdep.c (rs6000_frame_cache)
	(rs6000_epilogue_frame_cache): Replace throw_exception with throw.
	* remote.c: Replace throw_exception with throw.
	* record-full.c (record_full_message, record_full_wait_1)
	(record_full_restore): Replace throw_exception with throw.
	* record-btrace.c:
	(get_thread_current_frame_id, record_btrace_start_replaying)
	(cmd_record_btrace_bts_start, cmd_record_btrace_pt_start)
	(cmd_record_btrace_start): Replace throw_exception with throw.
	* parse.c (parse_exp_in_context_1): Replace throw_exception with
	throw.
	* linux-nat.c (detach_one_lwp, linux_resume_one_lwp)
	(resume_stopped_resumed_lwps): Replace throw_exception with throw.
	* linespec.c:
	(find_linespec_symbols): Replace throw_exception with throw.
	* infrun.c (displaced_step_prepare, resume): Replace
	throw_exception with throw.
	* infcmd.c (post_create_inferior): Replace throw_exception with
	throw.
	* inf-loop.c (inferior_event_handler): Replace throw_exception
	with throw.
	* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
	(i386_sigtramp_frame_cache): Replace throw_exception with throw.
	* frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle)
	(get_prev_frame_always, get_frame_pc_if_available)
	(get_frame_address_in_block_if_available, get_frame_language):
	Replace throw_exception with throw.
	* frame-unwind.c (frame_unwind_try_unwinder): Replace
	throw_exception with throw.
	* eval.c (fetch_subexp_value, evaluate_var_value)
	(evaluate_funcall, evaluate_subexp_standard): Replace
	throw_exception with throw.
	* dwarf2loc.c (call_site_find_chain)
	(dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval):
	Replace throw_exception with throw.
	* dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception
	with throw.
	* darwin-nat.c (darwin_attach_pid): Replace throw_exception with
	throw.
	* cp-abi.c (baseclass_offset): Replace throw_exception with throw.
	* completer.c (complete_line_internal): Replace throw_exception
	with throw.
	* compile/compile-object-run.c (compile_object_run): Replace
	throw_exception with throw.
	* cli/cli-script.c (process_next_line): Replace throw_exception
	with throw.
	* btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace)
	(btrace_enable, btrace_maint_update_pt_packets): Replace
	throw_exception with throw.
	* breakpoint.c (create_breakpoint, save_breakpoints): Replace
	throw_exception with throw.
	* break-catch-throw.c (re_set_exception_catchpoint): Replace
	throw_exception with throw.
	* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
	(amd64_epilogue_frame_cache): Replace throw_exception with throw.
	* aarch64-tdep.c (aarch64_make_prologue_cache)
	(aarch64_make_stub_cache): Replace throw_exception with throw.

gdb/gdbserver/ChangeLog
2019-02-13  Tom Tromey  <tom@tromey.com>

	* linux-low.c (linux_detach_one_lwp): Replace throw_exception with
	throw.
	(linux_resume_one_lwp): Likewise.
---
 gdb/ChangeLog                    | 74 ++++++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c               |  4 +-
 gdb/amd64-tdep.c                 |  6 +--
 gdb/break-catch-throw.c          |  2 +-
 gdb/breakpoint.c                 |  8 ++--
 gdb/btrace.c                     |  8 ++--
 gdb/cli/cli-script.c             |  2 +-
 gdb/compile/compile-object-run.c |  2 +-
 gdb/completer.c                  |  2 +-
 gdb/cp-abi.c                     |  2 +-
 gdb/darwin-nat.c                 |  2 +-
 gdb/dwarf2-frame.c               |  2 +-
 gdb/dwarf2loc.c                  |  6 +--
 gdb/eval.c                       |  8 ++--
 gdb/frame-unwind.c               |  2 +-
 gdb/frame.c                      | 12 +++---
 gdb/gdbserver/ChangeLog          |  6 +++
 gdb/gdbserver/linux-low.c        |  4 +-
 gdb/i386-tdep.c                  |  6 +--
 gdb/inf-loop.c                   |  2 +-
 gdb/infcmd.c                     |  2 +-
 gdb/infrun.c                     |  4 +-
 gdb/linespec.c                   |  4 +-
 gdb/linux-nat.c                  |  6 +--
 gdb/parse.c                      |  2 +-
 gdb/record-btrace.c              | 14 +++---
 gdb/record-full.c                |  6 +--
 gdb/remote.c                     |  6 +--
 gdb/rs6000-tdep.c                |  4 +-
 gdb/s390-tdep.c                  |  2 +-
 gdb/solib-spu.c                  |  2 +-
 gdb/stack.c                      |  2 +-
 gdb/target.c                     |  2 +-
 gdb/thread.c                     |  2 +-
 gdb/tracefile-tfile.c            |  2 +-
 gdb/valops.c                     |  2 +-
 36 files changed, 151 insertions(+), 71 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 01dbb21610b..5a6d9777ed8 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -783,7 +783,7 @@  aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
@@ -909,7 +909,7 @@  aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 0f1b097c26e..1c27c08d919 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2588,7 +2588,7 @@  amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
@@ -2715,7 +2715,7 @@  amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   *this_cache = cache;
@@ -2895,7 +2895,7 @@  amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index e2029fc892a..0d5b4258703 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -214,7 +214,7 @@  re_set_exception_catchpoint (struct breakpoint *self)
 	  /* NOT_FOUND_ERROR just means the breakpoint will be
 	     pending, so let it through.  */
 	  if (ex.error != NOT_FOUND_ERROR)
-	    throw_exception (ex);
+	    throw;
 	}
     }
 
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 08360d621e3..32581dd9189 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9247,7 +9247,7 @@  create_breakpoint (struct gdbarch *gdbarch,
 	     error.  */
 
 	  if (pending_break_support == AUTO_BOOLEAN_FALSE)
-	    throw_exception (e);
+	    throw;
 
 	  exception_print (gdb_stderr, e);
 
@@ -9265,7 +9265,7 @@  create_breakpoint (struct gdbarch *gdbarch,
 	  pending = 1;
 	}
       else
-	throw_exception (e);
+	throw;
     }
 
   if (!pending && canonical.lsals.empty ())
@@ -13637,7 +13637,7 @@  location_to_sals (struct breakpoint *b, struct event_location *location,
 	     happens only when a binary has changed, I don't know
 	     which approach is better.  */
 	  b->enable_state = bp_disabled;
-	  throw_exception (e);
+	  throw;
 	}
     }
 
@@ -15036,7 +15036,7 @@  save_breakpoints (const char *filename, int from_tty,
 	catch (struct gdb_exception_RETURN_MASK_ALL &ex)
 	  {
 	  current_uiout->redirect (NULL);
-	    throw_exception (ex);
+	    throw;
 	  }
 
 	current_uiout->redirect (NULL);
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 595d7097ab4..9daf4ff0ae8 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1484,7 +1484,7 @@  btrace_compute_ftrace_pt (struct thread_info *tp,
 
       btrace_finalize_ftrace_pt (decoder, tp, level);
 
-      throw_exception (error);
+      throw;
     }
 
   btrace_finalize_ftrace_pt (decoder, tp, level);
@@ -1560,7 +1560,7 @@  btrace_compute_ftrace (struct thread_info *tp, struct btrace_data *btrace,
     {
       btrace_finalize_ftrace (tp, gaps);
 
-      throw_exception (error);
+      throw;
     }
 
   btrace_finalize_ftrace (tp, gaps);
@@ -1631,7 +1631,7 @@  btrace_enable (struct thread_info *tp, const struct btrace_config *conf)
     {
       btrace_disable (tp);
 
-      throw_exception (exception);
+      throw;
     }
 }
 
@@ -3065,7 +3065,7 @@  btrace_maint_update_pt_packets (struct btrace_thread_info *btinfo)
       pt_pkt_free_decoder (decoder);
 
       if (except.reason < 0)
-	throw_exception (except);
+	throw;
     }
 
   pt_pkt_free_decoder (decoder);
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 80ded7fe8d8..91c563b5628 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1057,7 +1057,7 @@  process_next_line (const char *p, struct command_line **command,
       catch (struct gdb_exception_RETURN_MASK_ALL &ex)
 	{
 	  free_command_lines (command);
-	  throw_exception (ex);
+	  throw;
 	}
     }
 
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index 7926594c180..87a26ad4ae9 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -183,7 +183,7 @@  compile_object_run (struct compile_module *module)
       gdb_assert (!(dtor_found && executed));
       if (!dtor_found && !executed)
 	do_module_cleanup (data, 0);
-      throw_exception (ex);
+      throw;
     }
 
   dtor_found = find_dummy_frame_dtor (do_module_cleanup, data);
diff --git a/gdb/completer.c b/gdb/completer.c
index 3cd2677e135..3158b33259e 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1451,7 +1451,7 @@  complete_line_internal (completion_tracker &tracker,
   catch (struct gdb_exception_RETURN_MASK_ERROR &except)
     {
       if (except.error != MAX_COMPLETIONS_REACHED_ERROR)
-	throw_exception (except);
+	throw;
     }
 }
 
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index a2f67b25584..ef4e3e62df9 100644
--- 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,
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
 
       throw_error (NOT_AVAILABLE_ERROR,
 		   _("Cannot determine virtual baseclass offset "
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 73ee7006a0c..73e1e1ece1c 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1693,7 +1693,7 @@  darwin_attach_pid (struct inferior *inf)
       exit_inferior (inf);
       inferior_ptid = null_ptid;
 
-      throw_exception (ex);
+      throw;
     }
 
   target_ops *darwin_ops = get_native_target ();
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 52679c75479..624db9485da 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1076,7 +1076,7 @@  dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
 	  return cache;
 	}
 
-      throw_exception (ex);
+      throw;
     }
 
   /* Initialize the register state.  */
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 67df3e79bd2..e46b7b545d0 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1209,7 +1209,7 @@  call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
 	  return NULL;
 	}
       else
-	throw_exception (e);
+	throw;
     }
 
   return retval;
@@ -2186,7 +2186,7 @@  dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
 	  return allocate_optimized_out_value (subobj_type);
 	}
       else
-	throw_exception (ex);
+	throw;
     }
 
   if (ctx.pieces.size () > 0)
@@ -2398,7 +2398,7 @@  dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
 	  return 0;
 	}
       else
-	throw_exception (ex);
+	throw;
     }
 
   switch (ctx.location)
diff --git a/gdb/eval.c b/gdb/eval.c
index acea09362e6..61ab232e448 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -217,7 +217,7 @@  fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 	    break;
 	  /* Fall through.  */
 	default:
-	  throw_exception (ex);
+	  throw;
 	  break;
 	}
     }
@@ -722,7 +722,7 @@  evaluate_var_value (enum noside noside, const block *blk, symbol *var)
   catch (struct gdb_exception_RETURN_MASK_ERROR &except)
     {
       if (noside != EVAL_AVOID_SIDE_EFFECTS)
-	throw_exception (except);
+	throw;
 
       ret = value_zero (SYMBOL_TYPE (var), not_lval);
     }
@@ -964,7 +964,7 @@  evaluate_funcall (type *expect_type, expression *exp, int *pos,
 		  if (except.error == NOT_FOUND_ERROR)
 		    break;
 		  else
-		    throw_exception (except);
+		    throw;
 		}
 
 		arg2 = value;
@@ -2036,7 +2036,7 @@  evaluate_subexp_standard (struct type *expect_type,
 	      if (except.error == NOT_FOUND_ERROR)
 		break;
 	      else
-		throw_exception (except);
+		throw;
 	    }
 
 	  arg1 = value;
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index ff9bddfb735..df6fdb89a1b 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -120,7 +120,7 @@  frame_unwind_try_unwinder (struct frame_info *this_frame, void **this_cache,
 	     should always accept the frame.  */
 	  return 0;
 	}
-      throw_exception (ex);
+      throw;
     }
 
   if (res)
diff --git a/gdb/frame.c b/gdb/frame.c
index 79ec5d14ae9..066d938abf5 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -922,7 +922,7 @@  frame_unwind_pc (struct frame_info *this_frame)
 				    this_frame->level);
 	    }
 	  else
-	    throw_exception (ex);
+	    throw;
 	}
 
       if (pc_p)
@@ -1918,7 +1918,7 @@  get_prev_frame_if_no_cycle (struct frame_info *this_frame)
       prev_frame->next = NULL;
       this_frame->prev = NULL;
 
-      throw_exception (ex);
+      throw;
     }
 
   return prev_frame;
@@ -2116,7 +2116,7 @@  get_prev_frame_always (struct frame_info *this_frame)
 	  prev_frame = NULL;
 	}
       else
-	throw_exception (ex);
+	throw;
     }
 
   return prev_frame;
@@ -2385,7 +2385,7 @@  get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc)
       if (ex.error == NOT_AVAILABLE_ERROR)
 	return 0;
       else
-	throw_exception (ex);
+	throw;
     }
 
   return 1;
@@ -2466,7 +2466,7 @@  get_frame_address_in_block_if_available (struct frame_info *this_frame,
     {
       if (ex.error == NOT_AVAILABLE_ERROR)
 	return 0;
-      throw_exception (ex);
+      throw;
     }
 
   return 1;
@@ -2750,7 +2750,7 @@  get_frame_language (struct frame_info *frame)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   if (pc_p)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index e7d28203865..30f6f2e0b7e 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1539,7 +1539,7 @@  linux_detach_one_lwp (struct lwp_info *lwp)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (!check_ptrace_stopped_lwp_gone (lwp))
-	throw_exception (ex);
+	throw;
     }
 
   lwpid = lwpid_of (thread);
@@ -4511,7 +4511,7 @@  linux_resume_one_lwp (struct lwp_info *lwp,
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (!check_ptrace_stopped_lwp_gone (lwp))
-	throw_exception (ex);
+	throw;
     }
 }
 
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index ae2c9eae977..b9e8b01acb1 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2089,7 +2089,7 @@  i386_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
@@ -2268,7 +2268,7 @@  i386_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
@@ -2463,7 +2463,7 @@  i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   *this_cache = cache;
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index 5ccd31b7328..47d73e7e18f 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -79,7 +79,7 @@  inferior_event_handler (enum inferior_event_type event_type,
 		 the prompt and is typing some unrelated command, so
 		 just inform the user and swallow the exception.  */
 	      if (current_ui->prompt_state == PROMPT_BLOCKED)
-		throw_exception (e);
+		throw;
 	      else
 		exception_print (gdb_stderr, e);
 	    }
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 840dad91d23..e1d53611d3b 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -454,7 +454,7 @@  post_create_inferior (struct target_ops *target, int from_tty)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   if (exec_bfd)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1bad6575bf1..14717b7848d 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1784,7 +1784,7 @@  displaced_step_prepare (thread_info *thread)
 
       if (ex.error != MEMORY_ERROR
 	  && ex.error != NOT_SUPPORTED_ERROR)
-	throw_exception (ex);
+	throw;
 
       if (debug_infrun)
 	{
@@ -2620,7 +2620,7 @@  resume (gdb_signal sig)
 	 we're running in non-stop mode.  */
       if (inferior_ptid != null_ptid)
 	delete_single_step_breakpoints (inferior_thread ());
-      throw_exception (ex);
+      throw;
     }
 }
 
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 0de1fa9eb44..07f491f7fa3 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3160,7 +3160,7 @@  event_location_to_sals (linespec_parser *parser,
 	  }
 	catch (struct gdb_exception_RETURN_MASK_ERROR &except)
 	  {
-	    throw_exception (except);
+	    throw;
 	  }
       }
       break;
@@ -3974,7 +3974,7 @@  find_linespec_symbols (struct linespec_state *state,
 	  catch (struct gdb_exception_RETURN_MASK_ERROR &except)
 	    {
 	      if (except.error != NOT_FOUND_ERROR)
-		throw_exception (except);
+		throw;
 	    }
 	}
     }
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 607fd4fc3b8..2f4ea13b013 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1409,7 +1409,7 @@  detach_one_lwp (struct lwp_info *lp, int *signo_p)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (!check_ptrace_stopped_lwp_gone (lp))
-	throw_exception (ex);
+	throw;
     }
 
   if (ptrace (PTRACE_DETACH, lwpid, 0, signo) < 0)
@@ -1590,7 +1590,7 @@  linux_resume_one_lwp (struct lwp_info *lp, int step, enum gdb_signal signo)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (!check_ptrace_stopped_lwp_gone (lp))
-	throw_exception (ex);
+	throw;
     }
 }
 
@@ -3542,7 +3542,7 @@  resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
       catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
 	{
 	  if (!check_ptrace_stopped_lwp_gone (lp))
-	    throw_exception (ex);
+	    throw;
 	}
     }
 
diff --git a/gdb/parse.c b/gdb/parse.c
index bb712799818..0072af5ec9d 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1210,7 +1210,7 @@  parse_exp_in_context_1 (const char **stringptr, CORE_ADDR pc,
 	 expression elements have been written, then there's nothing
 	 to do, so fail.  */
       if (! parse_completion || ps.expout_ptr == 0)
-	throw_exception (except);
+	throw;
     }
 
   /* We have to operate on an "expression *", due to la_post_parser,
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index f0a5f6d0497..b6aba415285 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1484,7 +1484,7 @@  record_btrace_target::insert_breakpoint (struct gdbarch *gdbarch,
   catch (struct gdb_exception_RETURN_MASK_ALL &except)
     {
       replay_memory_access = old;
-      throw_exception (except);
+      throw;
     }
   replay_memory_access = old;
 
@@ -1514,7 +1514,7 @@  record_btrace_target::remove_breakpoint (struct gdbarch *gdbarch,
   catch (struct gdb_exception_RETURN_MASK_ALL &except)
     {
       replay_memory_access = old;
-      throw_exception (except);
+      throw;
     }
   replay_memory_access = old;
 
@@ -1992,7 +1992,7 @@  get_thread_current_frame_id (struct thread_info *tp)
       /* Restore the previous execution state.  */
       set_executing (inferior_ptid, executing);
 
-      throw_exception (except);
+      throw;
     }
 
   /* Restore the previous execution state.  */
@@ -2073,7 +2073,7 @@  record_btrace_start_replaying (struct thread_info *tp)
 
       registers_changed_thread (tp);
 
-      throw_exception (except);
+      throw;
     }
 
   return replay;
@@ -2894,7 +2894,7 @@  cmd_record_btrace_bts_start (const char *args, int from_tty)
   catch (struct gdb_exception_RETURN_MASK_ALL &exception)
     {
       record_btrace_conf.format = BTRACE_FORMAT_NONE;
-      throw_exception (exception);
+      throw;
     }
 }
 
@@ -2915,7 +2915,7 @@  cmd_record_btrace_pt_start (const char *args, int from_tty)
   catch (struct gdb_exception_RETURN_MASK_ALL &exception)
     {
       record_btrace_conf.format = BTRACE_FORMAT_NONE;
-      throw_exception (exception);
+      throw;
     }
 }
 
@@ -2944,7 +2944,7 @@  cmd_record_btrace_start (const char *args, int from_tty)
       catch (struct gdb_exception_RETURN_MASK_ALL &ex)
 	{
 	  record_btrace_conf.format = BTRACE_FORMAT_NONE;
-	  throw_exception (ex);
+	  throw;
 	}
     }
 }
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 18655499f77..7e0294251e1 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -764,7 +764,7 @@  record_full_message (struct regcache *regcache, enum gdb_signal signal)
   catch (struct gdb_exception_RETURN_MASK_ALL &ex)
     {
       record_full_list_release (record_full_arch_list_tail);
-      throw_exception (ex);
+      throw;
     }
 
   record_full_list->next = record_full_arch_list_head;
@@ -1444,7 +1444,7 @@  record_full_wait_1 (struct target_ops *ops,
 	  else
 	    record_full_list = record_full_list->prev;
 
-	  throw_exception (ex);
+	  throw;
 	}
     }
 
@@ -2476,7 +2476,7 @@  record_full_restore (void)
   catch (struct gdb_exception_RETURN_MASK_ALL &ex)
     {
       record_full_list_release (record_full_arch_list_tail);
-      throw_exception (ex);
+      throw;
     }
 
   /* Add record_full_arch_list_head to the end of record list.  */
diff --git a/gdb/remote.c b/gdb/remote.c
index 83006f0ed64..1d81ec86fcf 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -5611,7 +5611,7 @@  remote_target::open_1 (const char *name, int from_tty, int extended_p)
 	   already before throwing the exception.  */
 	if (ex.error != TARGET_CLOSE_ERROR)
 	  remote_unpush_target ();
-	throw_exception (ex);
+	throw;
       }
   }
 
@@ -9785,7 +9785,7 @@  remote_target::remote_kill_k ()
       /* Otherwise, something went wrong.  We didn't actually kill
 	 the target.  Just propagate the exception, and let the
 	 user or higher layers decide what to do.  */
-      throw_exception (ex);
+      throw;
     }
 }
 
@@ -13151,7 +13151,7 @@  remote_target::get_trace_status (struct trace_status *ts)
 	  exception_fprintf (gdb_stderr, ex, "qTStatus: ");
 	  return -1;
 	}
-      throw_exception (ex);
+      throw;
     }
 
   result = packet_ok (p, &remote_protocol_packets[PACKET_qTStatus]);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 575e3f4b83a..634aa6e8f68 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3471,7 +3471,7 @@  rs6000_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
       return (struct rs6000_frame_cache *) (*this_cache);
     }
 
@@ -3700,7 +3700,7 @@  rs6000_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache)
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index ca09ea87f20..48ab79a9c4d 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -2557,7 +2557,7 @@  s390_frame_unwind_cache (struct frame_info *this_frame,
   catch (struct gdb_exception_RETURN_MASK_ERROR &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return info;
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index 65a73d91a79..c483ae3fc6a 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -141,7 +141,7 @@  append_ocl_sos (struct so_list **link_ptr)
 		case MEMORY_ERROR:
 		  break;
 		default:
-		  throw_exception (ex);
+		  throw;
 		  break;
 		}
 	    }
diff --git a/gdb/stack.c b/gdb/stack.c
index 160f61eeb89..afe42e78ba3 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2717,7 +2717,7 @@  frame_apply_command_count (const char *which_command,
 	      if (flags.cont)
 		printf_filtered ("%s\n", ex.message.c_str ());
 	      else
-		throw_exception (ex);
+		throw;
 	    }
 	}
     }
diff --git a/gdb/target.c b/gdb/target.c
index b28b30152c0..e6e56c3c9d3 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -753,7 +753,7 @@  target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 		       objfile_name (objfile), ex.message.c_str ());
 	      break;
 	    default:
-	      throw_exception (ex);
+	      throw;
 	      break;
 	    }
 	}
diff --git a/gdb/thread.c b/gdb/thread.c
index 66a032e2614..73b950201ef 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1481,7 +1481,7 @@  thr_try_catch_cmd (thread_info *thr, const char *cmd, int from_tty,
 	  if (flags.cont)
 	    printf_filtered ("%s\n", ex.message.c_str ());
 	  else
-	    throw_exception (ex);
+	    throw;
 	}
     }
 }
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index c79c6874c90..024054c8841 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -551,7 +551,7 @@  tfile_target_open (const char *arg, int from_tty)
     {
       /* Remove the partially set up target.  */
       unpush_target (&tfile_ops);
-      throw_exception (ex);
+      throw;
     }
 
   inferior_appeared (current_inferior (), TFILE_PID);
diff --git a/gdb/valops.c b/gdb/valops.c
index 8c7060ad72f..8d699e4b429 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3634,7 +3634,7 @@  value_rtti_indirect_type (struct value *v, int *full,
 	         type.  */
 	      return NULL;
 	    }
-	  throw_exception (except);
+	  throw;
 	}
     }
   else