[8/8] garbage collect target_decr_pc_after_break

Message ID 1424909852-25917-9-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Feb. 26, 2015, 12:17 a.m. UTC
  record-btrace was the only target making use of this, and it no longer
uses it.

gdb/ChangeLog:
2015-02-25  Pedro Alves  <palves@redhat.com>

	* target.h (struct target_ops) <to_decr_pc_after_break>: Delete.
	(target_decr_pc_after_break): Delete declaration.
	* target.c (default_target_decr_pc_after_break)
	(target_decr_pc_after_break): Delete.
	* linux-nat.c (check_stopped_by_breakpoint, linux_nat_wait_1): Use
	gdbarch_decr_pc_after_break instead of target_decr_pc_after_break.
	* linux-thread-db.c (check_event): Likewise.
	* infrun.c (adjust_pc_after_break): Likewise.
	* darwin-nat.c (cancel_breakpoint): Likewise.
	* aix-thread.c (aix_thread_wait): Likewise.
	* target-delegates.c: Regenerate.
---
 gdb/aix-thread.c       |  2 +-
 gdb/darwin-nat.c       |  4 ++--
 gdb/infrun.c           |  4 ++--
 gdb/linux-nat.c        |  4 ++--
 gdb/linux-thread-db.c  |  2 +-
 gdb/target-delegates.c | 27 ---------------------------
 gdb/target.c           | 20 --------------------
 gdb/target.h           | 10 ----------
 8 files changed, 8 insertions(+), 65 deletions(-)
  

Patch

diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index c187ea0..702942f 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1042,7 +1042,7 @@  aix_thread_wait (struct target_ops *ops,
       struct gdbarch *gdbarch = get_regcache_arch (regcache);
 
       if (regcache_read_pc (regcache)
-	  - target_decr_pc_after_break (gdbarch) == pd_brk_addr)
+	  - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr)
 	return pd_activate (0);
     }
 
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index f9481c7..8f98490 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1055,14 +1055,14 @@  cancel_breakpoint (ptid_t ptid)
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR pc;
 
-  pc = regcache_read_pc (regcache) - target_decr_pc_after_break (gdbarch);
+  pc = regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch);
   if (breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc))
     {
       inferior_debug (4, "cancel_breakpoint for thread 0x%x\n",
 		      ptid_get_tid (ptid));
 
       /* Back up the PC if necessary.  */
-      if (target_decr_pc_after_break (gdbarch))
+      if (gdbarch_decr_pc_after_break (gdbarch))
 	regcache_write_pc (regcache, pc);
 
       return 1;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 5f382b3..14f33b5 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3466,7 +3466,7 @@  adjust_pc_after_break (struct execution_control_state *ecs)
   regcache = get_thread_regcache (ecs->ptid);
   gdbarch = get_regcache_arch (regcache);
 
-  decr_pc = target_decr_pc_after_break (gdbarch);
+  decr_pc = gdbarch_decr_pc_after_break (gdbarch);
   if (decr_pc == 0)
     return;
 
@@ -4518,7 +4518,7 @@  handle_signal_stop (struct execution_control_state *ecs)
 	  /* Re-adjust PC to what the program would see if GDB was not
 	     debugging it.  */
 	  regcache = get_thread_regcache (ecs->event_thread->ptid);
-	  decr_pc = target_decr_pc_after_break (gdbarch);
+	  decr_pc = gdbarch_decr_pc_after_break (gdbarch);
 	  if (decr_pc != 0)
 	    {
 	      struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 086280c..39a27e2 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -2690,7 +2690,7 @@  check_stopped_by_breakpoint (struct lwp_info *lp)
 #endif
 
   pc = regcache_read_pc (regcache);
-  sw_bp_pc = pc - target_decr_pc_after_break (gdbarch);
+  sw_bp_pc = pc - gdbarch_decr_pc_after_break (gdbarch);
 
 #if USE_SIGTRAP_SIGINFO
   if (linux_nat_get_siginfo (lp->ptid, &siginfo))
@@ -3465,7 +3465,7 @@  linux_nat_wait_1 (struct target_ops *ops,
     {
       struct regcache *regcache = get_thread_regcache (lp->ptid);
       struct gdbarch *gdbarch = get_regcache_arch (regcache);
-      int decr_pc = target_decr_pc_after_break (gdbarch);
+      int decr_pc = gdbarch_decr_pc_after_break (gdbarch);
 
       if (decr_pc != 0)
 	{
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index f4c03e7..27a5394 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1439,7 +1439,7 @@  check_event (ptid_t ptid)
   /* Bail out early if we're not at a thread event breakpoint.  */
   stop_pc = regcache_read_pc (regcache);
   if (!target_supports_stopped_by_sw_breakpoint ())
-    stop_pc -= target_decr_pc_after_break (gdbarch);
+    stop_pc -= gdbarch_decr_pc_after_break (gdbarch);
 
   if (stop_pc != info->td_create_bp_addr
       && stop_pc != info->td_death_bp_addr)
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 1f827f5..0c1309a 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -3805,29 +3805,6 @@  debug_get_tailcall_unwinder (struct target_ops *self)
   return result;
 }
 
-static CORE_ADDR
-delegate_decr_pc_after_break (struct target_ops *self, struct gdbarch *arg1)
-{
-  self = self->beneath;
-  return self->to_decr_pc_after_break (self, arg1);
-}
-
-static CORE_ADDR
-debug_decr_pc_after_break (struct target_ops *self, struct gdbarch *arg1)
-{
-  CORE_ADDR result;
-  fprintf_unfiltered (gdb_stdlog, "-> %s->to_decr_pc_after_break (...)\n", debug_target.to_shortname);
-  result = debug_target.to_decr_pc_after_break (&debug_target, arg1);
-  fprintf_unfiltered (gdb_stdlog, "<- %s->to_decr_pc_after_break (", debug_target.to_shortname);
-  target_debug_print_struct_target_ops_p (&debug_target);
-  fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_struct_gdbarch_p (arg1);
-  fputs_unfiltered (") = ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (result);
-  fputs_unfiltered ("\n", gdb_stdlog);
-  return result;
-}
-
 static void
 delegate_prepare_to_generate_core (struct target_ops *self)
 {
@@ -4155,8 +4132,6 @@  install_delegators (struct target_ops *ops)
     ops->to_get_unwinder = delegate_get_unwinder;
   if (ops->to_get_tailcall_unwinder == NULL)
     ops->to_get_tailcall_unwinder = delegate_get_tailcall_unwinder;
-  if (ops->to_decr_pc_after_break == NULL)
-    ops->to_decr_pc_after_break = delegate_decr_pc_after_break;
   if (ops->to_prepare_to_generate_core == NULL)
     ops->to_prepare_to_generate_core = delegate_prepare_to_generate_core;
   if (ops->to_done_generating_core == NULL)
@@ -4306,7 +4281,6 @@  install_dummy_methods (struct target_ops *ops)
   ops->to_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read;
   ops->to_get_unwinder = tdefault_get_unwinder;
   ops->to_get_tailcall_unwinder = tdefault_get_tailcall_unwinder;
-  ops->to_decr_pc_after_break = default_target_decr_pc_after_break;
   ops->to_prepare_to_generate_core = tdefault_prepare_to_generate_core;
   ops->to_done_generating_core = tdefault_done_generating_core;
 }
@@ -4454,7 +4428,6 @@  init_debug_target (struct target_ops *ops)
   ops->to_augmented_libraries_svr4_read = debug_augmented_libraries_svr4_read;
   ops->to_get_unwinder = debug_get_unwinder;
   ops->to_get_tailcall_unwinder = debug_get_tailcall_unwinder;
-  ops->to_decr_pc_after_break = debug_decr_pc_after_break;
   ops->to_prepare_to_generate_core = debug_prepare_to_generate_core;
   ops->to_done_generating_core = debug_done_generating_core;
 }
diff --git a/gdb/target.c b/gdb/target.c
index 569c999..d66560a 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -105,9 +105,6 @@  static char *default_pid_to_str (struct target_ops *ops, ptid_t ptid);
 static enum exec_direction_kind default_execution_direction
     (struct target_ops *self);
 
-static CORE_ADDR default_target_decr_pc_after_break (struct target_ops *ops,
-						     struct gdbarch *gdbarch);
-
 static struct target_ops debug_target;
 
 #include "target-delegates.c"
@@ -3572,23 +3569,6 @@  target_get_tailcall_unwinder (void)
   return current_target.to_get_tailcall_unwinder (&current_target);
 }
 
-/* Default implementation of to_decr_pc_after_break.  */
-
-static CORE_ADDR
-default_target_decr_pc_after_break (struct target_ops *ops,
-				    struct gdbarch *gdbarch)
-{
-  return gdbarch_decr_pc_after_break (gdbarch);
-}
-
-/* See target.h.  */
-
-CORE_ADDR
-target_decr_pc_after_break (struct gdbarch *gdbarch)
-{
-  return current_target.to_decr_pc_after_break (&current_target, gdbarch);
-}
-
 /* See target.h.  */
 
 void
diff --git a/gdb/target.h b/gdb/target.h
index 056f006..f393f62 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1155,13 +1155,6 @@  struct target_ops
     const struct frame_unwind *(*to_get_tailcall_unwinder) (struct target_ops *self)
       TARGET_DEFAULT_RETURN (NULL);
 
-    /* Return the number of bytes by which the PC needs to be decremented
-       after executing a breakpoint instruction.
-       Defaults to gdbarch_decr_pc_after_break (GDBARCH).  */
-    CORE_ADDR (*to_decr_pc_after_break) (struct target_ops *ops,
-					 struct gdbarch *gdbarch)
-      TARGET_DEFAULT_FUNC (default_target_decr_pc_after_break);
-
     /* Prepare to generate a core file.  */
     void (*to_prepare_to_generate_core) (struct target_ops *)
       TARGET_DEFAULT_IGNORE ();
@@ -2331,9 +2324,6 @@  extern void target_call_history_from (ULONGEST begin, int size, int flags);
 /* See to_call_history_range.  */
 extern void target_call_history_range (ULONGEST begin, ULONGEST end, int flags);
 
-/* See to_decr_pc_after_break.  */
-extern CORE_ADDR target_decr_pc_after_break (struct gdbarch *gdbarch);
-
 /* See to_prepare_to_generate_core.  */
 extern void target_prepare_to_generate_core (void);