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 14/38] Add target_ops argument to to_disable_tracepoint


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

	* target.h (struct target_ops) <to_disable_tracepoint>: Add
	argument.
	(target_disable_tracepoint): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_disable_tracepoint): Add 'self' argument.

Add target_ops argument to to_trace_set_readonly_regions

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

	* target.h (struct target_ops) <to_trace_set_readonly_regions>:
	Add argument.
	(target_trace_set_readonly_regions): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_trace_set_readonly_regions): Add 'self'
	argument.

Add target_ops argument to to_trace_start

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

	* target.h (struct target_ops) <to_trace_start>: Add argument.
	(target_trace_start): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_trace_start): Add 'self' argument.

Add target_ops argument to to_get_trace_status

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

	* tracepoint.c (tfile_get_trace_status): Add 'self' argument.
	* target.h (struct target_ops) <to_get_trace_status>: Add
	argument.
	(target_get_trace_status): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_get_trace_status): Add 'self' argument.
	(remote_start_remote, remote_can_download_tracepoint): Update.
	* ctf.c (ctf_get_trace_status): Add 'self' argument.

Add target_ops argument to to_get_tracepoint_status

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

	* tracepoint.c (tfile_get_tracepoint_status): Add 'self' argument.
	* target.h (struct target_ops) <to_get_tracepoint_status>: Add
	argument.
	(target_get_tracepoint_status): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_get_tracepoint_status): Add 'self' argument.

Add target_ops argument to to_trace_stop

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

	* target.h (struct target_ops) <to_trace_stop>: Add argument.
	(target_trace_stop): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_trace_stop): Add 'self' argument.

Add target_ops argument to to_trace_find

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

	* tracepoint.c (tfile_trace_find): Add 'self' argument.
	* target.h (struct target_ops) <to_trace_find>: Add argument.
	(target_trace_find): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_trace_find): Add 'self' argument.
	* ctf.c (ctf_trace_find): Add 'self' argument.

Add target_ops argument to to_get_trace_state_variable_value

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

	* tracepoint.c (tfile_get_trace_state_variable_value): Add 'self'
	argument.
	* target.h (struct target_ops)
	<to_get_trace_state_variable_value>: Add argument.
	(target_get_trace_state_variable_value): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_get_trace_state_variable_value): Add 'self'
	argument.
	* ctf.c (ctf_get_trace_state_variable_value): Add 'self' argument.

Add target_ops argument to to_save_trace_data

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

	* target.h (struct target_ops) <to_save_trace_data>: Add argument.
	(target_save_trace_data): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_save_trace_data): Add 'self' argument.

Add target_ops argument to to_upload_tracepoints

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

	* target.h (struct target_ops) <to_upload_tracepoints>: Add
	argument.
	(target_upload_tracepoints): Add argument.
	* target.c (update_current_target): Update.
	* remote.c (remote_upload_tracepoints): Add 'self' argument.
	(remote_start_remote): Update.
---
 gdb/ChangeLog    | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/ctf.c        |  7 +++--
 gdb/remote.c     | 37 +++++++++++++-----------
 gdb/target.c     | 22 +++++++-------
 gdb/target.h     | 47 +++++++++++++++++-------------
 gdb/tracepoint.c | 10 ++++---
 6 files changed, 158 insertions(+), 53 deletions(-)

diff --git a/gdb/ctf.c b/gdb/ctf.c
index 6caca5f..67cc1c7 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1503,7 +1503,8 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
    true, otherwise return false.  */
 
 static int
-ctf_get_trace_state_variable_value (int tsvnum, LONGEST *val)
+ctf_get_trace_state_variable_value (struct target_ops *self,
+				    int tsvnum, LONGEST *val)
 {
   struct bt_iter_pos *pos;
   int found = 0;
@@ -1620,7 +1621,7 @@ ctf_get_traceframe_address (void)
    number in it.  Return traceframe number when matched.  */
 
 static int
-ctf_trace_find (enum trace_find_type type, int num,
+ctf_trace_find (struct target_ops *self, enum trace_find_type type, int num,
 		CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
 {
   int ret = -1;
@@ -1824,7 +1825,7 @@ ctf_traceframe_info (void)
    The trace status for a file is that tracing can never be run.  */
 
 static int
-ctf_get_trace_status (struct trace_status *ts)
+ctf_get_trace_status (struct target_ops *self, struct trace_status *ts)
 {
   /* Other bits of trace status were collected as part of opening the
      trace files, so nothing to do here.  */
diff --git a/gdb/remote.c b/gdb/remote.c
index 107fd5b..b7ad654 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -204,9 +204,11 @@ static ptid_t read_ptid (char *buf, char **obuf);
 static void remote_set_permissions (void);
 
 struct remote_state;
-static int remote_get_trace_status (struct trace_status *ts);
+static int remote_get_trace_status (struct target_ops *self,
+				    struct trace_status *ts);
 
-static int remote_upload_tracepoints (struct uploaded_tp **utpp);
+static int remote_upload_tracepoints (struct target_ops *self,
+				      struct uploaded_tp **utpp);
 
 static int remote_upload_trace_state_variables (struct uploaded_tsv **utsvp);
   
@@ -3505,7 +3507,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
   /* Upload TSVs regardless of whether the target is running or not.  The
      remote stub, such as GDBserver, may have some predefined or builtin
      TSVs, even if the target is not running.  */
-  if (remote_get_trace_status (current_trace_status ()) != -1)
+  if (remote_get_trace_status (target, current_trace_status ()) != -1)
     {
       struct uploaded_tsv *uploaded_tsvs = NULL;
 
@@ -3674,14 +3676,14 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
 
   /* Possibly the target has been engaged in a trace run started
      previously; find out where things are at.  */
-  if (remote_get_trace_status (current_trace_status ()) != -1)
+  if (remote_get_trace_status (target, current_trace_status ()) != -1)
     {
       struct uploaded_tp *uploaded_tps = NULL;
 
       if (current_trace_status ()->running)
 	printf_filtered (_("Trace is already running on the target.\n"));
 
-      remote_upload_tracepoints (&uploaded_tps);
+      remote_upload_tracepoints (target, &uploaded_tps);
 
       merge_uploaded_tracepoints (&uploaded_tps);
     }
@@ -10777,7 +10779,7 @@ remote_can_download_tracepoint (struct target_ops *self)
     return 0;
 
   ts = current_trace_status ();
-  status = remote_get_trace_status (ts);
+  status = remote_get_trace_status (self, ts);
 
   if (status == -1 || !ts->running_known || !ts->running)
     return 0;
@@ -10833,7 +10835,8 @@ remote_enable_tracepoint (struct target_ops *self,
 }
 
 static void
-remote_disable_tracepoint (struct bp_location *location)
+remote_disable_tracepoint (struct target_ops *self,
+			   struct bp_location *location)
 {
   struct remote_state *rs = get_remote_state ();
   char addr_buf[40];
@@ -10850,7 +10853,7 @@ remote_disable_tracepoint (struct bp_location *location)
 }
 
 static void
-remote_trace_set_readonly_regions (void)
+remote_trace_set_readonly_regions (struct target_ops *self)
 {
   asection *s;
   bfd *abfd = NULL;
@@ -10900,7 +10903,7 @@ Too many sections for read-only sections definition packet."));
 }
 
 static void
-remote_trace_start (void)
+remote_trace_start (struct target_ops *self)
 {
   putpkt ("QTStart");
   remote_get_noisy_reply (&target_buf, &target_buf_size);
@@ -10911,7 +10914,7 @@ remote_trace_start (void)
 }
 
 static int
-remote_get_trace_status (struct trace_status *ts)
+remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
 {
   /* Initialize it just to avoid a GCC false warning.  */
   char *p = NULL;
@@ -10961,7 +10964,7 @@ remote_get_trace_status (struct trace_status *ts)
 }
 
 static void
-remote_get_tracepoint_status (struct breakpoint *bp,
+remote_get_tracepoint_status (struct target_ops *self, struct breakpoint *bp,
 			      struct uploaded_tp *utp)
 {
   struct remote_state *rs = get_remote_state ();
@@ -11008,7 +11011,7 @@ remote_get_tracepoint_status (struct breakpoint *bp,
 }
 
 static void
-remote_trace_stop (void)
+remote_trace_stop (struct target_ops *self)
 {
   putpkt ("QTStop");
   remote_get_noisy_reply (&target_buf, &target_buf_size);
@@ -11019,7 +11022,8 @@ remote_trace_stop (void)
 }
 
 static int
-remote_trace_find (enum trace_find_type type, int num,
+remote_trace_find (struct target_ops *self,
+		   enum trace_find_type type, int num,
 		   CORE_ADDR addr1, CORE_ADDR addr2,
 		   int *tpp)
 {
@@ -11101,7 +11105,8 @@ remote_trace_find (enum trace_find_type type, int num,
 }
 
 static int
-remote_get_trace_state_variable_value (int tsvnum, LONGEST *val)
+remote_get_trace_state_variable_value (struct target_ops *self,
+				       int tsvnum, LONGEST *val)
 {
   struct remote_state *rs = get_remote_state ();
   char *reply;
@@ -11125,7 +11130,7 @@ remote_get_trace_state_variable_value (int tsvnum, LONGEST *val)
 }
 
 static int
-remote_save_trace_data (const char *filename)
+remote_save_trace_data (struct target_ops *self, const char *filename)
 {
   struct remote_state *rs = get_remote_state ();
   char *p, *reply;
@@ -11837,7 +11842,7 @@ remote_new_objfile (struct objfile *objfile)
    collection.  */
   
 static int
-remote_upload_tracepoints (struct uploaded_tp **utpp)
+remote_upload_tracepoints (struct target_ops *self, struct uploaded_tp **utpp)
 {
   struct remote_state *rs = get_remote_state ();
   char *p;
diff --git a/gdb/target.c b/gdb/target.c
index b7f25ee..71dff46 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -864,34 +864,36 @@ update_current_target (void)
 	    (void (*) (struct target_ops *, struct bp_location *))
 	    tcomplain);
   de_fault (to_disable_tracepoint,
-	    (void (*) (struct bp_location *))
+	    (void (*) (struct target_ops *, struct bp_location *))
 	    tcomplain);
   de_fault (to_trace_set_readonly_regions,
-	    (void (*) (void))
+	    (void (*) (struct target_ops *))
 	    tcomplain);
   de_fault (to_trace_start,
-	    (void (*) (void))
+	    (void (*) (struct target_ops *))
 	    tcomplain);
   de_fault (to_get_trace_status,
-	    (int (*) (struct trace_status *))
+	    (int (*) (struct target_ops *, struct trace_status *))
 	    return_minus_one);
   de_fault (to_get_tracepoint_status,
-	    (void (*) (struct breakpoint *, struct uploaded_tp *))
+	    (void (*) (struct target_ops *, struct breakpoint *,
+		       struct uploaded_tp *))
 	    tcomplain);
   de_fault (to_trace_stop,
-	    (void (*) (void))
+	    (void (*) (struct target_ops *))
 	    tcomplain);
   de_fault (to_trace_find,
-	    (int (*) (enum trace_find_type, int, CORE_ADDR, CORE_ADDR, int *))
+	    (int (*) (struct target_ops *,
+		      enum trace_find_type, int, CORE_ADDR, CORE_ADDR, int *))
 	    return_minus_one);
   de_fault (to_get_trace_state_variable_value,
-	    (int (*) (int, LONGEST *))
+	    (int (*) (struct target_ops *, int, LONGEST *))
 	    return_zero);
   de_fault (to_save_trace_data,
-	    (int (*) (const char *))
+	    (int (*) (struct target_ops *, const char *))
 	    tcomplain);
   de_fault (to_upload_tracepoints,
-	    (int (*) (struct uploaded_tp **))
+	    (int (*) (struct target_ops *, struct uploaded_tp **))
 	    return_zero);
   de_fault (to_upload_trace_state_variables,
 	    (int (*) (struct uploaded_tsv **))
diff --git a/gdb/target.h b/gdb/target.h
index 71454dc..e53c041 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -762,41 +762,46 @@ struct target_ops
 				  struct bp_location *location);
 
     /* Disable a tracepoint on the target.  */
-    void (*to_disable_tracepoint) (struct bp_location *location);
+    void (*to_disable_tracepoint) (struct target_ops *,
+				   struct bp_location *location);
 
     /* Inform the target info of memory regions that are readonly
        (such as text sections), and so it should return data from
        those rather than look in the trace buffer.  */
-    void (*to_trace_set_readonly_regions) (void);
+    void (*to_trace_set_readonly_regions) (struct target_ops *);
 
     /* Start a trace run.  */
-    void (*to_trace_start) (void);
+    void (*to_trace_start) (struct target_ops *);
 
     /* Get the current status of a tracing run.  */
-    int (*to_get_trace_status) (struct trace_status *ts);
+    int (*to_get_trace_status) (struct target_ops *, struct trace_status *ts);
 
-    void (*to_get_tracepoint_status) (struct breakpoint *tp,
+    void (*to_get_tracepoint_status) (struct target_ops *,
+				      struct breakpoint *tp,
 				      struct uploaded_tp *utp);
 
     /* Stop a trace run.  */
-    void (*to_trace_stop) (void);
+    void (*to_trace_stop) (struct target_ops *);
 
    /* Ask the target to find a trace frame of the given type TYPE,
       using NUM, ADDR1, and ADDR2 as search parameters.  Returns the
       number of the trace frame, and also the tracepoint number at
       TPP.  If no trace frame matches, return -1.  May throw if the
       operation fails.  */
-    int (*to_trace_find) (enum trace_find_type type, int num,
+    int (*to_trace_find) (struct target_ops *,
+			  enum trace_find_type type, int num,
 			  CORE_ADDR addr1, CORE_ADDR addr2, int *tpp);
 
     /* Get the value of the trace state variable number TSV, returning
        1 if the value is known and writing the value itself into the
        location pointed to by VAL, else returning 0.  */
-    int (*to_get_trace_state_variable_value) (int tsv, LONGEST *val);
+    int (*to_get_trace_state_variable_value) (struct target_ops *,
+					      int tsv, LONGEST *val);
 
-    int (*to_save_trace_data) (const char *filename);
+    int (*to_save_trace_data) (struct target_ops *, const char *filename);
 
-    int (*to_upload_tracepoints) (struct uploaded_tp **utpp);
+    int (*to_upload_tracepoints) (struct target_ops *,
+				  struct uploaded_tp **utpp);
 
     int (*to_upload_trace_state_variables) (struct uploaded_tsv **utsvp);
 
@@ -1786,34 +1791,36 @@ extern char *target_fileio_read_stralloc (const char *filename);
   (*current_target.to_enable_tracepoint) (&current_target, loc)
 
 #define target_disable_tracepoint(loc) \
-  (*current_target.to_disable_tracepoint) (loc)
+  (*current_target.to_disable_tracepoint) (&current_target, loc)
 
 #define target_trace_start() \
-  (*current_target.to_trace_start) ()
+  (*current_target.to_trace_start) (&current_target)
 
 #define target_trace_set_readonly_regions() \
-  (*current_target.to_trace_set_readonly_regions) ()
+  (*current_target.to_trace_set_readonly_regions) (&current_target)
 
 #define target_get_trace_status(ts) \
-  (*current_target.to_get_trace_status) (ts)
+  (*current_target.to_get_trace_status) (&current_target, ts)
 
 #define target_get_tracepoint_status(tp,utp)		\
-  (*current_target.to_get_tracepoint_status) (tp, utp)
+  (*current_target.to_get_tracepoint_status) (&current_target, tp, utp)
 
 #define target_trace_stop() \
-  (*current_target.to_trace_stop) ()
+  (*current_target.to_trace_stop) (&current_target)
 
 #define target_trace_find(type,num,addr1,addr2,tpp) \
-  (*current_target.to_trace_find) ((type), (num), (addr1), (addr2), (tpp))
+  (*current_target.to_trace_find) (&current_target, \
+				   (type), (num), (addr1), (addr2), (tpp))
 
 #define target_get_trace_state_variable_value(tsv,val) \
-  (*current_target.to_get_trace_state_variable_value) ((tsv), (val))
+  (*current_target.to_get_trace_state_variable_value) (&current_target,	\
+						       (tsv), (val))
 
 #define target_save_trace_data(filename) \
-  (*current_target.to_save_trace_data) (filename)
+  (*current_target.to_save_trace_data) (&current_target, filename)
 
 #define target_upload_tracepoints(utpp) \
-  (*current_target.to_upload_tracepoints) (utpp)
+  (*current_target.to_upload_tracepoints) (&current_target, utpp)
 
 #define target_upload_trace_state_variables(utsvp) \
   (*current_target.to_upload_trace_state_variables) (utsvp)
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index d4937be..a3d5405 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4783,7 +4783,7 @@ tfile_files_info (struct target_ops *t)
 /* The trace status for a file is that tracing can never be run.  */
 
 static int
-tfile_get_trace_status (struct trace_status *ts)
+tfile_get_trace_status (struct target_ops *self, struct trace_status *ts)
 {
   /* Other bits of trace status were collected as part of opening the
      trace files, so nothing to do here.  */
@@ -4792,7 +4792,8 @@ tfile_get_trace_status (struct trace_status *ts)
 }
 
 static void
-tfile_get_tracepoint_status (struct breakpoint *tp, struct uploaded_tp *utp)
+tfile_get_tracepoint_status (struct target_ops *self,
+			     struct breakpoint *tp, struct uploaded_tp *utp)
 {
   /* Other bits of trace status were collected as part of opening the
      trace files, so nothing to do here.  */
@@ -4837,7 +4838,7 @@ tfile_get_traceframe_address (off_t tframe_offset)
    each.  */
 
 static int
-tfile_trace_find (enum trace_find_type type, int num,
+tfile_trace_find (struct target_ops *self, enum trace_find_type type, int num,
 		  CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
 {
   short tpnum;
@@ -5206,7 +5207,8 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object,
    block with a matching tsv number.  */
 
 static int
-tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val)
+tfile_get_trace_state_variable_value (struct target_ops *self,
+				      int tsvnum, LONGEST *val)
 {
   int pos;
   int found = 0;
-- 
1.8.1.4


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