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 16/32] Add target_ops argument to to_upload_trace_state_variables


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_upload_trace_state_variables>:
> 	Add argument.
> 	(target_upload_trace_state_variables): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_upload_trace_state_variables): Add 'self'
> 	argument.
> 	(remote_start_remote): Update.
> 
> Add target_ops argument to to_get_raw_trace_data
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops) <to_get_raw_trace_data>: Add
> 	argument.
> 	(target_get_raw_trace_data): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_get_raw_trace_data): Add 'self' argument.
> 
> Add target_ops argument to to_get_min_fast_tracepoint_insn_len
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops)
> 	<to_get_min_fast_tracepoint_insn_len>: Add argument.
> 	(target_get_min_fast_tracepoint_insn_len): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_get_min_fast_tracepoint_insn_len): Add 'self'
> 	argument.
> 
> Add target_ops argument to to_set_disconnected_tracing
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops) <to_set_disconnected_tracing>: Add
> 	argument.
> 	(target_set_disconnected_tracing): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_set_disconnected_tracing): Add 'self' argument.
> 
> Add target_ops argument to to_set_circular_trace_buffer
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops) <to_set_circular_trace_buffer>: Add
> 	argument.
> 	(target_set_circular_trace_buffer): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_set_circular_trace_buffer): Add 'self'
> 	argument.
> 
> Add target_ops argument to to_set_trace_buffer_size
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops) <to_set_trace_buffer_size>: Add
> 	argument.
> 	(target_set_trace_buffer_size): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_set_trace_buffer_size): Add 'self' argument.
> 
> Add target_ops argument to to_set_trace_notes
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops) <to_set_trace_notes>: Add argument.
> 	(target_set_trace_notes): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_set_trace_notes): Add 'self' argument.
> 
> Add target_ops argument to to_get_tib_address
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* windows-nat.c (windows_get_tib_address): Add 'self' argument.
> 	* target.h (struct target_ops) <to_get_tib_address>: Add argument.
> 	(target_get_tib_address): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_get_tib_address): Add 'self' argument.
> 
> Add target_ops argument to to_set_permissions
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops) <to_set_permissions>: Add argument.
> 	(target_set_permissions): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_set_permissions): Add 'self' argument.
> 	(remote_start_remote): Update.
> 
> Add target_ops argument to to_static_tracepoint_marker_at
> 
> 2014-01-08  Tom Tromey  <tromey@redhat.com>
> 
> 	* target.h (struct target_ops) <to_static_tracepoint_marker_at>:
> 	Add argument.
> 	(target_static_tracepoint_marker_at): Add argument.
> 	* target.c (update_current_target): Update.
> 	* remote.c (remote_static_tracepoint_marker_at): Add 'self'
> 	argument.
> ---
>  gdb/ChangeLog     | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  gdb/remote.c      | 32 +++++++++++----------
>  gdb/target.c      | 22 ++++++++-------
>  gdb/target.h      | 46 +++++++++++++++++-------------
>  gdb/windows-nat.c |  3 +-
>  5 files changed, 142 insertions(+), 45 deletions(-)
> 
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 8ad8409..c7cb2d3 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -202,7 +202,7 @@ static void show_remote_protocol_packet_cmd (struct ui_file *file,
>  static char *write_ptid (char *buf, const char *endbuf, ptid_t ptid);
>  static ptid_t read_ptid (char *buf, char **obuf);
>  
> -static void remote_set_permissions (void);
> +static void remote_set_permissions (struct target_ops *self);
>  
>  struct remote_state;
>  static int remote_get_trace_status (struct target_ops *self,
> @@ -211,7 +211,8 @@ static int remote_get_trace_status (struct target_ops *self,
>  static int remote_upload_tracepoints (struct target_ops *self,
>  				      struct uploaded_tp **utpp);
>  
> -static int remote_upload_trace_state_variables (struct uploaded_tsv **utsvp);
> +static int remote_upload_trace_state_variables (struct target_ops *self,
> +						struct uploaded_tsv **utsvp);
>    
>  static void remote_query_supported (void);
>  
> @@ -2947,7 +2948,7 @@ remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
>  
>  
>  static int
> -remote_static_tracepoint_marker_at (CORE_ADDR addr,
> +remote_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR addr,
>  				    struct static_tracepoint_marker *marker)
>  {
>    struct remote_state *rs = get_remote_state ();
> @@ -3400,7 +3401,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
>  
>    /* If the stub wants to get a QAllow, compose one and send it.  */
>    if (remote_protocol_packets[PACKET_QAllow].support != PACKET_DISABLE)
> -    remote_set_permissions ();
> +    remote_set_permissions (target);
>  
>    /* Next, we possibly activate noack mode.
>  
> @@ -3487,7 +3488,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
>      {
>        struct uploaded_tsv *uploaded_tsvs = NULL;
>  
> -      remote_upload_trace_state_variables (&uploaded_tsvs);
> +      remote_upload_trace_state_variables (target, &uploaded_tsvs);
>        merge_uploaded_trace_state_variables (&uploaded_tsvs);
>      }
>  
> @@ -3775,7 +3776,7 @@ remote_serial_open (char *name)
>     permissions.  */
>  
>  void
> -remote_set_permissions (void)
> +remote_set_permissions (struct target_ops *self)
>  {
>    struct remote_state *rs = get_remote_state ();
>  
> @@ -9454,7 +9455,7 @@ remote_get_thread_local_address (struct target_ops *ops,
>     Returns 1 if ptid is found and thread_local_base is non zero.  */
>  
>  static int
> -remote_get_tib_address (ptid_t ptid, CORE_ADDR *addr)
> +remote_get_tib_address (struct target_ops *self, ptid_t ptid, CORE_ADDR *addr)
>  {
>    if (remote_protocol_packets[PACKET_qGetTIBAddr].support != PACKET_DISABLE)
>      {
> @@ -11102,7 +11103,8 @@ remote_save_trace_data (struct target_ops *self, const char *filename)
>     not be unhappy if we don't get as much as we ask for.  */
>  
>  static LONGEST
> -remote_get_raw_trace_data (gdb_byte *buf, ULONGEST offset, LONGEST len)
> +remote_get_raw_trace_data (struct target_ops *self,
> +			   gdb_byte *buf, ULONGEST offset, LONGEST len)
>  {
>    struct remote_state *rs = get_remote_state ();
>    char *reply;
> @@ -11140,7 +11142,7 @@ remote_get_raw_trace_data (gdb_byte *buf, ULONGEST offset, LONGEST len)
>  }
>  
>  static void
> -remote_set_disconnected_tracing (int val)
> +remote_set_disconnected_tracing (struct target_ops *self, int val)
>  {
>    struct remote_state *rs = get_remote_state ();
>  
> @@ -11171,7 +11173,7 @@ remote_core_of_thread (struct target_ops *ops, ptid_t ptid)
>  }
>  
>  static void
> -remote_set_circular_trace_buffer (int val)
> +remote_set_circular_trace_buffer (struct target_ops *self, int val)
>  {
>    struct remote_state *rs = get_remote_state ();
>    char *reply;
> @@ -11216,7 +11218,7 @@ remote_traceframe_info (void)
>     length is unknown.  */
>  
>  static int
> -remote_get_min_fast_tracepoint_insn_len (void)
> +remote_get_min_fast_tracepoint_insn_len (struct target_ops *self)
>  {
>    struct remote_state *rs = get_remote_state ();
>    char *reply;
> @@ -11245,7 +11247,7 @@ remote_get_min_fast_tracepoint_insn_len (void)
>  }
>  
>  static void
> -remote_set_trace_buffer_size (LONGEST val)
> +remote_set_trace_buffer_size (struct target_ops *self, LONGEST val)
>  {
>    if (remote_protocol_packets[PACKET_QTBuffer_size].support
>        != PACKET_DISABLE)
> @@ -11277,7 +11279,8 @@ remote_set_trace_buffer_size (LONGEST val)
>  }
>  
>  static int
> -remote_set_trace_notes (const char *user, const char *notes,
> +remote_set_trace_notes (struct target_ops *self,
> +			const char *user, const char *notes,
>  			const char *stop_notes)
>  {
>    struct remote_state *rs = get_remote_state ();
> @@ -11805,7 +11808,8 @@ remote_upload_tracepoints (struct target_ops *self, struct uploaded_tp **utpp)
>  }
>  
>  static int
> -remote_upload_trace_state_variables (struct uploaded_tsv **utsvp)
> +remote_upload_trace_state_variables (struct target_ops *self,
> +				     struct uploaded_tsv **utsvp)
>  {
>    struct remote_state *rs = get_remote_state ();
>    char *p;
> diff --git a/gdb/target.c b/gdb/target.c
> index 74e79cc..35ce7e8 100644
> --- a/gdb/target.c
> +++ b/gdb/target.c
> @@ -892,34 +892,36 @@ update_current_target (void)
>  	    (int (*) (struct target_ops *, struct uploaded_tp **))
>  	    return_zero);
>    de_fault (to_upload_trace_state_variables,
> -	    (int (*) (struct uploaded_tsv **))
> +	    (int (*) (struct target_ops *, struct uploaded_tsv **))
>  	    return_zero);
>    de_fault (to_get_raw_trace_data,
> -	    (LONGEST (*) (gdb_byte *, ULONGEST, LONGEST))
> +	    (LONGEST (*) (struct target_ops *, gdb_byte *, ULONGEST, LONGEST))
>  	    tcomplain);
>    de_fault (to_get_min_fast_tracepoint_insn_len,
> -	    (int (*) (void))
> +	    (int (*) (struct target_ops *))
>  	    return_minus_one);
>    de_fault (to_set_disconnected_tracing,
> -	    (void (*) (int))
> +	    (void (*) (struct target_ops *, int))
>  	    target_ignore);
>    de_fault (to_set_circular_trace_buffer,
> -	    (void (*) (int))
> +	    (void (*) (struct target_ops *, int))
>  	    target_ignore);
>    de_fault (to_set_trace_buffer_size,
> -	    (void (*) (LONGEST))
> +	    (void (*) (struct target_ops *, LONGEST))
>  	    target_ignore);
>    de_fault (to_set_trace_notes,
> -	    (int (*) (const char *, const char *, const char *))
> +	    (int (*) (struct target_ops *,
> +		      const char *, const char *, const char *))
>  	    return_zero);
>    de_fault (to_get_tib_address,
> -	    (int (*) (ptid_t, CORE_ADDR *))
> +	    (int (*) (struct target_ops *, ptid_t, CORE_ADDR *))
>  	    tcomplain);
>    de_fault (to_set_permissions,
> -	    (void (*) (void))
> +	    (void (*) (struct target_ops *))
>  	    target_ignore);
>    de_fault (to_static_tracepoint_marker_at,
> -	    (int (*) (CORE_ADDR, struct static_tracepoint_marker *))
> +	    (int (*) (struct target_ops *,
> +		      CORE_ADDR, struct static_tracepoint_marker *))
>  	    return_zero);
>    de_fault (to_static_tracepoint_markers_by_strid,
>  	    (VEC(static_tracepoint_marker_p) * (*) (const char *))
> diff --git a/gdb/target.h b/gdb/target.h
> index e8a2997..2a17b02 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -798,27 +798,29 @@ struct target_ops
>      int (*to_upload_tracepoints) (struct target_ops *,
>  				  struct uploaded_tp **utpp);
>  
> -    int (*to_upload_trace_state_variables) (struct uploaded_tsv **utsvp);
> +    int (*to_upload_trace_state_variables) (struct target_ops *,
> +					    struct uploaded_tsv **utsvp);
>  
> -    LONGEST (*to_get_raw_trace_data) (gdb_byte *buf,
> +    LONGEST (*to_get_raw_trace_data) (struct target_ops *, gdb_byte *buf,
>  				      ULONGEST offset, LONGEST len);
>  
>      /* Get the minimum length of instruction on which a fast tracepoint
>         may be set on the target.  If this operation is unsupported,
>         return -1.  If for some reason the minimum length cannot be
>         determined, return 0.  */
> -    int (*to_get_min_fast_tracepoint_insn_len) (void);
> +    int (*to_get_min_fast_tracepoint_insn_len) (struct target_ops *);
>  
>      /* Set the target's tracing behavior in response to unexpected
>         disconnection - set VAL to 1 to keep tracing, 0 to stop.  */
> -    void (*to_set_disconnected_tracing) (int val);
> -    void (*to_set_circular_trace_buffer) (int val);
> +    void (*to_set_disconnected_tracing) (struct target_ops *, int val);
> +    void (*to_set_circular_trace_buffer) (struct target_ops *, int val);
>      /* Set the size of trace buffer in the target.  */
> -    void (*to_set_trace_buffer_size) (LONGEST val);
> +    void (*to_set_trace_buffer_size) (struct target_ops *, LONGEST val);
>  
>      /* Add/change textual notes about the trace run, returning 1 if
>         successful, 0 otherwise.  */
> -    int (*to_set_trace_notes) (const char *user, const char *notes,
> +    int (*to_set_trace_notes) (struct target_ops *,
> +			       const char *user, const char *notes,
>  			       const char *stopnotes);
>  
>      /* Return the processor core that thread PTID was last seen on.
> @@ -839,14 +841,15 @@ struct target_ops
>  
>      /* Return the address of the start of the Thread Information Block
>         a Windows OS specific feature.  */
> -    int (*to_get_tib_address) (ptid_t ptid, CORE_ADDR *addr);
> +    int (*to_get_tib_address) (struct target_ops *,
> +			       ptid_t ptid, CORE_ADDR *addr);
>  
>      /* Send the new settings of write permission variables.  */
> -    void (*to_set_permissions) (void);
> +    void (*to_set_permissions) (struct target_ops *);
>  
>      /* Look for a static tracepoint marker at ADDR, and fill in MARKER
>         with its details.  Return 1 on success, 0 on failure.  */
> -    int (*to_static_tracepoint_marker_at) (CORE_ADDR,
> +    int (*to_static_tracepoint_marker_at) (struct target_ops *, CORE_ADDR,
>  					   struct static_tracepoint_marker *marker);
>  
>      /* Return a vector of all tracepoints markers string id ID, or all
> @@ -1796,34 +1799,37 @@ extern char *target_fileio_read_stralloc (const char *filename);
>    (*current_target.to_upload_tracepoints) (&current_target, utpp)
>  
>  #define target_upload_trace_state_variables(utsvp) \
> -  (*current_target.to_upload_trace_state_variables) (utsvp)
> +  (*current_target.to_upload_trace_state_variables) (&current_target, utsvp)
>  
>  #define target_get_raw_trace_data(buf,offset,len) \
> -  (*current_target.to_get_raw_trace_data) ((buf), (offset), (len))
> +  (*current_target.to_get_raw_trace_data) (&current_target,	\
> +					   (buf), (offset), (len))
>  
>  #define target_get_min_fast_tracepoint_insn_len() \
> -  (*current_target.to_get_min_fast_tracepoint_insn_len) ()
> +  (*current_target.to_get_min_fast_tracepoint_insn_len) (&current_target)
>  
>  #define target_set_disconnected_tracing(val) \
> -  (*current_target.to_set_disconnected_tracing) (val)
> +  (*current_target.to_set_disconnected_tracing) (&current_target, val)
>  
>  #define	target_set_circular_trace_buffer(val)	\
> -  (*current_target.to_set_circular_trace_buffer) (val)
> +  (*current_target.to_set_circular_trace_buffer) (&current_target, val)
>  
>  #define	target_set_trace_buffer_size(val)	\
> -  (*current_target.to_set_trace_buffer_size) (val)
> +  (*current_target.to_set_trace_buffer_size) (&current_target, val)
>  
>  #define	target_set_trace_notes(user,notes,stopnotes)		\
> -  (*current_target.to_set_trace_notes) ((user), (notes), (stopnotes))
> +  (*current_target.to_set_trace_notes) (&current_target,	\
> +					(user), (notes), (stopnotes))
>  
>  #define target_get_tib_address(ptid, addr) \
> -  (*current_target.to_get_tib_address) ((ptid), (addr))
> +  (*current_target.to_get_tib_address) (&current_target, (ptid), (addr))
>  
>  #define target_set_permissions() \
> -  (*current_target.to_set_permissions) ()
> +  (*current_target.to_set_permissions) (&current_target)
>  
>  #define target_static_tracepoint_marker_at(addr, marker) \
> -  (*current_target.to_static_tracepoint_marker_at) (addr, marker)
> +  (*current_target.to_static_tracepoint_marker_at) (&current_target,	\
> +						    addr, marker)
>  
>  #define target_static_tracepoint_markers_by_strid(marker_id) \
>    (*current_target.to_static_tracepoint_markers_by_strid) (marker_id)
> diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
> index c3982f1..6e28b6e 100644
> --- a/gdb/windows-nat.c
> +++ b/gdb/windows-nat.c
> @@ -2556,7 +2556,8 @@ windows_xfer_partial (struct target_ops *ops, enum target_object object,
>     Returns 1 if ptid is found and sets *ADDR to thread_local_base.  */
>  
>  static int
> -windows_get_tib_address (ptid_t ptid, CORE_ADDR *addr)
> +windows_get_tib_address (struct target_ops *self,
> +			 ptid_t ptid, CORE_ADDR *addr)
>  {
>    thread_info *th;
>  
> 


-- 
Pedro Alves


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