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 v2 22/38] convert to_thread_architecture


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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_thread_architecture.
	* target.h (struct target_ops) <to_thread_architecture>: Use
	TARGET_DEFAULT_FUNC.

convert to_get_ada_task_ptid

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_get_ada_task_ptid.
	* target.h (struct target_ops) <to_get_ada_task_ptid>: Use
	TARGET_DEFAULT_FUNC.

convert to_supports_multi_process

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_supports_multi_process.
	* target.h (struct target_ops) <to_supports_multi_process>: Use
	TARGET_DEFAULT_RETURN.

convert to_supports_enable_disable_tracepoint

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_supports_enable_disable_tracepoint.
	* target.h (struct target_ops)
	<to_supports_enable_disable_tracepoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_supports_string_tracing

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_supports_string_tracing.
	* target.h (struct target_ops) <to_supports_string_tracing>: Use
	TARGET_DEFAULT_RETURN.

convert to_trace_init

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_trace_init.
	* target.h (struct target_ops) <to_trace_init>: Use
	TARGET_DEFAULT_RETURN.

convert to_download_tracepoint

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_download_tracepoint.
	* target.h (struct target_ops) <to_download_tracepoint>: Use
	TARGET_DEFAULT_NORETURN.

convert to_can_download_tracepoint

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_can_download_tracepoint.
	* target.h (struct target_ops) <to_can_download_tracepoint>: Use
	TARGET_DEFAULT_RETURN.

convert to_download_trace_state_variable

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_download_trace_state_variable.
	* target.h (struct target_ops) <to_download_trace_state_variable>:
	Use TARGET_DEFAULT_NORETURN.

convert to_enable_tracepoint

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

	* target-delegates.c: Rebuild.
	* target.c (update_current_target): Don't inherit or default
	to_enable_tracepoint.
	* target.h (struct target_ops) <to_enable_tracepoint>: Use
	TARGET_DEFAULT_NORETURN.
---
 gdb/ChangeLog          |  81 +++++++++++++++++++++++++++
 gdb/target-delegates.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/target.c           |  52 +++++------------
 gdb/target.h           |  30 ++++++----
 4 files changed, 262 insertions(+), 49 deletions(-)

diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 13e547d..358a64b 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -564,6 +564,13 @@ tdefault_xfer_partial (struct target_ops *self, enum target_object  arg1, const
   return -1;
 }
 
+static ptid_t
+delegate_get_ada_task_ptid (struct target_ops *self, long arg1, long arg2)
+{
+  self = self->beneath;
+  return self->to_get_ada_task_ptid (self, arg1, arg2);
+}
+
 static int
 delegate_can_execute_reverse (struct target_ops *self)
 {
@@ -585,6 +592,117 @@ delegate_execution_direction (struct target_ops *self)
 }
 
 static int
+delegate_supports_multi_process (struct target_ops *self)
+{
+  self = self->beneath;
+  return self->to_supports_multi_process (self);
+}
+
+static int
+tdefault_supports_multi_process (struct target_ops *self)
+{
+  return 0;
+}
+
+static int
+delegate_supports_enable_disable_tracepoint (struct target_ops *self)
+{
+  self = self->beneath;
+  return self->to_supports_enable_disable_tracepoint (self);
+}
+
+static int
+tdefault_supports_enable_disable_tracepoint (struct target_ops *self)
+{
+  return 0;
+}
+
+static int
+delegate_supports_string_tracing (struct target_ops *self)
+{
+  self = self->beneath;
+  return self->to_supports_string_tracing (self);
+}
+
+static int
+tdefault_supports_string_tracing (struct target_ops *self)
+{
+  return 0;
+}
+
+static struct gdbarch *
+delegate_thread_architecture (struct target_ops *self, ptid_t arg1)
+{
+  self = self->beneath;
+  return self->to_thread_architecture (self, arg1);
+}
+
+static void
+delegate_trace_init (struct target_ops *self)
+{
+  self = self->beneath;
+  self->to_trace_init (self);
+}
+
+static void
+tdefault_trace_init (struct target_ops *self)
+{
+  tcomplain ();
+}
+
+static void
+delegate_download_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+  self = self->beneath;
+  self->to_download_tracepoint (self, arg1);
+}
+
+static void
+tdefault_download_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+  tcomplain ();
+}
+
+static int
+delegate_can_download_tracepoint (struct target_ops *self)
+{
+  self = self->beneath;
+  return self->to_can_download_tracepoint (self);
+}
+
+static int
+tdefault_can_download_tracepoint (struct target_ops *self)
+{
+  return 0;
+}
+
+static void
+delegate_download_trace_state_variable (struct target_ops *self, struct trace_state_variable *arg1)
+{
+  self = self->beneath;
+  self->to_download_trace_state_variable (self, arg1);
+}
+
+static void
+tdefault_download_trace_state_variable (struct target_ops *self, struct trace_state_variable *arg1)
+{
+  tcomplain ();
+}
+
+static void
+delegate_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+  self = self->beneath;
+  self->to_enable_tracepoint (self, arg1);
+}
+
+static void
+tdefault_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+  tcomplain ();
+}
+
+static int
 delegate_supports_btrace (struct target_ops *self)
 {
   self = self->beneath;
@@ -698,10 +816,30 @@ install_delegators (struct target_ops *ops)
     ops->to_goto_bookmark = delegate_goto_bookmark;
   if (ops->to_xfer_partial == NULL)
     ops->to_xfer_partial = delegate_xfer_partial;
+  if (ops->to_get_ada_task_ptid == NULL)
+    ops->to_get_ada_task_ptid = delegate_get_ada_task_ptid;
   if (ops->to_can_execute_reverse == NULL)
     ops->to_can_execute_reverse = delegate_can_execute_reverse;
   if (ops->to_execution_direction == NULL)
     ops->to_execution_direction = delegate_execution_direction;
+  if (ops->to_supports_multi_process == NULL)
+    ops->to_supports_multi_process = delegate_supports_multi_process;
+  if (ops->to_supports_enable_disable_tracepoint == NULL)
+    ops->to_supports_enable_disable_tracepoint = delegate_supports_enable_disable_tracepoint;
+  if (ops->to_supports_string_tracing == NULL)
+    ops->to_supports_string_tracing = delegate_supports_string_tracing;
+  if (ops->to_thread_architecture == NULL)
+    ops->to_thread_architecture = delegate_thread_architecture;
+  if (ops->to_trace_init == NULL)
+    ops->to_trace_init = delegate_trace_init;
+  if (ops->to_download_tracepoint == NULL)
+    ops->to_download_tracepoint = delegate_download_tracepoint;
+  if (ops->to_can_download_tracepoint == NULL)
+    ops->to_can_download_tracepoint = delegate_can_download_tracepoint;
+  if (ops->to_download_trace_state_variable == NULL)
+    ops->to_download_trace_state_variable = delegate_download_trace_state_variable;
+  if (ops->to_enable_tracepoint == NULL)
+    ops->to_enable_tracepoint = delegate_enable_tracepoint;
   if (ops->to_supports_btrace == NULL)
     ops->to_supports_btrace = delegate_supports_btrace;
 }
@@ -758,7 +896,17 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_get_bookmark = tdefault_get_bookmark;
   ops->to_goto_bookmark = tdefault_goto_bookmark;
   ops->to_xfer_partial = tdefault_xfer_partial;
+  ops->to_get_ada_task_ptid = default_get_ada_task_ptid;
   ops->to_can_execute_reverse = tdefault_can_execute_reverse;
   ops->to_execution_direction = default_execution_direction;
+  ops->to_supports_multi_process = tdefault_supports_multi_process;
+  ops->to_supports_enable_disable_tracepoint = tdefault_supports_enable_disable_tracepoint;
+  ops->to_supports_string_tracing = tdefault_supports_string_tracing;
+  ops->to_thread_architecture = default_thread_architecture;
+  ops->to_trace_init = tdefault_trace_init;
+  ops->to_download_tracepoint = tdefault_download_tracepoint;
+  ops->to_can_download_tracepoint = tdefault_can_download_tracepoint;
+  ops->to_download_trace_state_variable = tdefault_download_trace_state_variable;
+  ops->to_enable_tracepoint = tdefault_enable_tracepoint;
   ops->to_supports_btrace = tdefault_supports_btrace;
 }
diff --git a/gdb/target.c b/gdb/target.c
index b657900..2efd21f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -57,6 +57,9 @@ static int default_region_ok_for_hw_watchpoint (struct target_ops *,
 
 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 void tcomplain (void) ATTRIBUTE_NORETURN;
 
 static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
@@ -678,18 +681,18 @@ update_current_target (void)
       /* Do not inherit to_get_thread_local_address.  */
       /* Do not inherit to_can_execute_reverse.  */
       /* Do not inherit to_execution_direction.  */
-      INHERIT (to_thread_architecture, t);
+      /* Do not inherit to_thread_architecture.  */
       /* Do not inherit to_read_description.  */
-      INHERIT (to_get_ada_task_ptid, t);
+      /* Do not inherit to_get_ada_task_ptid.  */
       /* Do not inherit to_search_memory.  */
-      INHERIT (to_supports_multi_process, t);
-      INHERIT (to_supports_enable_disable_tracepoint, t);
-      INHERIT (to_supports_string_tracing, t);
-      INHERIT (to_trace_init, t);
-      INHERIT (to_download_tracepoint, t);
-      INHERIT (to_can_download_tracepoint, t);
-      INHERIT (to_download_trace_state_variable, t);
-      INHERIT (to_enable_tracepoint, t);
+      /* Do not inherit to_supports_multi_process.  */
+      /* Do not inherit to_supports_enable_disable_tracepoint.  */
+      /* Do not inherit to_supports_string_tracing.  */
+      /* Do not inherit to_trace_init.  */
+      /* Do not inherit to_download_tracepoint.  */
+      /* Do not inherit to_can_download_tracepoint.  */
+      /* Do not inherit to_download_trace_state_variable.  */
+      /* Do not inherit to_enable_tracepoint.  */
       INHERIT (to_disable_tracepoint, t);
       INHERIT (to_trace_set_readonly_regions, t);
       INHERIT (to_trace_start, t);
@@ -748,36 +751,7 @@ update_current_target (void)
   de_fault (to_stop,
 	    (void (*) (struct target_ops *, ptid_t))
 	    target_ignore);
-  de_fault (to_thread_architecture,
-	    default_thread_architecture);
   current_target.to_read_description = NULL;
-  de_fault (to_get_ada_task_ptid,
-            (ptid_t (*) (struct target_ops *, long, long))
-            default_get_ada_task_ptid);
-  de_fault (to_supports_multi_process,
-	    (int (*) (struct target_ops *))
-	    return_zero);
-  de_fault (to_supports_enable_disable_tracepoint,
-	    (int (*) (struct target_ops *))
-	    return_zero);
-  de_fault (to_supports_string_tracing,
-	    (int (*) (struct target_ops *))
-	    return_zero);
-  de_fault (to_trace_init,
-	    (void (*) (struct target_ops *))
-	    tcomplain);
-  de_fault (to_download_tracepoint,
-	    (void (*) (struct target_ops *, struct bp_location *))
-	    tcomplain);
-  de_fault (to_can_download_tracepoint,
-	    (int (*) (struct target_ops *))
-	    return_zero);
-  de_fault (to_download_trace_state_variable,
-	    (void (*) (struct target_ops *, struct trace_state_variable *))
-	    tcomplain);
-  de_fault (to_enable_tracepoint,
-	    (void (*) (struct target_ops *, struct bp_location *))
-	    tcomplain);
   de_fault (to_disable_tracepoint,
 	    (void (*) (struct target_ops *, struct bp_location *))
 	    tcomplain);
diff --git a/gdb/target.h b/gdb/target.h
index 625968c..bd76453 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -667,7 +667,8 @@ struct target_ops
        task Private_Data section of the Ada Task Control Block, and
        their interpretation depends on the target.  */
     ptid_t (*to_get_ada_task_ptid) (struct target_ops *,
-				    long lwp, long thread);
+				    long lwp, long thread)
+      TARGET_DEFAULT_FUNC (default_get_ada_task_ptid);
 
     /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
        Return 0 if *READPTR is already at the end of the buffer.
@@ -699,17 +700,20 @@ struct target_ops
 
     /* Does this target support debugging multiple processes
        simultaneously?  */
-    int (*to_supports_multi_process) (struct target_ops *);
+    int (*to_supports_multi_process) (struct target_ops *)
+      TARGET_DEFAULT_RETURN (0);
 
     /* Does this target support enabling and disabling tracepoints while a trace
        experiment is running?  */
-    int (*to_supports_enable_disable_tracepoint) (struct target_ops *);
+    int (*to_supports_enable_disable_tracepoint) (struct target_ops *)
+      TARGET_DEFAULT_RETURN (0);
 
     /* Does this target support disabling address space randomization?  */
     int (*to_supports_disable_randomization) (struct target_ops *);
 
     /* Does this target support the tracenz bytecode for string collection?  */
-    int (*to_supports_string_tracing) (struct target_ops *);
+    int (*to_supports_string_tracing) (struct target_ops *)
+      TARGET_DEFAULT_RETURN (0);
 
     /* Does this target support evaluation of breakpoint conditions on its
        end?  */
@@ -729,7 +733,8 @@ struct target_ops
        ptrace operations need to operate according to target_gdbarch ().
 
        The default implementation always returns target_gdbarch ().  */
-    struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t);
+    struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t)
+      TARGET_DEFAULT_FUNC (default_thread_architecture);
 
     /* Determine current address space of thread PTID.
 
@@ -783,23 +788,28 @@ struct target_ops
     /* Tracepoint-related operations.  */
 
     /* Prepare the target for a tracing run.  */
-    void (*to_trace_init) (struct target_ops *);
+    void (*to_trace_init) (struct target_ops *)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Send full details of a tracepoint location to the target.  */
     void (*to_download_tracepoint) (struct target_ops *,
-				    struct bp_location *location);
+				    struct bp_location *location)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Is the target able to download tracepoint locations in current
        state?  */
-    int (*to_can_download_tracepoint) (struct target_ops *);
+    int (*to_can_download_tracepoint) (struct target_ops *)
+      TARGET_DEFAULT_RETURN (0);
 
     /* Send full details of a trace state variable to the target.  */
     void (*to_download_trace_state_variable) (struct target_ops *,
-					      struct trace_state_variable *tsv);
+					      struct trace_state_variable *tsv)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Enable a tracepoint on the target.  */
     void (*to_enable_tracepoint) (struct target_ops *,
-				  struct bp_location *location);
+				  struct bp_location *location)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Disable a tracepoint on the target.  */
     void (*to_disable_tracepoint) (struct target_ops *,
-- 
1.8.1.4


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