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]

Re: [RFC 15/32] Add target_ops argument to to_disable_tracepoint


Looks fine.

On 01/13/2014 07:12 PM, Tom Tromey wrote:
> 2014-01-08  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-01-08  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-01-08  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-01-08  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-01-08  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-01-08  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-01-08  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-01-08  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-01-08  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-01-08  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 239afb2..db6032b 100644
> --- a/gdb/ctf.c
> +++ b/gdb/ctf.c
> @@ -1489,7 +1489,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;
> @@ -1606,7 +1607,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;
> @@ -1801,7 +1802,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 b81501d..8ad8409 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -205,9 +205,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);
>    
> @@ -3481,7 +3483,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;
>  
> @@ -3625,14 +3627,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);
>      }
> @@ -10722,7 +10724,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;
> @@ -10778,7 +10780,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];
> @@ -10795,7 +10798,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;
> @@ -10845,7 +10848,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);
> @@ -10856,7 +10859,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;
> @@ -10906,7 +10909,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 ();
> @@ -10953,7 +10956,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);
> @@ -10964,7 +10967,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)
>  {
> @@ -11046,7 +11050,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;
> @@ -11070,7 +11075,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;
> @@ -11779,7 +11784,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 0ef4cdc..74e79cc 100644
> --- a/gdb/target.c
> +++ b/gdb/target.c
> @@ -860,34 +860,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 31a4ce9..e8a2997 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -757,41 +757,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);
>  
> @@ -1759,34 +1764,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 a09bf37..0fde73c 100644
> --- a/gdb/tracepoint.c
> +++ b/gdb/tracepoint.c
> @@ -4773,7 +4773,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.  */
> @@ -4782,7 +4782,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.  */
> @@ -4827,7 +4828,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;
> @@ -5186,7 +5187,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;
> 


-- 
Pedro Alves


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