[PATCH v3 7/7] Replace throw_exception with throw in some cases

Tom Tromey tom@tromey.com
Sun Apr 7 19:57:00 GMT 2019


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.  This should always be safe, because exceptions
are caught by const reference, and therefore can't be modified in the
body of the catch.

gdb/ChangeLog
2019-04-07  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-04-07  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(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index ebd84e9dc2b..7eecb52eb11 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -881,7 +881,7 @@ aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
   catch (const gdb_exception_error &ex)
     {
       if (ex.error != NOT_AVAILABLE_ERROR)
-	throw_exception (ex);
+	throw;
     }
 
   return cache;
@@ -1015,7 +1015,7 @@ aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache)
   catch (const gdb_exception_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 5b8a94002d5..f4a1af90506 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 (const gdb_exception_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 (const gdb_exception_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 (const gdb_exception_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 3b9cdd6c257..a221cb31518 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 5bfa5b2b7b3..3047ef3827d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9253,7 +9253,7 @@ create_breakpoint (struct gdbarch *gdbarch,
 	     error.  */
 
 	  if (pending_break_support == AUTO_BOOLEAN_FALSE)
-	    throw_exception (e);
+	    throw;
 
 	  exception_print (gdb_stderr, e);
 
@@ -9271,7 +9271,7 @@ create_breakpoint (struct gdbarch *gdbarch,
 	  pending = 1;
 	}
       else
-	throw_exception (e);
+	throw;
     }
 
   if (!pending && canonical.lsals.empty ())
@@ -13635,7 +13635,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;
 	}
     }
 
@@ -15034,7 +15034,7 @@ save_breakpoints (const char *filename, int from_tty,
 	catch (const gdb_exception &ex)
 	  {
 	  current_uiout->redirect (NULL);
-	    throw_exception (ex);
+	    throw;
 	  }
 
 	current_uiout->redirect (NULL);
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 4b2f0797206..c6d564e7062 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 d124d3a6c28..361ead47250 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 (const gdb_exception &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 5bad049fc51..32e46f94104 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 d4099c7c52d..5d1decca1d1 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1451,7 +1451,7 @@ complete_line_internal (completion_tracker &tracker,
   catch (const gdb_exception_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 8e54538752e..d95b1404dce 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 (const gdb_exception_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 02604338b56..8282ef27e61 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 a24235ab84f..b1db1ede038 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 12951f546f8..2b8aeee83ad 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;
@@ -2185,7 +2185,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)
@@ -2397,7 +2397,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 fa03369b394..aed89e5f85a 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 (const gdb_exception_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;
@@ -2053,7 +2053,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 8510086001a..4b38f64c2f1 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 1a76bdf3b1f..f4303d13cc1 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 (const gdb_exception_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 4b1a211ab7a..94af240a5c2 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -1543,7 +1543,7 @@ linux_detach_one_lwp (struct lwp_info *lwp)
   catch (const gdb_exception_error &ex)
     {
       if (!check_ptrace_stopped_lwp_gone (lwp))
-	throw_exception (ex);
+	throw;
     }
 
   lwpid = lwpid_of (thread);
@@ -4514,7 +4514,7 @@ linux_resume_one_lwp (struct lwp_info *lwp,
   catch (const gdb_exception_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 7249005ee9e..54d9dd873b8 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 (const gdb_exception_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 (const gdb_exception_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 (const gdb_exception_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 85bd69cac2b..f0d8def1415 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 116c5f00796..3b26fd4a467 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -454,7 +454,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
   catch (const gdb_exception_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 deb7bd6abd6..37713b24fee 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1786,7 +1786,7 @@ displaced_step_prepare (thread_info *thread)
 
       if (ex.error != MEMORY_ERROR
 	  && ex.error != NOT_SUPPORTED_ERROR)
-	throw_exception (ex);
+	throw;
 
       if (debug_infrun)
 	{
@@ -2624,7 +2624,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 0ed9d7cf977..c42ddba7315 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3152,7 +3152,7 @@ event_location_to_sals (linespec_parser *parser,
 	  }
 	catch (const gdb_exception_error &except)
 	  {
-	    throw_exception (except);
+	    throw;
 	  }
       }
       break;
@@ -3966,7 +3966,7 @@ find_linespec_symbols (struct linespec_state *state,
 	  catch (const gdb_exception_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 ed1f67c4a67..65165a2d46b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1408,7 +1408,7 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p)
   catch (const gdb_exception_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 (const gdb_exception_error &ex)
     {
       if (!check_ptrace_stopped_lwp_gone (lp))
-	throw_exception (ex);
+	throw;
     }
 }
 
@@ -3552,7 +3552,7 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
       catch (const gdb_exception_error &ex)
 	{
 	  if (!check_ptrace_stopped_lwp_gone (lp))
-	    throw_exception (ex);
+	    throw;
 	}
     }
 
diff --git a/gdb/parse.c b/gdb/parse.c
index cc1fd7fd1a3..3e02057bf7b 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1147,7 +1147,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
 	 expression elements have been written, then there's nothing
 	 to do, so fail.  */
       if (! ps.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 f5a5306fe12..21085d5c62c 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1485,7 +1485,7 @@ record_btrace_target::insert_breakpoint (struct gdbarch *gdbarch,
   catch (const gdb_exception &except)
     {
       replay_memory_access = old;
-      throw_exception (except);
+      throw;
     }
   replay_memory_access = old;
 
@@ -1515,7 +1515,7 @@ record_btrace_target::remove_breakpoint (struct gdbarch *gdbarch,
   catch (const gdb_exception &except)
     {
       replay_memory_access = old;
-      throw_exception (except);
+      throw;
     }
   replay_memory_access = old;
 
@@ -1994,7 +1994,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.  */
@@ -2075,7 +2075,7 @@ record_btrace_start_replaying (struct thread_info *tp)
 
       registers_changed_thread (tp);
 
-      throw_exception (except);
+      throw;
     }
 
   return replay;
@@ -2896,7 +2896,7 @@ cmd_record_btrace_bts_start (const char *args, int from_tty)
   catch (const gdb_exception &exception)
     {
       record_btrace_conf.format = BTRACE_FORMAT_NONE;
-      throw_exception (exception);
+      throw;
     }
 }
 
@@ -2917,7 +2917,7 @@ cmd_record_btrace_pt_start (const char *args, int from_tty)
   catch (const gdb_exception &exception)
     {
       record_btrace_conf.format = BTRACE_FORMAT_NONE;
-      throw_exception (exception);
+      throw;
     }
 }
 
@@ -2946,7 +2946,7 @@ cmd_record_btrace_start (const char *args, int from_tty)
       catch (const gdb_exception &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 57d7bb0e114..95a0353d754 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 (const gdb_exception &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 (const gdb_exception &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 318459405ce..767c69444b8 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;
       }
   }
 
@@ -9784,7 +9784,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;
     }
 }
 
@@ -13143,7 +13143,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 7a59e119f4f..375b960f0ba 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 (const gdb_exception_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 (const gdb_exception_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 a08738881ff..4b931017a8d 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 (const gdb_exception_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 94d8cadabcb..c5dc8639f1e 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 c1a9d9dfb09..f7fd9433b56 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2715,7 +2715,7 @@ frame_apply_command_count (const char *which_command,
 	      if (flags.cont)
 		printf_filtered ("%s\n", ex.what ());
 	      else
-		throw_exception (ex);
+		throw;
 	    }
 	}
     }
diff --git a/gdb/target.c b/gdb/target.c
index 22344002113..3ab5671c463 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -767,7 +767,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
 		       objfile_name (objfile), ex.what ());
 	      break;
 	    default:
-	      throw_exception (ex);
+	      throw;
 	      break;
 	    }
 	}
diff --git a/gdb/thread.c b/gdb/thread.c
index 010cd24e7e1..5b23b8c1f2a 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1482,7 +1482,7 @@ thr_try_catch_cmd (thread_info *thr, const char *cmd, int from_tty,
 	  if (flags.cont)
 	    printf_filtered ("%s\n", ex.what ());
 	  else
-	    throw_exception (ex);
+	    throw;
 	}
     }
 }
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 72d2f70eaf9..593556a8ba8 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 0de4067c6b2..fd92a4d1655 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
-- 
2.17.2



More information about the Gdb-patches mailing list