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 24/32] convert to_disable_tracepoint


Looks fine.

On 01/13/2014 07:12 PM, Tom Tromey wrote:
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_disable_tracepoint.
> 	* target.h (struct target_ops) <to_disable_tracepoint>: Use
> 	TARGET_DEFAULT_NORETURN.
> 
> convert to_trace_set_readonly_regions
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_trace_set_readonly_regions.
> 	* target.h (struct target_ops) <to_trace_set_readonly_regions>:
> 	Use TARGET_DEFAULT_NORETURN.
> 
> convert to_trace_start
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_trace_start.
> 	* target.h (struct target_ops) <to_trace_start>: Use
> 	TARGET_DEFAULT_NORETURN.
> 
> convert to_get_trace_status
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_get_trace_status.
> 	* target.h (struct target_ops) <to_get_trace_status>: Use
> 	TARGET_DEFAULT_RETURN.
> 
> convert to_get_tracepoint_status
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_get_tracepoint_status.
> 	* target.h (struct target_ops) <to_get_tracepoint_status>: Use
> 	TARGET_DEFAULT_NORETURN.
> 
> convert to_trace_stop
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_trace_stop.
> 	* target.h (struct target_ops) <to_trace_stop>: Use
> 	TARGET_DEFAULT_NORETURN.
> 
> convert to_trace_find
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_trace_find.
> 	* target.h (struct target_ops): Use TARGET_DEFAULT_RETURN.
> 
> convert to_get_trace_state_variable_value
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_get_trace_state_variable_value.
> 	* target.h (struct target_ops)
> 	<to_get_trace_state_variable_value>: Use TARGET_DEFAULT_RETURN.
> 
> convert to_save_trace_data
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_save_trace_data.
> 	* target.h (struct target_ops) <to_save_trace_data>: Use
> 	TARGET_DEFAULT_NORETURN.
> 
> convert to_upload_tracepoints
> 
> 2014-01-08  Tom Tromey <tromey@redhat.com>
> 
> 	* target-delegates.c : Rebuild.
> 	* target.c (update_current_target): Don't inherit or default
> 	to_upload_tracepoints.
> 	* target.h (struct target_ops) <to_upload_tracepoints>: Use
> 	TARGET_DEFAULT_RETURN.
> ---
>  gdb/ChangeLog          |  79 ++++++++++++++++++++++++
>  gdb/target-delegates.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++++
>  gdb/target.c           |  52 ++++------------
>  gdb/target.h           |  30 ++++++----
>  4 files changed, 269 insertions(+), 52 deletions(-)
> 
> diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
> index 53fabb1..ddcc89c 100644
> --- a/gdb/target-delegates.c
> +++ b/gdb/target-delegates.c
> @@ -702,6 +702,136 @@ tdefault_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
>    tcomplain ();
>  }
>  
> +static void
> +delegate_disable_tracepoint (struct target_ops *self, struct bp_location *arg1)
> +{
> +  self = self->beneath;
> +  self->to_disable_tracepoint (self, arg1);
> +}
> +
> +static void
> +tdefault_disable_tracepoint (struct target_ops *self, struct bp_location *arg1)
> +{
> +  tcomplain ();
> +}
> +
> +static void
> +delegate_trace_set_readonly_regions (struct target_ops *self)
> +{
> +  self = self->beneath;
> +  self->to_trace_set_readonly_regions (self);
> +}
> +
> +static void
> +tdefault_trace_set_readonly_regions (struct target_ops *self)
> +{
> +  tcomplain ();
> +}
> +
> +static void
> +delegate_trace_start (struct target_ops *self)
> +{
> +  self = self->beneath;
> +  self->to_trace_start (self);
> +}
> +
> +static void
> +tdefault_trace_start (struct target_ops *self)
> +{
> +  tcomplain ();
> +}
> +
> +static int
> +delegate_get_trace_status (struct target_ops *self, struct trace_status *arg1)
> +{
> +  self = self->beneath;
> +  return self->to_get_trace_status (self, arg1);
> +}
> +
> +static int
> +tdefault_get_trace_status (struct target_ops *self, struct trace_status *arg1)
> +{
> +  return -1;
> +}
> +
> +static void
> +delegate_get_tracepoint_status (struct target_ops *self, struct breakpoint *arg1, struct uploaded_tp *arg2)
> +{
> +  self = self->beneath;
> +  self->to_get_tracepoint_status (self, arg1, arg2);
> +}
> +
> +static void
> +tdefault_get_tracepoint_status (struct target_ops *self, struct breakpoint *arg1, struct uploaded_tp *arg2)
> +{
> +  tcomplain ();
> +}
> +
> +static void
> +delegate_trace_stop (struct target_ops *self)
> +{
> +  self = self->beneath;
> +  self->to_trace_stop (self);
> +}
> +
> +static void
> +tdefault_trace_stop (struct target_ops *self)
> +{
> +  tcomplain ();
> +}
> +
> +static int
> +delegate_trace_find (struct target_ops *self, enum trace_find_type  arg1, int arg2, CORE_ADDR arg3, CORE_ADDR arg4, int *arg5)
> +{
> +  self = self->beneath;
> +  return self->to_trace_find (self, arg1, arg2, arg3, arg4, arg5);
> +}
> +
> +static int
> +tdefault_trace_find (struct target_ops *self, enum trace_find_type  arg1, int arg2, CORE_ADDR arg3, CORE_ADDR arg4, int *arg5)
> +{
> +  return -1;
> +}
> +
> +static int
> +delegate_get_trace_state_variable_value (struct target_ops *self, int arg1, LONGEST *arg2)
> +{
> +  self = self->beneath;
> +  return self->to_get_trace_state_variable_value (self, arg1, arg2);
> +}
> +
> +static int
> +tdefault_get_trace_state_variable_value (struct target_ops *self, int arg1, LONGEST *arg2)
> +{
> +  return 0;
> +}
> +
> +static int
> +delegate_save_trace_data (struct target_ops *self, const char *arg1)
> +{
> +  self = self->beneath;
> +  return self->to_save_trace_data (self, arg1);
> +}
> +
> +static int
> +tdefault_save_trace_data (struct target_ops *self, const char *arg1)
> +{
> +  tcomplain ();
> +}
> +
> +static int
> +delegate_upload_tracepoints (struct target_ops *self, struct uploaded_tp **arg1)
> +{
> +  self = self->beneath;
> +  return self->to_upload_tracepoints (self, arg1);
> +}
> +
> +static int
> +tdefault_upload_tracepoints (struct target_ops *self, struct uploaded_tp **arg1)
> +{
> +  return 0;
> +}
> +
>  static int
>  delegate_supports_btrace (struct target_ops *self)
>  {
> @@ -840,6 +970,26 @@ install_delegators (struct target_ops *ops)
>      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_disable_tracepoint == NULL)
> +    ops->to_disable_tracepoint = delegate_disable_tracepoint;
> +  if (ops->to_trace_set_readonly_regions == NULL)
> +    ops->to_trace_set_readonly_regions = delegate_trace_set_readonly_regions;
> +  if (ops->to_trace_start == NULL)
> +    ops->to_trace_start = delegate_trace_start;
> +  if (ops->to_get_trace_status == NULL)
> +    ops->to_get_trace_status = delegate_get_trace_status;
> +  if (ops->to_get_tracepoint_status == NULL)
> +    ops->to_get_tracepoint_status = delegate_get_tracepoint_status;
> +  if (ops->to_trace_stop == NULL)
> +    ops->to_trace_stop = delegate_trace_stop;
> +  if (ops->to_trace_find == NULL)
> +    ops->to_trace_find = delegate_trace_find;
> +  if (ops->to_get_trace_state_variable_value == NULL)
> +    ops->to_get_trace_state_variable_value = delegate_get_trace_state_variable_value;
> +  if (ops->to_save_trace_data == NULL)
> +    ops->to_save_trace_data = delegate_save_trace_data;
> +  if (ops->to_upload_tracepoints == NULL)
> +    ops->to_upload_tracepoints = delegate_upload_tracepoints;
>    if (ops->to_supports_btrace == NULL)
>      ops->to_supports_btrace = delegate_supports_btrace;
>  }
> @@ -908,5 +1058,15 @@ install_dummy_methods (struct target_ops *ops)
>    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_disable_tracepoint = tdefault_disable_tracepoint;
> +  ops->to_trace_set_readonly_regions = tdefault_trace_set_readonly_regions;
> +  ops->to_trace_start = tdefault_trace_start;
> +  ops->to_get_trace_status = tdefault_get_trace_status;
> +  ops->to_get_tracepoint_status = tdefault_get_tracepoint_status;
> +  ops->to_trace_stop = tdefault_trace_stop;
> +  ops->to_trace_find = tdefault_trace_find;
> +  ops->to_get_trace_state_variable_value = tdefault_get_trace_state_variable_value;
> +  ops->to_save_trace_data = tdefault_save_trace_data;
> +  ops->to_upload_tracepoints = tdefault_upload_tracepoints;
>    ops->to_supports_btrace = tdefault_supports_btrace;
>  }
> diff --git a/gdb/target.c b/gdb/target.c
> index 83dfee7..90e2709 100644
> --- a/gdb/target.c
> +++ b/gdb/target.c
> @@ -689,16 +689,16 @@ update_current_target (void)
>        /* 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);
> -      INHERIT (to_get_trace_status, t);
> -      INHERIT (to_get_tracepoint_status, t);
> -      INHERIT (to_trace_stop, t);
> -      INHERIT (to_trace_find, t);
> -      INHERIT (to_get_trace_state_variable_value, t);
> -      INHERIT (to_save_trace_data, t);
> -      INHERIT (to_upload_tracepoints, t);
> +      /* Do not inherit to_disable_tracepoint.  */
> +      /* Do not inherit to_trace_set_readonly_regions.  */
> +      /* Do not inherit to_trace_start.  */
> +      /* Do not inherit to_get_trace_status.  */
> +      /* Do not inherit to_get_tracepoint_status.  */
> +      /* Do not inherit to_trace_stop.  */
> +      /* Do not inherit to_trace_find.  */
> +      /* Do not inherit to_get_trace_state_variable_value.  */
> +      /* Do not inherit to_save_trace_data.  */
> +      /* Do not inherit to_upload_tracepoints.  */
>        INHERIT (to_upload_trace_state_variables, t);
>        INHERIT (to_get_raw_trace_data, t);
>        INHERIT (to_get_min_fast_tracepoint_insn_len, t);
> @@ -748,38 +748,6 @@ update_current_target (void)
>  	    (void (*) (struct target_ops *, ptid_t))
>  	    target_ignore);
>    current_target.to_read_description = NULL;
> -  de_fault (to_disable_tracepoint,
> -	    (void (*) (struct target_ops *, struct bp_location *))
> -	    tcomplain);
> -  de_fault (to_trace_set_readonly_regions,
> -	    (void (*) (struct target_ops *))
> -	    tcomplain);
> -  de_fault (to_trace_start,
> -	    (void (*) (struct target_ops *))
> -	    tcomplain);
> -  de_fault (to_get_trace_status,
> -	    (int (*) (struct target_ops *, struct trace_status *))
> -	    return_minus_one);
> -  de_fault (to_get_tracepoint_status,
> -	    (void (*) (struct target_ops *, struct breakpoint *,
> -		       struct uploaded_tp *))
> -	    tcomplain);
> -  de_fault (to_trace_stop,
> -	    (void (*) (struct target_ops *))
> -	    tcomplain);
> -  de_fault (to_trace_find,
> -	    (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 (*) (struct target_ops *, int, LONGEST *))
> -	    return_zero);
> -  de_fault (to_save_trace_data,
> -	    (int (*) (struct target_ops *, const char *))
> -	    tcomplain);
> -  de_fault (to_upload_tracepoints,
> -	    (int (*) (struct target_ops *, struct uploaded_tp **))
> -	    return_zero);
>    de_fault (to_upload_trace_state_variables,
>  	    (int (*) (struct target_ops *, struct uploaded_tsv **))
>  	    return_zero);
> diff --git a/gdb/target.h b/gdb/target.h
> index 4a5573d..dfaad80 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -808,25 +808,31 @@ struct target_ops
>  
>      /* Disable a tracepoint on the target.  */
>      void (*to_disable_tracepoint) (struct target_ops *,
> -				   struct bp_location *location);
> +				   struct bp_location *location)
> +      TARGET_DEFAULT_NORETURN (tcomplain ());
>  
>      /* 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) (struct target_ops *);
> +    void (*to_trace_set_readonly_regions) (struct target_ops *)
> +      TARGET_DEFAULT_NORETURN (tcomplain ());
>  
>      /* Start a trace run.  */
> -    void (*to_trace_start) (struct target_ops *);
> +    void (*to_trace_start) (struct target_ops *)
> +      TARGET_DEFAULT_NORETURN (tcomplain ());
>  
>      /* Get the current status of a tracing run.  */
> -    int (*to_get_trace_status) (struct target_ops *, struct trace_status *ts);
> +    int (*to_get_trace_status) (struct target_ops *, struct trace_status *ts)
> +      TARGET_DEFAULT_RETURN (-1);
>  
>      void (*to_get_tracepoint_status) (struct target_ops *,
>  				      struct breakpoint *tp,
> -				      struct uploaded_tp *utp);
> +				      struct uploaded_tp *utp)
> +      TARGET_DEFAULT_NORETURN (tcomplain ());
>  
>      /* Stop a trace run.  */
> -    void (*to_trace_stop) (struct target_ops *);
> +    void (*to_trace_stop) (struct target_ops *)
> +      TARGET_DEFAULT_NORETURN (tcomplain ());
>  
>     /* Ask the target to find a trace frame of the given type TYPE,
>        using NUM, ADDR1, and ADDR2 as search parameters.  Returns the
> @@ -835,18 +841,22 @@ struct target_ops
>        operation fails.  */
>      int (*to_trace_find) (struct target_ops *,
>  			  enum trace_find_type type, int num,
> -			  CORE_ADDR addr1, CORE_ADDR addr2, int *tpp);
> +			  CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
> +      TARGET_DEFAULT_RETURN (-1);
>  
>      /* 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) (struct target_ops *,
> -					      int tsv, LONGEST *val);
> +					      int tsv, LONGEST *val)
> +      TARGET_DEFAULT_RETURN (0);
>  
> -    int (*to_save_trace_data) (struct target_ops *, const char *filename);
> +    int (*to_save_trace_data) (struct target_ops *, const char *filename)
> +      TARGET_DEFAULT_NORETURN (tcomplain ());
>  
>      int (*to_upload_tracepoints) (struct target_ops *,
> -				  struct uploaded_tp **utpp);
> +				  struct uploaded_tp **utpp)
> +      TARGET_DEFAULT_RETURN (0);
>  
>      int (*to_upload_trace_state_variables) (struct target_ops *,
>  					    struct uploaded_tsv **utsvp);
> 


-- 
Pedro Alves


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