From 9249843f19916f0ba5d02749b0811765babf527a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 18 Dec 2013 14:11:53 -0700 Subject: [PATCH] convert to_get_min_fast_tracepoint_insn_len 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_get_min_fast_tracepoint_insn_len. (return_minus_one): Remove. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. --- gdb/ChangeLog | 9 +++++++++ gdb/target-delegates.c | 16 ++++++++++++++++ gdb/target.c | 13 +------------ gdb/target.h | 3 ++- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d560ad6419b..57dfaf26b84 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2014-02-19 Tom Tromey + + * target-delegates.c: Rebuild. + * target.c (update_current_target): Don't inherit or default + to_get_min_fast_tracepoint_insn_len. + (return_minus_one): Remove. + * target.h (struct target_ops) + : Use TARGET_DEFAULT_RETURN. + 2014-02-19 Tom Tromey * target-delegates.c: Rebuild. diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index cdf29053d04..ae9e5672231 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -858,6 +858,19 @@ tdefault_get_raw_trace_data (struct target_ops *self, gdb_byte *arg1, ULONGEST a tcomplain (); } +static int +delegate_get_min_fast_tracepoint_insn_len (struct target_ops *self) +{ + self = self->beneath; + return self->to_get_min_fast_tracepoint_insn_len (self); +} + +static int +tdefault_get_min_fast_tracepoint_insn_len (struct target_ops *self) +{ + return -1; +} + static int delegate_supports_btrace (struct target_ops *self) { @@ -1020,6 +1033,8 @@ install_delegators (struct target_ops *ops) ops->to_upload_trace_state_variables = delegate_upload_trace_state_variables; if (ops->to_get_raw_trace_data == NULL) ops->to_get_raw_trace_data = delegate_get_raw_trace_data; + if (ops->to_get_min_fast_tracepoint_insn_len == NULL) + ops->to_get_min_fast_tracepoint_insn_len = delegate_get_min_fast_tracepoint_insn_len; if (ops->to_supports_btrace == NULL) ops->to_supports_btrace = delegate_supports_btrace; } @@ -1100,5 +1115,6 @@ install_dummy_methods (struct target_ops *ops) ops->to_upload_tracepoints = tdefault_upload_tracepoints; ops->to_upload_trace_state_variables = tdefault_upload_trace_state_variables; ops->to_get_raw_trace_data = tdefault_get_raw_trace_data; + ops->to_get_min_fast_tracepoint_insn_len = tdefault_get_min_fast_tracepoint_insn_len; ops->to_supports_btrace = tdefault_supports_btrace; } diff --git a/gdb/target.c b/gdb/target.c index 8caa720d5b4..bfbf5fde64a 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -66,8 +66,6 @@ static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *); static int return_zero (void); -static int return_minus_one (void); - static void *return_null (void); void target_ignore (void); @@ -705,7 +703,7 @@ update_current_target (void) /* Do not inherit to_upload_tracepoints. */ /* Do not inherit to_upload_trace_state_variables. */ /* Do not inherit to_get_raw_trace_data. */ - INHERIT (to_get_min_fast_tracepoint_insn_len, t); + /* Do not inherit to_get_min_fast_tracepoint_insn_len. */ INHERIT (to_set_disconnected_tracing, t); INHERIT (to_set_circular_trace_buffer, t); INHERIT (to_set_trace_buffer_size, t); @@ -752,9 +750,6 @@ update_current_target (void) (void (*) (struct target_ops *, ptid_t)) target_ignore); current_target.to_read_description = NULL; - de_fault (to_get_min_fast_tracepoint_insn_len, - (int (*) (struct target_ops *)) - return_minus_one); de_fault (to_set_disconnected_tracing, (void (*) (struct target_ops *, int)) target_ignore); @@ -3510,12 +3505,6 @@ return_zero (void) return 0; } -static int -return_minus_one (void) -{ - return -1; -} - static void * return_null (void) { diff --git a/gdb/target.h b/gdb/target.h index 9fe5991809b..3cdb0287ff0 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -888,7 +888,8 @@ struct target_ops 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) (struct target_ops *); + int (*to_get_min_fast_tracepoint_insn_len) (struct target_ops *) + TARGET_DEFAULT_RETURN (-1); /* Set the target's tracing behavior in response to unexpected disconnection - set VAL to 1 to keep tracing, 0 to stop. */ -- 2.30.2