This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC 25/32] convert to_upload_trace_state_variables
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Mon, 13 Jan 2014 12:12:40 -0700
- Subject: [RFC 25/32] convert to_upload_trace_state_variables
- Authentication-results: sourceware.org; auth=none
- References: <1389640367-5571-1-git-send-email-tromey at redhat dot com>
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_upload_trace_state_variables.
* target.h (struct target_ops) <to_upload_trace_state_variables>:
Use TARGET_DEFAULT_RETURN.
convert to_get_raw_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_get_raw_trace_data.
* target.h (struct target_ops) <to_get_raw_trace_data>: Use
TARGET_DEFAULT_NORETURN.
convert to_get_min_fast_tracepoint_insn_len
2014-01-08 Tom Tromey <tromey@redhat.com>
* 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)
<to_get_min_fast_tracepoint_insn_len>: Use TARGET_DEFAULT_RETURN.
convert to_set_disconnected_tracing
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_set_disconnected_tracing.
* target.h (struct target_ops) <to_set_disconnected_tracing>: Use
TARGET_DEFAULT_IGNORE.
convert to_set_circular_trace_buffer
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_set_circular_trace_buffer.
* target.h (struct target_ops) <to_set_circular_trace_buffer>: Use
TARGET_DEFAULT_IGNORE.
convert to_set_trace_buffer_size
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't initialize
to_set_trace_buffer_size.
* target.h (struct target_ops) <to_set_trace_buffer_size>: Use
TARGET_DEFAULT_IGNORE.
convert to_set_trace_notes
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_set_trace_notes.
* target.h (struct target_ops) <to_set_trace_notes>: Use
TARGET_DEFAULT_RETURN.
convert to_get_tib_address
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_get_tib_address.
* target.h (struct target_ops) <to_get_tib_address>: Use
TARGET_DEFAULT_NORETURN.
convert to_set_permissions
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_set_permissions.
* target.h (struct target_ops) <to_set_permissions>: Use
TARGET_DEFAULT_IGNORE.
convert to_static_tracepoint_marker_at
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_static_tracepoint_marker_at.
* target.h (struct target_ops) <to_static_tracepoint_marker_at>:
Use TARGET_DEFAULT_RETURN.
---
gdb/ChangeLog | 81 +++++++++++++++++++++++++
gdb/target-delegates.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++
gdb/target.c | 60 ++++---------------
gdb/target.h | 30 ++++++----
4 files changed, 267 insertions(+), 60 deletions(-)
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index ddcc89c..4d6c591 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -833,6 +833,132 @@ tdefault_upload_tracepoints (struct target_ops *self, struct uploaded_tp **arg1)
}
static int
+delegate_upload_trace_state_variables (struct target_ops *self, struct uploaded_tsv **arg1)
+{
+ self = self->beneath;
+ return self->to_upload_trace_state_variables (self, arg1);
+}
+
+static int
+tdefault_upload_trace_state_variables (struct target_ops *self, struct uploaded_tsv **arg1)
+{
+ return 0;
+}
+
+static LONGEST
+delegate_get_raw_trace_data (struct target_ops *self, gdb_byte *arg1, ULONGEST arg2, LONGEST arg3)
+{
+ self = self->beneath;
+ return self->to_get_raw_trace_data (self, arg1, arg2, arg3);
+}
+
+static LONGEST
+tdefault_get_raw_trace_data (struct target_ops *self, gdb_byte *arg1, ULONGEST arg2, LONGEST arg3)
+{
+ 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 void
+delegate_set_disconnected_tracing (struct target_ops *self, int arg1)
+{
+ self = self->beneath;
+ self->to_set_disconnected_tracing (self, arg1);
+}
+
+static void
+tdefault_set_disconnected_tracing (struct target_ops *self, int arg1)
+{
+}
+
+static void
+delegate_set_circular_trace_buffer (struct target_ops *self, int arg1)
+{
+ self = self->beneath;
+ self->to_set_circular_trace_buffer (self, arg1);
+}
+
+static void
+tdefault_set_circular_trace_buffer (struct target_ops *self, int arg1)
+{
+}
+
+static void
+delegate_set_trace_buffer_size (struct target_ops *self, LONGEST arg1)
+{
+ self = self->beneath;
+ self->to_set_trace_buffer_size (self, arg1);
+}
+
+static void
+tdefault_set_trace_buffer_size (struct target_ops *self, LONGEST arg1)
+{
+}
+
+static int
+delegate_set_trace_notes (struct target_ops *self, const char *arg1, const char *arg2, const char *arg3)
+{
+ self = self->beneath;
+ return self->to_set_trace_notes (self, arg1, arg2, arg3);
+}
+
+static int
+tdefault_set_trace_notes (struct target_ops *self, const char *arg1, const char *arg2, const char *arg3)
+{
+ return 0;
+}
+
+static int
+delegate_get_tib_address (struct target_ops *self, ptid_t arg1, CORE_ADDR *arg2)
+{
+ self = self->beneath;
+ return self->to_get_tib_address (self, arg1, arg2);
+}
+
+static int
+tdefault_get_tib_address (struct target_ops *self, ptid_t arg1, CORE_ADDR *arg2)
+{
+ tcomplain ();
+}
+
+static void
+delegate_set_permissions (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_set_permissions (self);
+}
+
+static void
+tdefault_set_permissions (struct target_ops *self)
+{
+}
+
+static int
+delegate_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
+{
+ self = self->beneath;
+ return self->to_static_tracepoint_marker_at (self, arg1, arg2);
+}
+
+static int
+tdefault_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
+{
+ return 0;
+}
+
+static int
delegate_supports_btrace (struct target_ops *self)
{
self = self->beneath;
@@ -990,6 +1116,26 @@ install_delegators (struct target_ops *ops)
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_upload_trace_state_variables == NULL)
+ 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_set_disconnected_tracing == NULL)
+ ops->to_set_disconnected_tracing = delegate_set_disconnected_tracing;
+ if (ops->to_set_circular_trace_buffer == NULL)
+ ops->to_set_circular_trace_buffer = delegate_set_circular_trace_buffer;
+ if (ops->to_set_trace_buffer_size == NULL)
+ ops->to_set_trace_buffer_size = delegate_set_trace_buffer_size;
+ if (ops->to_set_trace_notes == NULL)
+ ops->to_set_trace_notes = delegate_set_trace_notes;
+ if (ops->to_get_tib_address == NULL)
+ ops->to_get_tib_address = delegate_get_tib_address;
+ if (ops->to_set_permissions == NULL)
+ ops->to_set_permissions = delegate_set_permissions;
+ if (ops->to_static_tracepoint_marker_at == NULL)
+ ops->to_static_tracepoint_marker_at = delegate_static_tracepoint_marker_at;
if (ops->to_supports_btrace == NULL)
ops->to_supports_btrace = delegate_supports_btrace;
}
@@ -1068,5 +1214,15 @@ install_dummy_methods (struct target_ops *ops)
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_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_set_disconnected_tracing = tdefault_set_disconnected_tracing;
+ ops->to_set_circular_trace_buffer = tdefault_set_circular_trace_buffer;
+ ops->to_set_trace_buffer_size = tdefault_set_trace_buffer_size;
+ ops->to_set_trace_notes = tdefault_set_trace_notes;
+ ops->to_get_tib_address = tdefault_get_tib_address;
+ ops->to_set_permissions = tdefault_set_permissions;
+ ops->to_static_tracepoint_marker_at = tdefault_static_tracepoint_marker_at;
ops->to_supports_btrace = tdefault_supports_btrace;
}
diff --git a/gdb/target.c b/gdb/target.c
index 90e2709..c6d5367 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);
-
void target_ignore (void);
static void target_command (char *, int);
@@ -699,16 +697,16 @@ update_current_target (void)
/* 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);
- INHERIT (to_set_disconnected_tracing, t);
- INHERIT (to_set_circular_trace_buffer, t);
- INHERIT (to_set_trace_buffer_size, t);
- INHERIT (to_set_trace_notes, t);
- INHERIT (to_get_tib_address, t);
- INHERIT (to_set_permissions, t);
- INHERIT (to_static_tracepoint_marker_at, t);
+ /* Do not inherit to_upload_trace_state_variables. */
+ /* Do not inherit to_get_raw_trace_data. */
+ /* Do not inherit to_get_min_fast_tracepoint_insn_len. */
+ /* Do not inherit to_set_disconnected_tracing. */
+ /* Do not inherit to_set_circular_trace_buffer. */
+ /* Do not inherit to_set_trace_buffer_size. */
+ /* Do not inherit to_set_trace_notes. */
+ /* Do not inherit to_get_tib_address. */
+ /* Do not inherit to_set_permissions. */
+ /* Do not inherit to_static_tracepoint_marker_at. */
INHERIT (to_static_tracepoint_markers_by_strid, t);
INHERIT (to_traceframe_info, t);
INHERIT (to_use_agent, t);
@@ -748,38 +746,6 @@ update_current_target (void)
(void (*) (struct target_ops *, ptid_t))
target_ignore);
current_target.to_read_description = NULL;
- de_fault (to_upload_trace_state_variables,
- (int (*) (struct target_ops *, struct uploaded_tsv **))
- return_zero);
- de_fault (to_get_raw_trace_data,
- (LONGEST (*) (struct target_ops *, gdb_byte *, ULONGEST, LONGEST))
- tcomplain);
- 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);
- de_fault (to_set_circular_trace_buffer,
- (void (*) (struct target_ops *, int))
- target_ignore);
- de_fault (to_set_trace_buffer_size,
- (void (*) (struct target_ops *, LONGEST))
- target_ignore);
- de_fault (to_set_trace_notes,
- (int (*) (struct target_ops *,
- const char *, const char *, const char *))
- return_zero);
- de_fault (to_get_tib_address,
- (int (*) (struct target_ops *, ptid_t, CORE_ADDR *))
- tcomplain);
- de_fault (to_set_permissions,
- (void (*) (struct target_ops *))
- target_ignore);
- de_fault (to_static_tracepoint_marker_at,
- (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) * (*) (struct target_ops *,
const char *))
@@ -3443,12 +3409,6 @@ return_zero (void)
return 0;
}
-static int
-return_minus_one (void)
-{
- return -1;
-}
-
/*
* Find the next target down the stack from the specified target.
*/
diff --git a/gdb/target.h b/gdb/target.h
index dfaad80..9860cf4 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -859,29 +859,36 @@ struct target_ops
TARGET_DEFAULT_RETURN (0);
int (*to_upload_trace_state_variables) (struct target_ops *,
- struct uploaded_tsv **utsvp);
+ struct uploaded_tsv **utsvp)
+ TARGET_DEFAULT_RETURN (0);
LONGEST (*to_get_raw_trace_data) (struct target_ops *, gdb_byte *buf,
- ULONGEST offset, LONGEST len);
+ ULONGEST offset, LONGEST len)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* 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) (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. */
- void (*to_set_disconnected_tracing) (struct target_ops *, int val);
- void (*to_set_circular_trace_buffer) (struct target_ops *, int val);
+ void (*to_set_disconnected_tracing) (struct target_ops *, int val)
+ TARGET_DEFAULT_IGNORE ();
+ void (*to_set_circular_trace_buffer) (struct target_ops *, int val)
+ TARGET_DEFAULT_IGNORE ();
/* Set the size of trace buffer in the target. */
- void (*to_set_trace_buffer_size) (struct target_ops *, LONGEST val);
+ void (*to_set_trace_buffer_size) (struct target_ops *, LONGEST val)
+ TARGET_DEFAULT_IGNORE ();
/* Add/change textual notes about the trace run, returning 1 if
successful, 0 otherwise. */
int (*to_set_trace_notes) (struct target_ops *,
const char *user, const char *notes,
- const char *stopnotes);
+ const char *stopnotes)
+ TARGET_DEFAULT_RETURN (0);
/* Return the processor core that thread PTID was last seen on.
This information is updated only when:
@@ -902,15 +909,18 @@ struct target_ops
/* Return the address of the start of the Thread Information Block
a Windows OS specific feature. */
int (*to_get_tib_address) (struct target_ops *,
- ptid_t ptid, CORE_ADDR *addr);
+ ptid_t ptid, CORE_ADDR *addr)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* Send the new settings of write permission variables. */
- void (*to_set_permissions) (struct target_ops *);
+ void (*to_set_permissions) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
/* 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) (struct target_ops *, CORE_ADDR,
- struct static_tracepoint_marker *marker);
+ struct static_tracepoint_marker *marker)
+ TARGET_DEFAULT_RETURN (0);
/* Return a vector of all tracepoints markers string id ID, or all
markers if ID is NULL. */
--
1.8.1.4