]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
convert to_decr_pc_after_break
authorTom Tromey <tromey@redhat.com>
Thu, 16 Jan 2014 18:39:32 +0000 (11:39 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:47 +0000 (07:48 -0700)
This converts to_decr_pc_after_break to the new style of delegation,
removing forward_target_decr_pc_after_break.

2014-02-19  Tom Tromey  <tromey@redhat.com>

* record-btrace.c (record_btrace_decr_pc_after_break): Delegate
directly.
* target-delegates.c: Rebuild.
* target.h (struct target_ops) <to_decr_pc_after_break>: Use
TARGET_DEFAULT_FUNC.
* target.c (default_target_decr_pc_after_break): Rename from
forward_target_decr_pc_after_break.  Simplify.
(target_decr_pc_after_break): Rely on delegation.

gdb/ChangeLog
gdb/record-btrace.c
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index d41f14ed4cd785051757a621f7d46270d1c90da6..ff6188b0347abbd14af9c5755181aec23260ba65 100644 (file)
@@ -1,3 +1,14 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * record-btrace.c (record_btrace_decr_pc_after_break): Delegate
+       directly.
+       * target-delegates.c: Rebuild.
+       * target.h (struct target_ops) <to_decr_pc_after_break>: Use
+       TARGET_DEFAULT_FUNC.
+       * target.c (default_target_decr_pc_after_break): Rename from
+       forward_target_decr_pc_after_break.  Simplify.
+       (target_decr_pc_after_break): Rely on delegation.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target.c (update_current_target): Do not INHERIT to_doc or
index e343f38e242d344ae955efd60934e5c6dadea71c..50bce79b3eb5006ea9ac7eaad807b2f2e62c4296 100644 (file)
@@ -1737,7 +1737,7 @@ record_btrace_decr_pc_after_break (struct target_ops *ops,
   if (record_btrace_is_replaying (ops))
     return 0;
 
-  return forward_target_decr_pc_after_break (ops->beneath, gdbarch);
+  return ops->beneath->to_decr_pc_after_break (ops->beneath, gdbarch);
 }
 
 /* The to_find_new_threads method of target record-btrace.  */
index 15ab43a12b0ea9d46792c66005026f1b362d7f94..04824f29de3e17f9e13333094d289ce777809499 100644 (file)
@@ -1572,6 +1572,13 @@ tdefault_augmented_libraries_svr4_read (struct target_ops *self)
   return 0;
 }
 
+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 void
 install_delegators (struct target_ops *ops)
 {
@@ -1837,6 +1844,8 @@ install_delegators (struct target_ops *ops)
     ops->to_call_history_range = delegate_call_history_range;
   if (ops->to_augmented_libraries_svr4_read == NULL)
     ops->to_augmented_libraries_svr4_read = delegate_augmented_libraries_svr4_read;
+  if (ops->to_decr_pc_after_break == NULL)
+    ops->to_decr_pc_after_break = delegate_decr_pc_after_break;
 }
 
 static void
@@ -1973,4 +1982,5 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_call_history_from = tdefault_call_history_from;
   ops->to_call_history_range = tdefault_call_history_range;
   ops->to_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read;
+  ops->to_decr_pc_after_break = default_target_decr_pc_after_break;
 }
index e816f7149c008af6f6d2fe6a4e9fb767e1ee7a8b..911c279968e92473852bb12d07d204cd9cfb2a86 100644 (file)
@@ -108,6 +108,9 @@ static int find_default_is_async_p (struct target_ops *ignore);
 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);
+
 #include "target-delegates.c"
 
 static void init_dummy_target (void);
@@ -3842,16 +3845,12 @@ target_get_tailcall_unwinder (void)
   return NULL;
 }
 
-/* See target.h.  */
+/* Default implementation of to_decr_pc_after_break.  */
 
-CORE_ADDR
-forward_target_decr_pc_after_break (struct target_ops *ops,
+static CORE_ADDR
+default_target_decr_pc_after_break (struct target_ops *ops,
                                    struct gdbarch *gdbarch)
 {
-  for (; ops != NULL; ops = ops->beneath)
-    if (ops->to_decr_pc_after_break != NULL)
-      return ops->to_decr_pc_after_break (ops, gdbarch);
-
   return gdbarch_decr_pc_after_break (gdbarch);
 }
 
@@ -3860,7 +3859,7 @@ forward_target_decr_pc_after_break (struct target_ops *ops,
 CORE_ADDR
 target_decr_pc_after_break (struct gdbarch *gdbarch)
 {
-  return forward_target_decr_pc_after_break (current_target.beneath, gdbarch);
+  return current_target.to_decr_pc_after_break (&current_target, gdbarch);
 }
 
 static int
index 79805d13afcdfd907b74b8ee624eb097ba72c4c8..4a46a1660fadebe2054863448f4b20e2865a76c0 100644 (file)
@@ -1117,7 +1117,8 @@ struct target_ops
        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);
+                                        struct gdbarch *gdbarch)
+      TARGET_DEFAULT_FUNC (default_target_decr_pc_after_break);
 
     int to_magic;
     /* Need sub-structure for target machine related rather than comm related?