public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [RFC 27/32] convert to_insert_mask_watchpoint
Date: Mon, 13 Jan 2014 19:13:00 -0000	[thread overview]
Message-ID: <1389640367-5571-28-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1389640367-5571-1-git-send-email-tromey@redhat.com>

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_insert_mask_watchpoint): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_insert_mask_watchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_remove_mask_watchpoint

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_remove_mask_watchpoint): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_remove_mask_watchpoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_masked_watch_num_registers

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_masked_watch_num_registers): Unconditionally
	delegate.
	* target.h (struct target_ops) <to_masked_watch_num_registers>:
	Use TARGET_DEFAULT_RETURN.

convert to_kill

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_kill): Unconditionally delegate.
	* target.h (struct target_ops) <to_kill>: Use
	TARGET_DEFAULT_NORETURN.

convert to_follow_fork

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (default_follow_fork): New function.
	(target_follow_fork): Unconditionally delegate.
	* target.h (struct target_ops) <to_follow_fork>: Use
	TARGET_DEFAULT_FUNC.

convert to_mourn_inferior

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (default_mourn_inferior): New function.
	(target_mourn_inferior): Unconditionally delegate.
	* target.h (struct target_ops) <to_mourn_inferior>: Use
	TARGET_DEFAULT_FUNC.

convert to_pass_signals

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_pass_signals): Unconditionally delegate.
	* target.h (struct target_ops) <to_pass_signals>: Use
	TARGET_DEFAULT_IGNORE.

convert to_program_signals

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_program_signals): Unconditionally delegate.
	* target.h (struct target_ops) <to_program_signals>: Use
	TARGET_DEFAULT_IGNORE.

convert to_find_new_threads

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_find_new_threads): Unconditionally delegate.
	* target.h (struct target_ops) <to_find_new_threads>: Use
	TARGET_DEFAULT_RETURN.

convert to_pid_to_str

2014-01-08  Tom Tromey <tromey@redhat.com>

	* target-delegates.c : Rebuild.
	* target.c (target_pid_to_exec_file): Unconditionally delegate.
	(init_dummy_target): Don't initialize to_pid_to_exec_file.
	* target.h (struct target_ops) <to_pid_to_exec_file>: Use
	TARGET_DEFAULT_FUNC.
---
 gdb/ChangeLog          |  76 ++++++++++++++++
 gdb/target-delegates.c | 139 +++++++++++++++++++++++++++++
 gdb/target.c           | 233 ++++++++++++++++++-------------------------------
 gdb/target.h           |  30 ++++---
 4 files changed, 319 insertions(+), 159 deletions(-)

diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 7667b2d..f32c90f 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -203,6 +203,32 @@ tdefault_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, i
 }
 
 static int
+delegate_insert_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+{
+  self = self->beneath;
+  return self->to_insert_mask_watchpoint (self, arg1, arg2, arg3);
+}
+
+static int
+tdefault_insert_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+{
+  return 1;
+}
+
+static int
+delegate_remove_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+{
+  self = self->beneath;
+  return self->to_remove_mask_watchpoint (self, arg1, arg2, arg3);
+}
+
+static int
+tdefault_remove_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+{
+  return 1;
+}
+
+static int
 delegate_stopped_by_watchpoint (struct target_ops *self)
 {
   self = self->beneath;
@@ -255,6 +281,19 @@ tdefault_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1
   return 0;
 }
 
+static int
+delegate_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2)
+{
+  self = self->beneath;
+  return self->to_masked_watch_num_registers (self, arg1, arg2);
+}
+
+static int
+tdefault_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2)
+{
+  return -1;
+}
+
 static void
 delegate_terminal_init (struct target_ops *self)
 {
@@ -323,6 +362,19 @@ delegate_terminal_info (struct target_ops *self, const char *arg1, int arg2)
 }
 
 static void
+delegate_kill (struct target_ops *self)
+{
+  self = self->beneath;
+  self->to_kill (self);
+}
+
+static void
+tdefault_kill (struct target_ops *self)
+{
+  noprocess ();
+}
+
+static void
 delegate_load (struct target_ops *self, char *arg1, int arg2)
 {
   self = self->beneath;
@@ -400,6 +452,13 @@ tdefault_remove_vfork_catchpoint (struct target_ops *self, int arg1)
 }
 
 static int
+delegate_follow_fork (struct target_ops *self, int arg1, int arg2)
+{
+  self = self->beneath;
+  return self->to_follow_fork (self, arg1, arg2);
+}
+
+static int
 delegate_insert_exec_catchpoint (struct target_ops *self, int arg1)
 {
   self = self->beneath;
@@ -451,6 +510,56 @@ tdefault_has_exited (struct target_ops *self, int arg1, int arg2, int *arg3)
   return 0;
 }
 
+static void
+delegate_mourn_inferior (struct target_ops *self)
+{
+  self = self->beneath;
+  self->to_mourn_inferior (self);
+}
+
+static void
+delegate_pass_signals (struct target_ops *self, int arg1, unsigned char *arg2)
+{
+  self = self->beneath;
+  self->to_pass_signals (self, arg1, arg2);
+}
+
+static void
+tdefault_pass_signals (struct target_ops *self, int arg1, unsigned char *arg2)
+{
+}
+
+static void
+delegate_program_signals (struct target_ops *self, int arg1, unsigned char *arg2)
+{
+  self = self->beneath;
+  self->to_program_signals (self, arg1, arg2);
+}
+
+static void
+tdefault_program_signals (struct target_ops *self, int arg1, unsigned char *arg2)
+{
+}
+
+static void
+delegate_find_new_threads (struct target_ops *self)
+{
+  self = self->beneath;
+  self->to_find_new_threads (self);
+}
+
+static void
+tdefault_find_new_threads (struct target_ops *self)
+{
+}
+
+static char *
+delegate_pid_to_str (struct target_ops *self, ptid_t arg1)
+{
+  self = self->beneath;
+  return self->to_pid_to_str (self, arg1);
+}
+
 static char *
 delegate_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
 {
@@ -1136,6 +1245,10 @@ install_delegators (struct target_ops *ops)
     ops->to_remove_watchpoint = delegate_remove_watchpoint;
   if (ops->to_insert_watchpoint == NULL)
     ops->to_insert_watchpoint = delegate_insert_watchpoint;
+  if (ops->to_insert_mask_watchpoint == NULL)
+    ops->to_insert_mask_watchpoint = delegate_insert_mask_watchpoint;
+  if (ops->to_remove_mask_watchpoint == NULL)
+    ops->to_remove_mask_watchpoint = delegate_remove_mask_watchpoint;
   if (ops->to_stopped_by_watchpoint == NULL)
     ops->to_stopped_by_watchpoint = delegate_stopped_by_watchpoint;
   if (ops->to_stopped_data_address == NULL)
@@ -1146,6 +1259,8 @@ install_delegators (struct target_ops *ops)
     ops->to_region_ok_for_hw_watchpoint = delegate_region_ok_for_hw_watchpoint;
   if (ops->to_can_accel_watchpoint_condition == NULL)
     ops->to_can_accel_watchpoint_condition = delegate_can_accel_watchpoint_condition;
+  if (ops->to_masked_watch_num_registers == NULL)
+    ops->to_masked_watch_num_registers = delegate_masked_watch_num_registers;
   if (ops->to_terminal_init == NULL)
     ops->to_terminal_init = delegate_terminal_init;
   if (ops->to_terminal_inferior == NULL)
@@ -1158,6 +1273,8 @@ install_delegators (struct target_ops *ops)
     ops->to_terminal_save_ours = delegate_terminal_save_ours;
   if (ops->to_terminal_info == NULL)
     ops->to_terminal_info = delegate_terminal_info;
+  if (ops->to_kill == NULL)
+    ops->to_kill = delegate_kill;
   if (ops->to_load == NULL)
     ops->to_load = delegate_load;
   if (ops->to_post_startup_inferior == NULL)
@@ -1170,6 +1287,8 @@ install_delegators (struct target_ops *ops)
     ops->to_insert_vfork_catchpoint = delegate_insert_vfork_catchpoint;
   if (ops->to_remove_vfork_catchpoint == NULL)
     ops->to_remove_vfork_catchpoint = delegate_remove_vfork_catchpoint;
+  if (ops->to_follow_fork == NULL)
+    ops->to_follow_fork = delegate_follow_fork;
   if (ops->to_insert_exec_catchpoint == NULL)
     ops->to_insert_exec_catchpoint = delegate_insert_exec_catchpoint;
   if (ops->to_remove_exec_catchpoint == NULL)
@@ -1178,6 +1297,16 @@ install_delegators (struct target_ops *ops)
     ops->to_set_syscall_catchpoint = delegate_set_syscall_catchpoint;
   if (ops->to_has_exited == NULL)
     ops->to_has_exited = delegate_has_exited;
+  if (ops->to_mourn_inferior == NULL)
+    ops->to_mourn_inferior = delegate_mourn_inferior;
+  if (ops->to_pass_signals == NULL)
+    ops->to_pass_signals = delegate_pass_signals;
+  if (ops->to_program_signals == NULL)
+    ops->to_program_signals = delegate_program_signals;
+  if (ops->to_find_new_threads == NULL)
+    ops->to_find_new_threads = delegate_find_new_threads;
+  if (ops->to_pid_to_str == NULL)
+    ops->to_pid_to_str = delegate_pid_to_str;
   if (ops->to_extra_thread_info == NULL)
     ops->to_extra_thread_info = delegate_extra_thread_info;
   if (ops->to_thread_name == NULL)
@@ -1308,27 +1437,37 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_remove_hw_breakpoint = tdefault_remove_hw_breakpoint;
   ops->to_remove_watchpoint = tdefault_remove_watchpoint;
   ops->to_insert_watchpoint = tdefault_insert_watchpoint;
+  ops->to_insert_mask_watchpoint = tdefault_insert_mask_watchpoint;
+  ops->to_remove_mask_watchpoint = tdefault_remove_mask_watchpoint;
   ops->to_stopped_by_watchpoint = tdefault_stopped_by_watchpoint;
   ops->to_stopped_data_address = tdefault_stopped_data_address;
   ops->to_watchpoint_addr_within_range = default_watchpoint_addr_within_range;
   ops->to_region_ok_for_hw_watchpoint = default_region_ok_for_hw_watchpoint;
   ops->to_can_accel_watchpoint_condition = tdefault_can_accel_watchpoint_condition;
+  ops->to_masked_watch_num_registers = tdefault_masked_watch_num_registers;
   ops->to_terminal_init = tdefault_terminal_init;
   ops->to_terminal_inferior = tdefault_terminal_inferior;
   ops->to_terminal_ours_for_output = tdefault_terminal_ours_for_output;
   ops->to_terminal_ours = tdefault_terminal_ours;
   ops->to_terminal_save_ours = tdefault_terminal_save_ours;
   ops->to_terminal_info = default_terminal_info;
+  ops->to_kill = tdefault_kill;
   ops->to_load = tdefault_load;
   ops->to_post_startup_inferior = tdefault_post_startup_inferior;
   ops->to_insert_fork_catchpoint = tdefault_insert_fork_catchpoint;
   ops->to_remove_fork_catchpoint = tdefault_remove_fork_catchpoint;
   ops->to_insert_vfork_catchpoint = tdefault_insert_vfork_catchpoint;
   ops->to_remove_vfork_catchpoint = tdefault_remove_vfork_catchpoint;
+  ops->to_follow_fork = default_follow_fork;
   ops->to_insert_exec_catchpoint = tdefault_insert_exec_catchpoint;
   ops->to_remove_exec_catchpoint = tdefault_remove_exec_catchpoint;
   ops->to_set_syscall_catchpoint = tdefault_set_syscall_catchpoint;
   ops->to_has_exited = tdefault_has_exited;
+  ops->to_mourn_inferior = default_mourn_inferior;
+  ops->to_pass_signals = tdefault_pass_signals;
+  ops->to_program_signals = tdefault_program_signals;
+  ops->to_find_new_threads = tdefault_find_new_threads;
+  ops->to_pid_to_str = dummy_pid_to_str;
   ops->to_extra_thread_info = tdefault_extra_thread_info;
   ops->to_thread_name = tdefault_thread_name;
   ops->to_stop = tdefault_stop;
diff --git a/gdb/target.c b/gdb/target.c
index 17d29c7..636cfdb 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -60,6 +60,11 @@ static void default_rcmd (struct target_ops *, char *, struct ui_file *);
 static ptid_t default_get_ada_task_ptid (struct target_ops *self,
 					 long lwp, long tid);
 
+static int default_follow_fork (struct target_ops *self, int follow_child,
+				int detach_fork);
+
+static void default_mourn_inferior (struct target_ops *self);
+
 static void tcomplain (void) ATTRIBUTE_NORETURN;
 
 static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
@@ -88,6 +93,8 @@ static int dummy_find_memory_regions (struct target_ops *self,
 static char *dummy_make_corefile_notes (struct target_ops *self,
 					bfd *ignore1, int *ignore2);
 
+static char *dummy_pid_to_str (struct target_ops *ops, ptid_t ptid);
+
 static int find_default_can_async_p (struct target_ops *ignore);
 
 static int find_default_is_async_p (struct target_ops *ignore);
@@ -450,19 +457,10 @@ target_ignore (void)
 void
 target_kill (void)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_kill != NULL)
-      {
-	if (targetdebug)
-	  fprintf_unfiltered (gdb_stdlog, "target_kill ()\n");
-
-        t->to_kill (t);
-	return;
-      }
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog, "target_kill ()\n");
 
-  noprocess ();
+  current_target.to_kill (&current_target);
 }
 
 void
@@ -2473,15 +2471,7 @@ target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
 char *
 target_pid_to_str (ptid_t ptid)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    {
-      if (t->to_pid_to_str != NULL)
-	return (*t->to_pid_to_str) (t, ptid);
-    }
-
-  return normal_pid_to_str (ptid);
+  return (*current_target.to_pid_to_str) (&current_target, ptid);
 }
 
 char *
@@ -2513,61 +2503,53 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
 void
 target_pass_signals (int numsigs, unsigned char *pass_signals)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  if (targetdebug)
     {
-      if (t->to_pass_signals != NULL)
-	{
-	  if (targetdebug)
-	    {
-	      int i;
+      int i;
 
-	      fprintf_unfiltered (gdb_stdlog, "target_pass_signals (%d, {",
-				  numsigs);
+      fprintf_unfiltered (gdb_stdlog, "target_pass_signals (%d, {",
+			  numsigs);
 
-	      for (i = 0; i < numsigs; i++)
-		if (pass_signals[i])
-		  fprintf_unfiltered (gdb_stdlog, " %s",
-				      gdb_signal_to_name (i));
+      for (i = 0; i < numsigs; i++)
+	if (pass_signals[i])
+	  fprintf_unfiltered (gdb_stdlog, " %s",
+			      gdb_signal_to_name (i));
 
-	      fprintf_unfiltered (gdb_stdlog, " })\n");
-	    }
-
-	  (*t->to_pass_signals) (t, numsigs, pass_signals);
-	  return;
-	}
+      fprintf_unfiltered (gdb_stdlog, " })\n");
     }
+
+  (*current_target.to_pass_signals) (&current_target, numsigs, pass_signals);
 }
 
 void
 target_program_signals (int numsigs, unsigned char *program_signals)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
+  if (targetdebug)
     {
-      if (t->to_program_signals != NULL)
-	{
-	  if (targetdebug)
-	    {
-	      int i;
-
-	      fprintf_unfiltered (gdb_stdlog, "target_program_signals (%d, {",
-				  numsigs);
+      int i;
 
-	      for (i = 0; i < numsigs; i++)
-		if (program_signals[i])
-		  fprintf_unfiltered (gdb_stdlog, " %s",
-				      gdb_signal_to_name (i));
+      fprintf_unfiltered (gdb_stdlog, "target_program_signals (%d, {",
+			  numsigs);
 
-	      fprintf_unfiltered (gdb_stdlog, " })\n");
-	    }
+      for (i = 0; i < numsigs; i++)
+	if (program_signals[i])
+	  fprintf_unfiltered (gdb_stdlog, " %s",
+			      gdb_signal_to_name (i));
 
-	  (*t->to_program_signals) (t, numsigs, program_signals);
-	  return;
-	}
+      fprintf_unfiltered (gdb_stdlog, " })\n");
     }
+
+  (*current_target.to_program_signals) (&current_target,
+					numsigs, program_signals);
+}
+
+static int
+default_follow_fork (struct target_ops *self, int follow_child,
+		     int detach_fork)
+{
+  /* Some target returned a fork event, but did not know how to follow it.  */
+  internal_error (__FILE__, __LINE__,
+		  _("could not find a target to follow fork"));
 }
 
 /* Look through the list of possible targets for a target that can
@@ -2576,51 +2558,34 @@ target_program_signals (int numsigs, unsigned char *program_signals)
 int
 target_follow_fork (int follow_child, int detach_fork)
 {
-  struct target_ops *t;
+  int retval = current_target.to_follow_fork (&current_target,
+					      follow_child, detach_fork);
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    {
-      if (t->to_follow_fork != NULL)
-	{
-	  int retval = t->to_follow_fork (t, follow_child, detach_fork);
-
-	  if (targetdebug)
-	    fprintf_unfiltered (gdb_stdlog,
-				"target_follow_fork (%d, %d) = %d\n",
-				follow_child, detach_fork, retval);
-	  return retval;
-	}
-    }
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog,
+			"target_follow_fork (%d, %d) = %d\n",
+			follow_child, detach_fork, retval);
+  return retval;
+}
 
-  /* Some target returned a fork event, but did not know how to follow it.  */
+static void
+default_mourn_inferior (struct target_ops *self)
+{
   internal_error (__FILE__, __LINE__,
-		  _("could not find a target to follow fork"));
+		  _("could not find a target to follow mourn inferior"));
 }
 
 void
 target_mourn_inferior (void)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    {
-      if (t->to_mourn_inferior != NULL)	
-	{
-	  t->to_mourn_inferior (t);
-	  if (targetdebug)
-	    fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n");
-
-          /* We no longer need to keep handles on any of the object files.
-             Make sure to release them to avoid unnecessarily locking any
-             of them while we're not actually debugging.  */
-          bfd_cache_close_all ();
-
-	  return;
-	}
-    }
+  current_target.to_mourn_inferior (&current_target);
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n");
 
-  internal_error (__FILE__, __LINE__,
-		  _("could not find a target to follow mourn inferior"));
+  /* We no longer need to keep handles on any of the object files.
+     Make sure to release them to avoid unnecessarily locking any
+     of them while we're not actually debugging.  */
+  bfd_cache_close_all ();
 }
 
 /* Look for a target which can describe architectural features, starting
@@ -3494,7 +3459,6 @@ init_dummy_target (void)
   dummy_target.to_supports_non_stop = find_default_supports_non_stop;
   dummy_target.to_supports_disable_randomization
     = find_default_supports_disable_randomization;
-  dummy_target.to_pid_to_str = dummy_pid_to_str;
   dummy_target.to_stratum = dummy_stratum;
   dummy_target.to_has_all_memory = (int (*) (struct target_ops *)) return_zero;
   dummy_target.to_has_memory = (int (*) (struct target_ops *)) return_zero;
@@ -3564,19 +3528,9 @@ target_thread_alive (ptid_t ptid)
 void
 target_find_new_threads (void)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    {
-      if (t->to_find_new_threads != NULL)
-	{
-	  t->to_find_new_threads (t);
-	  if (targetdebug)
-	    fprintf_unfiltered (gdb_stdlog, "target_find_new_threads ()\n");
-
-	  return;
-	}
-    }
+  current_target.to_find_new_threads (&current_target);
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog, "target_find_new_threads ()\n");
 }
 
 void
@@ -3759,25 +3713,18 @@ target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
 int
 target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
 {
-  struct target_ops *t;
+  int ret;
 
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_insert_mask_watchpoint != NULL)
-      {
-	int ret;
+  ret = current_target.to_insert_mask_watchpoint (&current_target,
+						  addr, mask, rw);
 
-	ret = t->to_insert_mask_watchpoint (t, addr, mask, rw);
-
-	if (targetdebug)
-	  fprintf_unfiltered (gdb_stdlog, "\
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog, "\
 target_insert_mask_watchpoint (%s, %s, %d) = %d\n",
-			      core_addr_to_string (addr),
-			      core_addr_to_string (mask), rw, ret);
-
-	return ret;
-      }
-
-  return 1;
+			core_addr_to_string (addr),
+			core_addr_to_string (mask), rw, ret);
+  
+  return ret;
 }
 
 /* The documentation for this function is in its prototype declaration in
@@ -3786,25 +3733,18 @@ target_insert_mask_watchpoint (%s, %s, %d) = %d\n",
 int
 target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask, int rw)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_remove_mask_watchpoint != NULL)
-      {
-	int ret;
+  int ret;
 
-	ret = t->to_remove_mask_watchpoint (t, addr, mask, rw);
+  ret = current_target.to_remove_mask_watchpoint (&current_target,
+						  addr, mask, rw);
 
-	if (targetdebug)
-	  fprintf_unfiltered (gdb_stdlog, "\
+  if (targetdebug)
+    fprintf_unfiltered (gdb_stdlog, "\
 target_remove_mask_watchpoint (%s, %s, %d) = %d\n",
-			      core_addr_to_string (addr),
-			      core_addr_to_string (mask), rw, ret);
-
-	return ret;
-      }
+			core_addr_to_string (addr),
+			core_addr_to_string (mask), rw, ret);
 
-  return 1;
+  return ret;
 }
 
 /* The documentation for this function is in its prototype declaration
@@ -3813,13 +3753,8 @@ target_remove_mask_watchpoint (%s, %s, %d) = %d\n",
 int
 target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_masked_watch_num_registers != NULL)
-      return t->to_masked_watch_num_registers (t, addr, mask);
-
-  return -1;
+  return current_target.to_masked_watch_num_registers (&current_target,
+						       addr, mask);
 }
 
 /* The documentation for this function is in its prototype declaration
diff --git a/gdb/target.h b/gdb/target.h
index 75e802c..f83ece1 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -463,9 +463,11 @@ struct target_ops
       TARGET_DEFAULT_RETURN (-1);
 
     int (*to_insert_mask_watchpoint) (struct target_ops *,
-				      CORE_ADDR, CORE_ADDR, int);
+				      CORE_ADDR, CORE_ADDR, int)
+      TARGET_DEFAULT_RETURN (1);
     int (*to_remove_mask_watchpoint) (struct target_ops *,
-				      CORE_ADDR, CORE_ADDR, int);
+				      CORE_ADDR, CORE_ADDR, int)
+      TARGET_DEFAULT_RETURN (1);
     int (*to_stopped_by_watchpoint) (struct target_ops *)
       TARGET_DEFAULT_RETURN (0);
     int to_have_steppable_watchpoint;
@@ -487,7 +489,8 @@ struct target_ops
 					      struct expression *)
       TARGET_DEFAULT_RETURN (0);
     int (*to_masked_watch_num_registers) (struct target_ops *,
-					  CORE_ADDR, CORE_ADDR);
+					  CORE_ADDR, CORE_ADDR)
+      TARGET_DEFAULT_RETURN (-1);
     void (*to_terminal_init) (struct target_ops *)
       TARGET_DEFAULT_IGNORE ();
     void (*to_terminal_inferior) (struct target_ops *)
@@ -500,7 +503,8 @@ struct target_ops
       TARGET_DEFAULT_IGNORE ();
     void (*to_terminal_info) (struct target_ops *, const char *, int)
       TARGET_DEFAULT_FUNC (default_terminal_info);
-    void (*to_kill) (struct target_ops *);
+    void (*to_kill) (struct target_ops *)
+      TARGET_DEFAULT_NORETURN (noprocess ());
     void (*to_load) (struct target_ops *, char *, int)
       TARGET_DEFAULT_NORETURN (tcomplain ());
     void (*to_create_inferior) (struct target_ops *, 
@@ -515,7 +519,8 @@ struct target_ops
       TARGET_DEFAULT_RETURN (1);
     int (*to_remove_vfork_catchpoint) (struct target_ops *, int)
       TARGET_DEFAULT_RETURN (1);
-    int (*to_follow_fork) (struct target_ops *, int, int);
+    int (*to_follow_fork) (struct target_ops *, int, int)
+      TARGET_DEFAULT_FUNC (default_follow_fork);
     int (*to_insert_exec_catchpoint) (struct target_ops *, int)
       TARGET_DEFAULT_RETURN (1);
     int (*to_remove_exec_catchpoint) (struct target_ops *, int)
@@ -525,20 +530,25 @@ struct target_ops
       TARGET_DEFAULT_RETURN (1);
     int (*to_has_exited) (struct target_ops *, int, int, int *)
       TARGET_DEFAULT_RETURN (0);
-    void (*to_mourn_inferior) (struct target_ops *);
+    void (*to_mourn_inferior) (struct target_ops *)
+      TARGET_DEFAULT_FUNC (default_mourn_inferior);
     int (*to_can_run) (struct target_ops *);
 
     /* Documentation of this routine is provided with the corresponding
        target_* macro.  */
-    void (*to_pass_signals) (struct target_ops *, int, unsigned char *);
+    void (*to_pass_signals) (struct target_ops *, int, unsigned char *)
+      TARGET_DEFAULT_IGNORE ();
 
     /* Documentation of this routine is provided with the
        corresponding target_* function.  */
-    void (*to_program_signals) (struct target_ops *, int, unsigned char *);
+    void (*to_program_signals) (struct target_ops *, int, unsigned char *)
+      TARGET_DEFAULT_IGNORE ();
 
     int (*to_thread_alive) (struct target_ops *, ptid_t ptid);
-    void (*to_find_new_threads) (struct target_ops *);
-    char *(*to_pid_to_str) (struct target_ops *, ptid_t);
+    void (*to_find_new_threads) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
+    char *(*to_pid_to_str) (struct target_ops *, ptid_t)
+      TARGET_DEFAULT_FUNC (dummy_pid_to_str);
     char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
       TARGET_DEFAULT_RETURN (0);
     char *(*to_thread_name) (struct target_ops *, struct thread_info *)
-- 
1.8.1.4

  parent reply	other threads:[~2014-01-13 19:13 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 19:12 [RFC 00/32] clean up target delegation Tom Tromey
2014-01-13 19:12 ` [RFC 01/32] add "this" pointers to more target APIs Tom Tromey
2014-01-14 12:10   ` Pedro Alves
2014-01-14 20:25     ` Tom Tromey
2014-01-13 19:12 ` [RFC 03/32] introduce async_callback_ftype Tom Tromey
2014-01-14 10:35   ` Pedro Alves
2014-01-14 10:50     ` Joel Brobecker
2014-01-14 15:06       ` Tom Tromey
2014-01-14 17:19         ` Joel Brobecker
2014-01-14 17:27           ` Tom Tromey
2014-01-14 18:30           ` Pedro Alves
2014-01-14 19:45             ` Tom Tromey
2014-01-15 15:25               ` Tom Tromey
2014-01-13 19:12 ` [RFC 02/32] introduce and use find_target_at Tom Tromey
2014-01-14 11:48   ` [PATCH] Fix "is a record target open" checks Pedro Alves
2014-01-14 15:30     ` Tom Tromey
2014-01-14 18:27       ` Pedro Alves
2014-01-15 16:22     ` Tom Tromey
2014-01-13 19:13 ` [RFC 10/32] Add target_ops argument to to_terminal_init Tom Tromey
2014-01-14 12:51   ` Pedro Alves
2014-01-13 19:13 ` [RFC 31/32] change delegation for to_read_description Tom Tromey
2014-01-14 20:07   ` Pedro Alves
2014-01-14 20:22     ` Tom Tromey
2014-01-13 19:13 ` [RFC 26/32] convert to_static_tracepoint_markers_by_strid Tom Tromey
2014-01-14 18:57   ` Pedro Alves
2014-01-13 19:13 ` [RFC 32/32] minor cleanups to update_current_target Tom Tromey
2014-01-14 20:10   ` Pedro Alves
2014-01-13 19:13 ` [RFC 04/32] add make-target-delegates Tom Tromey
2014-01-14 10:52   ` Pedro Alves
2014-01-14 14:46     ` Tom Tromey
2014-01-13 19:13 ` [RFC 08/32] remove extended_remote_create_inferior_1 Tom Tromey
2014-01-14 12:41   ` Pedro Alves
2014-01-16 19:20     ` Tom Tromey
2014-01-13 19:13 ` [RFC 25/32] convert to_upload_trace_state_variables Tom Tromey
2014-01-14 19:38   ` Pedro Alves
2014-01-13 19:13 ` [RFC 11/32] Add target_ops argument to to_insert_vfork_catchpoint Tom Tromey
2014-01-14 12:52   ` Pedro Alves
2014-01-13 19:13 ` [RFC 09/32] Add target_ops argument to to_close Tom Tromey
2014-01-14 12:48   ` Pedro Alves
2014-01-13 19:13 ` [RFC 12/32] Add target_ops argument to to_thread_name Tom Tromey
2014-01-14 13:03   ` Pedro Alves
2014-01-15 16:45     ` Tom Tromey
2014-01-16 17:50       ` Pedro Alves
2014-01-13 19:13 ` [RFC 24/32] convert to_disable_tracepoint Tom Tromey
2014-01-14 18:49   ` Pedro Alves
2014-01-13 19:13 ` Tom Tromey [this message]
2014-01-14 19:15   ` [RFC 27/32] convert to_insert_mask_watchpoint Pedro Alves
2014-01-14 19:23     ` Tom Tromey
2014-01-13 19:13 ` [RFC 19/32] convert to_detach Tom Tromey
2014-01-14 13:32   ` Pedro Alves
2014-01-13 19:23 ` [RFC 13/32] Add target_ops argument to to_get_ada_task_ptid Tom Tromey
2014-01-14 13:21   ` Pedro Alves
2014-01-13 19:23 ` [RFC 07/32] introduce remote_load Tom Tromey
2014-01-14 12:39   ` Pedro Alves
2014-01-13 19:23 ` [RFC 17/32] Add target_ops argument to to_static_tracepoint_markers_by_strid Tom Tromey
2014-01-14 13:25   ` Pedro Alves
2014-01-13 19:23 ` [RFC 20/32] convert to_remove_watchpoint Tom Tromey
2014-01-14 18:39   ` Pedro Alves
2014-01-14 18:55     ` Tom Tromey
2014-01-14 19:07       ` Tom Tromey
2014-01-14 20:38       ` Pedro Alves
2014-01-14 21:47         ` Tom Tromey
2014-01-13 19:24 ` [RFC 06/32] convert to_supports_btrace Tom Tromey
2014-01-14 12:37   ` Pedro Alves
2014-01-15 16:55     ` Tom Tromey
2014-01-13 19:24 ` [RFC 30/32] convert to_search_memory Tom Tromey
2014-01-14 19:45   ` Pedro Alves
2014-01-14 20:20     ` Tom Tromey
2014-01-13 19:24 ` [RFC 16/32] Add target_ops argument to to_upload_trace_state_variables Tom Tromey
2014-01-14 13:24   ` Pedro Alves
2014-01-13 19:37 ` [RFC 21/32] convert to_load Tom Tromey
2014-01-14 18:41   ` Pedro Alves
2014-01-13 19:38 ` [RFC 05/32] add target method delegation Tom Tromey
2014-01-14 12:32   ` Pedro Alves
2014-01-20 22:00     ` Tom Tromey
2014-01-13 19:38 ` [RFC 22/32] convert to_extra_thread_info Tom Tromey
2014-01-14 18:43   ` Pedro Alves
2014-01-13 19:38 ` [RFC 28/32] convert to_get_section_table Tom Tromey
2014-01-14 19:23   ` Pedro Alves
2014-01-14 19:29     ` Tom Tromey
2014-01-14 19:30       ` Pedro Alves
2014-01-15 16:43         ` Tom Tromey
2014-01-16 17:51           ` Pedro Alves
2014-01-13 19:38 ` [RFC 23/32] convert to_thread_architecture Tom Tromey
2014-01-14 18:46   ` Pedro Alves
2014-01-13 19:38 ` [RFC 18/32] Add target_ops argument to to_save_record Tom Tromey
2014-01-14 13:26   ` Pedro Alves
2014-01-13 19:40 ` [RFC 29/32] convert to_insn_history Tom Tromey
2014-01-14 19:29   ` Pedro Alves
2014-01-13 19:57 ` [RFC 14/32] Add target_ops argument to to_fileio_pwrite Tom Tromey
2014-01-14 13:22   ` Pedro Alves
2014-01-13 19:57 ` [RFC 15/32] Add target_ops argument to to_disable_tracepoint Tom Tromey
2014-01-14 13:23   ` Pedro Alves
2014-01-14 20:31 ` go32 fix Pedro Alves
2014-01-14 21:58   ` Tom Tromey
2014-01-15 12:55 ` [RFC 00/32] clean up target delegation Pedro Alves
2014-01-15 16:11   ` Tom Tromey
2014-01-15 20:05     ` Tom Tromey
2014-01-16 17:33       ` Pedro Alves
2014-01-16 19:09 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389640367-5571-28-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).