This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 27/32] convert to_insert_mask_watchpoint


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]