[RFC 26/32] convert to_static_tracepoint_markers_by_strid
Tom Tromey
tromey@redhat.com
Mon Jan 13 19:13:00 GMT 2014
Note that this patch reformats the
to_static_tracepoint_markers_by_strid field declaration in struct
target_ops. This was needed because make-target-delegates requires
the opening paren for the parameters to be on the same line as the
method name, and I didn't see an easy way to fix this.
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_markers_by_strid.
* target.h (struct target_ops)
<to_static_tracepoint_markers_by_strid>: Use
TARGET_DEFAULT_NORETURN.
convert to_traceframe_info
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_traceframe_info.
* target.h (struct target_ops) <to_traceframe_info>: Use
TARGET_DEFAULT_RETURN.
convert to_use_agent
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_use_agent.
* target.h (struct target_ops) <to_use_agent>: Use
TARGET_DEFAULT_NORETURN.
convert to_can_use_agent
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_can_use_agent.
* target.h (struct target_ops) <to_can_use_agent>: Use
TARGET_DEFAULT_RETURN.
convert to_augmented_libraries_svr4_read
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_augmented_libraries_svr4_read.
* target.h (struct target_ops) <to_augmented_libraries_svr4_read>:
Use TARGET_DEFAULT_RETURN.
convert to_supports_evaluation_of_breakpoint_conditions
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_supports_evaluation_of_breakpoint_conditions.
* target.h (struct target_ops)
<to_supports_evaluation_of_breakpoint_conditions>: Use
TARGET_DEFAULT_RETURN.
convert to_can_run_breakpoint_commands
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_can_run_breakpoint_commands.
* target.h (struct target_ops) <to_can_run_breakpoint_commands>:
Use TARGET_DEFAULT_RETURN.
convert to_stop
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (update_current_target): Don't inherit or default
to_stop.
* target.h (struct target_ops) <to_stop>: Use
TARGET_DEFAULT_IGNORE.
convert to_fetch_registers
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (target_fetch_registers): Unconditionally delegate.
* target.h (struct target_ops) <to_fetch_registers>: Use
TARGET_DEFAULT_NORETURN.
convert to_ranged_break_num_registers
2014-01-08 Tom Tromey <tromey@redhat.com>
* target-delegates.c : Rebuild.
* target.c (target_ranged_break_num_registers): Unconditionally
delegate.
* target.h (struct target_ops) <to_ranged_break_num_registers>:
Use TARGET_DEFAULT_RETURN.
---
gdb/ChangeLog | 81 +++++++++++++++++++++++++
gdb/target-delegates.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++
gdb/target.c | 65 ++++----------------
gdb/target.h | 31 ++++++----
4 files changed, 272 insertions(+), 63 deletions(-)
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 4d6c591..7667b2d 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -61,6 +61,18 @@ tdefault_wait (struct target_ops *self, ptid_t arg1, struct target_waitstatus *a
}
static void
+delegate_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+{
+ self = self->beneath;
+ self->to_fetch_registers (self, arg1, arg2);
+}
+
+static void
+tdefault_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+{
+}
+
+static void
delegate_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
{
self = self->beneath;
@@ -126,6 +138,19 @@ tdefault_can_use_hw_breakpoint (struct target_ops *self, int arg1, int arg2, int
}
static int
+delegate_ranged_break_num_registers (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_ranged_break_num_registers (self);
+}
+
+static int
+tdefault_ranged_break_num_registers (struct target_ops *self)
+{
+ return -1;
+}
+
+static int
delegate_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
{
self = self->beneath;
@@ -453,6 +478,18 @@ tdefault_thread_name (struct target_ops *self, struct thread_info *arg1)
}
static void
+delegate_stop (struct target_ops *self, ptid_t arg1)
+{
+ self = self->beneath;
+ self->to_stop (self, arg1);
+}
+
+static void
+tdefault_stop (struct target_ops *self, ptid_t arg1)
+{
+}
+
+static void
delegate_rcmd (struct target_ops *self, char *arg1, struct ui_file *arg2)
{
self = self->beneath;
@@ -630,6 +667,32 @@ tdefault_supports_string_tracing (struct target_ops *self)
return 0;
}
+static int
+delegate_supports_evaluation_of_breakpoint_conditions (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_supports_evaluation_of_breakpoint_conditions (self);
+}
+
+static int
+tdefault_supports_evaluation_of_breakpoint_conditions (struct target_ops *self)
+{
+ return 0;
+}
+
+static int
+delegate_can_run_breakpoint_commands (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_can_run_breakpoint_commands (self);
+}
+
+static int
+tdefault_can_run_breakpoint_commands (struct target_ops *self)
+{
+ return 0;
+}
+
static struct gdbarch *
delegate_thread_architecture (struct target_ops *self, ptid_t arg1)
{
@@ -958,6 +1021,58 @@ tdefault_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, s
return 0;
}
+static VEC(static_tracepoint_marker_p) *
+delegate_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
+{
+ self = self->beneath;
+ return self->to_static_tracepoint_markers_by_strid (self, arg1);
+}
+
+static VEC(static_tracepoint_marker_p) *
+tdefault_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
+{
+ tcomplain ();
+}
+
+static struct traceframe_info *
+delegate_traceframe_info (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_traceframe_info (self);
+}
+
+static struct traceframe_info *
+tdefault_traceframe_info (struct target_ops *self)
+{
+ return 0;
+}
+
+static int
+delegate_use_agent (struct target_ops *self, int arg1)
+{
+ self = self->beneath;
+ return self->to_use_agent (self, arg1);
+}
+
+static int
+tdefault_use_agent (struct target_ops *self, int arg1)
+{
+ tcomplain ();
+}
+
+static int
+delegate_can_use_agent (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_can_use_agent (self);
+}
+
+static int
+tdefault_can_use_agent (struct target_ops *self)
+{
+ return 0;
+}
+
static int
delegate_supports_btrace (struct target_ops *self)
{
@@ -971,6 +1086,19 @@ tdefault_supports_btrace (struct target_ops *self)
return 0;
}
+static int
+delegate_augmented_libraries_svr4_read (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_augmented_libraries_svr4_read (self);
+}
+
+static int
+tdefault_augmented_libraries_svr4_read (struct target_ops *self)
+{
+ return 0;
+}
+
static void
install_delegators (struct target_ops *ops)
{
@@ -984,6 +1112,8 @@ install_delegators (struct target_ops *ops)
ops->to_resume = delegate_resume;
if (ops->to_wait == NULL)
ops->to_wait = delegate_wait;
+ if (ops->to_fetch_registers == NULL)
+ ops->to_fetch_registers = delegate_fetch_registers;
if (ops->to_store_registers == NULL)
ops->to_store_registers = delegate_store_registers;
if (ops->to_prepare_to_store == NULL)
@@ -996,6 +1126,8 @@ install_delegators (struct target_ops *ops)
ops->to_remove_breakpoint = delegate_remove_breakpoint;
if (ops->to_can_use_hw_breakpoint == NULL)
ops->to_can_use_hw_breakpoint = delegate_can_use_hw_breakpoint;
+ if (ops->to_ranged_break_num_registers == NULL)
+ ops->to_ranged_break_num_registers = delegate_ranged_break_num_registers;
if (ops->to_insert_hw_breakpoint == NULL)
ops->to_insert_hw_breakpoint = delegate_insert_hw_breakpoint;
if (ops->to_remove_hw_breakpoint == NULL)
@@ -1050,6 +1182,8 @@ install_delegators (struct target_ops *ops)
ops->to_extra_thread_info = delegate_extra_thread_info;
if (ops->to_thread_name == NULL)
ops->to_thread_name = delegate_thread_name;
+ if (ops->to_stop == NULL)
+ ops->to_stop = delegate_stop;
if (ops->to_rcmd == NULL)
ops->to_rcmd = delegate_rcmd;
if (ops->to_pid_to_exec_file == NULL)
@@ -1084,6 +1218,10 @@ install_delegators (struct target_ops *ops)
ops->to_supports_enable_disable_tracepoint = delegate_supports_enable_disable_tracepoint;
if (ops->to_supports_string_tracing == NULL)
ops->to_supports_string_tracing = delegate_supports_string_tracing;
+ if (ops->to_supports_evaluation_of_breakpoint_conditions == NULL)
+ ops->to_supports_evaluation_of_breakpoint_conditions = delegate_supports_evaluation_of_breakpoint_conditions;
+ if (ops->to_can_run_breakpoint_commands == NULL)
+ ops->to_can_run_breakpoint_commands = delegate_can_run_breakpoint_commands;
if (ops->to_thread_architecture == NULL)
ops->to_thread_architecture = delegate_thread_architecture;
if (ops->to_trace_init == NULL)
@@ -1136,8 +1274,18 @@ install_delegators (struct target_ops *ops)
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_static_tracepoint_markers_by_strid == NULL)
+ ops->to_static_tracepoint_markers_by_strid = delegate_static_tracepoint_markers_by_strid;
+ if (ops->to_traceframe_info == NULL)
+ ops->to_traceframe_info = delegate_traceframe_info;
+ if (ops->to_use_agent == NULL)
+ ops->to_use_agent = delegate_use_agent;
+ if (ops->to_can_use_agent == NULL)
+ ops->to_can_use_agent = delegate_can_use_agent;
if (ops->to_supports_btrace == NULL)
ops->to_supports_btrace = delegate_supports_btrace;
+ if (ops->to_augmented_libraries_svr4_read == NULL)
+ ops->to_augmented_libraries_svr4_read = delegate_augmented_libraries_svr4_read;
}
static void
@@ -1148,12 +1296,14 @@ install_dummy_methods (struct target_ops *ops)
ops->to_detach = tdefault_detach;
ops->to_resume = tdefault_resume;
ops->to_wait = tdefault_wait;
+ ops->to_fetch_registers = tdefault_fetch_registers;
ops->to_store_registers = tdefault_store_registers;
ops->to_prepare_to_store = tdefault_prepare_to_store;
ops->to_files_info = tdefault_files_info;
ops->to_insert_breakpoint = memory_insert_breakpoint;
ops->to_remove_breakpoint = memory_remove_breakpoint;
ops->to_can_use_hw_breakpoint = tdefault_can_use_hw_breakpoint;
+ ops->to_ranged_break_num_registers = tdefault_ranged_break_num_registers;
ops->to_insert_hw_breakpoint = tdefault_insert_hw_breakpoint;
ops->to_remove_hw_breakpoint = tdefault_remove_hw_breakpoint;
ops->to_remove_watchpoint = tdefault_remove_watchpoint;
@@ -1181,6 +1331,7 @@ install_dummy_methods (struct target_ops *ops)
ops->to_has_exited = tdefault_has_exited;
ops->to_extra_thread_info = tdefault_extra_thread_info;
ops->to_thread_name = tdefault_thread_name;
+ ops->to_stop = tdefault_stop;
ops->to_rcmd = default_rcmd;
ops->to_pid_to_exec_file = tdefault_pid_to_exec_file;
ops->to_log_command = tdefault_log_command;
@@ -1198,6 +1349,8 @@ install_dummy_methods (struct target_ops *ops)
ops->to_supports_multi_process = tdefault_supports_multi_process;
ops->to_supports_enable_disable_tracepoint = tdefault_supports_enable_disable_tracepoint;
ops->to_supports_string_tracing = tdefault_supports_string_tracing;
+ ops->to_supports_evaluation_of_breakpoint_conditions = tdefault_supports_evaluation_of_breakpoint_conditions;
+ ops->to_can_run_breakpoint_commands = tdefault_can_run_breakpoint_commands;
ops->to_thread_architecture = default_thread_architecture;
ops->to_trace_init = tdefault_trace_init;
ops->to_download_tracepoint = tdefault_download_tracepoint;
@@ -1224,5 +1377,10 @@ install_dummy_methods (struct target_ops *ops)
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_static_tracepoint_markers_by_strid = tdefault_static_tracepoint_markers_by_strid;
+ ops->to_traceframe_info = tdefault_traceframe_info;
+ ops->to_use_agent = tdefault_use_agent;
+ ops->to_can_use_agent = tdefault_can_use_agent;
ops->to_supports_btrace = tdefault_supports_btrace;
+ ops->to_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read;
}
diff --git a/gdb/target.c b/gdb/target.c
index c6d5367..17d29c7 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -653,7 +653,7 @@ update_current_target (void)
/* Do not inherit to_pid_to_str. */
/* Do not inherit to_extra_thread_info. */
/* Do not inherit to_thread_name. */
- INHERIT (to_stop, t);
+ /* Do not inherit to_stop. */
/* Do not inherit to_xfer_partial. */
/* Do not inherit to_rcmd. */
/* Do not inherit to_pid_to_exec_file. */
@@ -707,14 +707,15 @@ update_current_target (void)
/* 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);
- INHERIT (to_can_use_agent, t);
- INHERIT (to_augmented_libraries_svr4_read, t);
+ /* Do not inherit to_static_tracepoint_markers_by_strid. */
+ /* Do not inherit to_traceframe_info. */
+ /* Do not inherit to_use_agent. */
+ /* Do not inherit to_can_use_agent. */
+ /* Do not inherit to_augmented_libraries_svr4_read. */
INHERIT (to_magic, t);
- INHERIT (to_supports_evaluation_of_breakpoint_conditions, t);
- INHERIT (to_can_run_breakpoint_commands, t);
+ /* Do not inherit
+ to_supports_evaluation_of_breakpoint_conditions. */
+ /* Do not inherit to_can_run_breakpoint_commands. */
/* Do not inherit to_memory_map. */
/* Do not inherit to_flash_erase. */
/* Do not inherit to_flash_done. */
@@ -742,32 +743,7 @@ update_current_target (void)
de_fault (to_can_run,
(int (*) (struct target_ops *))
return_zero);
- de_fault (to_stop,
- (void (*) (struct target_ops *, ptid_t))
- target_ignore);
current_target.to_read_description = NULL;
- de_fault (to_static_tracepoint_markers_by_strid,
- (VEC(static_tracepoint_marker_p) * (*) (struct target_ops *,
- const char *))
- tcomplain);
- de_fault (to_traceframe_info,
- (struct traceframe_info * (*) (struct target_ops *))
- return_zero);
- de_fault (to_supports_evaluation_of_breakpoint_conditions,
- (int (*) (struct target_ops *))
- return_zero);
- de_fault (to_can_run_breakpoint_commands,
- (int (*) (struct target_ops *))
- return_zero);
- de_fault (to_use_agent,
- (int (*) (struct target_ops *, int))
- tcomplain);
- de_fault (to_can_use_agent,
- (int (*) (struct target_ops *))
- return_zero);
- de_fault (to_augmented_libraries_svr4_read,
- (int (*) (struct target_ops *))
- return_zero);
#undef de_fault
@@ -3711,18 +3687,9 @@ debug_print_register (const char * func,
void
target_fetch_registers (struct regcache *regcache, int regno)
{
- struct target_ops *t;
-
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- {
- if (t->to_fetch_registers != NULL)
- {
- t->to_fetch_registers (t, regcache, regno);
- if (targetdebug)
- debug_print_register ("target_fetch_registers", regcache, regno);
- return;
- }
- }
+ current_target.to_fetch_registers (¤t_target, regcache, regno);
+ if (targetdebug)
+ debug_print_register ("target_fetch_registers", regcache, regno);
}
void
@@ -3861,13 +3828,7 @@ target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
int
target_ranged_break_num_registers (void)
{
- struct target_ops *t;
-
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_ranged_break_num_registers != NULL)
- return t->to_ranged_break_num_registers (t);
-
- return -1;
+ return current_target.to_ranged_break_num_registers (¤t_target);
}
/* See target.h. */
diff --git a/gdb/target.h b/gdb/target.h
index 9860cf4..75e802c 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -401,7 +401,8 @@ struct target_ops
ptid_t (*to_wait) (struct target_ops *,
ptid_t, struct target_waitstatus *, int)
TARGET_DEFAULT_NORETURN (noprocess ());
- void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
+ void (*to_fetch_registers) (struct target_ops *, struct regcache *, int)
+ TARGET_DEFAULT_IGNORE ();
void (*to_store_registers) (struct target_ops *, struct regcache *, int)
TARGET_DEFAULT_NORETURN (noprocess ());
void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
@@ -443,7 +444,8 @@ struct target_ops
TARGET_DEFAULT_FUNC (memory_remove_breakpoint);
int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int)
TARGET_DEFAULT_RETURN (0);
- int (*to_ranged_break_num_registers) (struct target_ops *);
+ int (*to_ranged_break_num_registers) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (-1);
int (*to_insert_hw_breakpoint) (struct target_ops *,
struct gdbarch *, struct bp_target_info *)
TARGET_DEFAULT_RETURN (-1);
@@ -541,7 +543,8 @@ struct target_ops
TARGET_DEFAULT_RETURN (0);
char *(*to_thread_name) (struct target_ops *, struct thread_info *)
TARGET_DEFAULT_RETURN (0);
- void (*to_stop) (struct target_ops *, ptid_t);
+ void (*to_stop) (struct target_ops *, ptid_t)
+ TARGET_DEFAULT_IGNORE ();
void (*to_rcmd) (struct target_ops *,
char *command, struct ui_file *output)
TARGET_DEFAULT_FUNC (default_rcmd);
@@ -712,11 +715,13 @@ struct target_ops
/* Does this target support evaluation of breakpoint conditions on its
end? */
- int (*to_supports_evaluation_of_breakpoint_conditions) (struct target_ops *);
+ int (*to_supports_evaluation_of_breakpoint_conditions) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Does this target support evaluation of breakpoint commands on its
end? */
- int (*to_can_run_breakpoint_commands) (struct target_ops *);
+ int (*to_can_run_breakpoint_commands) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Determine current architecture of thread PTID.
@@ -924,8 +929,8 @@ struct target_ops
/* Return a vector of all tracepoints markers string id ID, or all
markers if ID is NULL. */
- VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid)
- (struct target_ops *, const char *id);
+ VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid) (struct target_ops *, const char *id)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* Return a traceframe info object describing the current
traceframe's contents. If the target doesn't support
@@ -940,14 +945,17 @@ struct target_ops
is available in the read-only sections. This method should not
cache data; higher layers take care of caching, invalidating,
and re-fetching when necessary. */
- struct traceframe_info *(*to_traceframe_info) (struct target_ops *);
+ struct traceframe_info *(*to_traceframe_info) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Ask the target to use or not to use agent according to USE. Return 1
successful, 0 otherwise. */
- int (*to_use_agent) (struct target_ops *, int use);
+ int (*to_use_agent) (struct target_ops *, int use)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* Is the target able to use agent in current state? */
- int (*to_can_use_agent) (struct target_ops *);
+ int (*to_can_use_agent) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Check whether the target supports branch tracing. */
int (*to_supports_btrace) (struct target_ops *)
@@ -1035,7 +1043,8 @@ struct target_ops
/* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
non-empty annex. */
- int (*to_augmented_libraries_svr4_read) (struct target_ops *);
+ int (*to_augmented_libraries_svr4_read) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
--
1.8.1.4
More information about the Gdb-patches
mailing list