From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [RFC v2 19/38] convert to_remove_watchpoint
Date: Thu, 06 Feb 2014 21:23:00 -0000 [thread overview]
Message-ID: <1391720136-2121-20-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1391720136-2121-1-git-send-email-tromey@redhat.com>
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_remove_watchpoint.
* target.h (struct target_ops) <to_remove_watchpoint>: Use
TARGET_DEFAULT_NORETURN.
convert to_watchpoint_addr_within_range
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_watchpoint_addr_within_range.
* target.h (struct target_ops) <to_watchpoint_addr_within_range>:
Use TARGET_DEFAULT_FUNC.
convert to_region_ok_for_hw_watchpoint
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_region_ok_for_hw_watchpoint.
* target.h (struct target_ops) <to_region_ok_for_hw_watchpoint>:
Use TARGET_DEFAULT_FUNC.
convert to_can_accel_watchpoint_condition
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_can_accel_watchpoint_condition.
* target.h (struct target_ops)
<to_can_accel_watchpoint_condition>: Use TARGET_DEFAULT_RETURN.
convert to_terminal_init
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_terminal_init.
* target.h (struct target_ops) <to_terminal_init>: Use
TARGET_DEFAULT_IGNORE.
convert to_terminal_inferior
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_terminal_inferior.
* target.h (struct target_ops) <to_terminal_inferior>: Use
TARGET_DEFAULT_IGNORE.
convert to_terminal_ours_for_output
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_terminal_ours_for_output.
* target.h (struct target_ops) <to_terminal_ours_for_output>: Use
TARGET_DEFAULT_IGNORE.
convert to_terminal_ours
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_terminal_ours.
* target.h (struct target_ops) <to_terminal_ours>: Use
TARGET_DEFAULT_IGNORE.
convert to_terminal_save_ours
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_terminal_save_ours.
* target.h (struct target_ops) <to_terminal_save_ours>: Use
TARGET_DEFAULT_IGNORE.
convert to_terminal_info
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_terminal_info.
* target.h (struct target_ops) <to_terminal_info>: Use
TARGET_DEFAULT_FUNC.
---
gdb/ChangeLog | 80 +++++++++++++++++++++++++++++
gdb/target-delegates.c | 137 +++++++++++++++++++++++++++++++++++++++++++++++++
gdb/target.c | 49 ++++--------------
gdb/target.h | 30 +++++++----
4 files changed, 247 insertions(+), 49 deletions(-)
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 6e26824..7a673ee 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -152,6 +152,19 @@ tdefault_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, st
}
static int
+delegate_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
+{
+ self = self->beneath;
+ return self->to_remove_watchpoint (self, arg1, arg2, arg3, arg4);
+}
+
+static int
+tdefault_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
+{
+ return -1;
+}
+
+static int
delegate_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
{
self = self->beneath;
@@ -190,6 +203,100 @@ tdefault_stopped_data_address (struct target_ops *self, CORE_ADDR *arg1)
return 0;
}
+static int
+delegate_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+{
+ self = self->beneath;
+ return self->to_watchpoint_addr_within_range (self, arg1, arg2, arg3);
+}
+
+static int
+delegate_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2)
+{
+ self = self->beneath;
+ return self->to_region_ok_for_hw_watchpoint (self, arg1, arg2);
+}
+
+static int
+delegate_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
+{
+ self = self->beneath;
+ return self->to_can_accel_watchpoint_condition (self, arg1, arg2, arg3, arg4);
+}
+
+static int
+tdefault_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
+{
+ return 0;
+}
+
+static void
+delegate_terminal_init (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_terminal_init (self);
+}
+
+static void
+tdefault_terminal_init (struct target_ops *self)
+{
+}
+
+static void
+delegate_terminal_inferior (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_terminal_inferior (self);
+}
+
+static void
+tdefault_terminal_inferior (struct target_ops *self)
+{
+}
+
+static void
+delegate_terminal_ours_for_output (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_terminal_ours_for_output (self);
+}
+
+static void
+tdefault_terminal_ours_for_output (struct target_ops *self)
+{
+}
+
+static void
+delegate_terminal_ours (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_terminal_ours (self);
+}
+
+static void
+tdefault_terminal_ours (struct target_ops *self)
+{
+}
+
+static void
+delegate_terminal_save_ours (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_terminal_save_ours (self);
+}
+
+static void
+tdefault_terminal_save_ours (struct target_ops *self)
+{
+}
+
+static void
+delegate_terminal_info (struct target_ops *self, const char *arg1, int arg2)
+{
+ self = self->beneath;
+ self->to_terminal_info (self, arg1, arg2);
+}
+
static void
delegate_rcmd (struct target_ops *self, char *arg1, struct ui_file *arg2)
{
@@ -279,12 +386,32 @@ install_delegators (struct target_ops *ops)
ops->to_insert_hw_breakpoint = delegate_insert_hw_breakpoint;
if (ops->to_remove_hw_breakpoint == NULL)
ops->to_remove_hw_breakpoint = delegate_remove_hw_breakpoint;
+ if (ops->to_remove_watchpoint == NULL)
+ ops->to_remove_watchpoint = delegate_remove_watchpoint;
if (ops->to_insert_watchpoint == NULL)
ops->to_insert_watchpoint = delegate_insert_watchpoint;
if (ops->to_stopped_by_watchpoint == NULL)
ops->to_stopped_by_watchpoint = delegate_stopped_by_watchpoint;
if (ops->to_stopped_data_address == NULL)
ops->to_stopped_data_address = delegate_stopped_data_address;
+ if (ops->to_watchpoint_addr_within_range == NULL)
+ ops->to_watchpoint_addr_within_range = delegate_watchpoint_addr_within_range;
+ if (ops->to_region_ok_for_hw_watchpoint == NULL)
+ ops->to_region_ok_for_hw_watchpoint = delegate_region_ok_for_hw_watchpoint;
+ if (ops->to_can_accel_watchpoint_condition == NULL)
+ ops->to_can_accel_watchpoint_condition = delegate_can_accel_watchpoint_condition;
+ if (ops->to_terminal_init == NULL)
+ ops->to_terminal_init = delegate_terminal_init;
+ if (ops->to_terminal_inferior == NULL)
+ ops->to_terminal_inferior = delegate_terminal_inferior;
+ if (ops->to_terminal_ours_for_output == NULL)
+ ops->to_terminal_ours_for_output = delegate_terminal_ours_for_output;
+ if (ops->to_terminal_ours == NULL)
+ ops->to_terminal_ours = delegate_terminal_ours;
+ if (ops->to_terminal_save_ours == NULL)
+ ops->to_terminal_save_ours = delegate_terminal_save_ours;
+ if (ops->to_terminal_info == NULL)
+ ops->to_terminal_info = delegate_terminal_info;
if (ops->to_rcmd == NULL)
ops->to_rcmd = delegate_rcmd;
if (ops->to_can_async_p == NULL)
@@ -315,9 +442,19 @@ install_dummy_methods (struct target_ops *ops)
ops->to_can_use_hw_breakpoint = tdefault_can_use_hw_breakpoint;
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;
ops->to_insert_watchpoint = tdefault_insert_watchpoint;
ops->to_stopped_by_watchpoint = tdefault_stopped_by_watchpoint;
ops->to_stopped_data_address = tdefault_stopped_data_address;
+ ops->to_watchpoint_addr_within_range = default_watchpoint_addr_within_range;
+ ops->to_region_ok_for_hw_watchpoint = default_region_ok_for_hw_watchpoint;
+ ops->to_can_accel_watchpoint_condition = tdefault_can_accel_watchpoint_condition;
+ ops->to_terminal_init = tdefault_terminal_init;
+ ops->to_terminal_inferior = tdefault_terminal_inferior;
+ ops->to_terminal_ours_for_output = tdefault_terminal_ours_for_output;
+ ops->to_terminal_ours = tdefault_terminal_ours;
+ ops->to_terminal_save_ours = tdefault_terminal_save_ours;
+ ops->to_terminal_info = default_terminal_info;
ops->to_rcmd = default_rcmd;
ops->to_can_async_p = find_default_can_async_p;
ops->to_is_async_p = find_default_is_async_p;
diff --git a/gdb/target.c b/gdb/target.c
index 559ae5f..0c31f47 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -609,23 +609,23 @@ update_current_target (void)
/* Do not inherit to_remove_hw_breakpoint. */
/* Do not inherit to_ranged_break_num_registers. */
/* Do not inherit to_insert_watchpoint. */
- INHERIT (to_remove_watchpoint, t);
+ /* Do not inherit to_remove_watchpoint. */
/* Do not inherit to_insert_mask_watchpoint. */
/* Do not inherit to_remove_mask_watchpoint. */
/* Do not inherit to_stopped_data_address. */
INHERIT (to_have_steppable_watchpoint, t);
INHERIT (to_have_continuable_watchpoint, t);
/* Do not inherit to_stopped_by_watchpoint. */
- INHERIT (to_watchpoint_addr_within_range, t);
- INHERIT (to_region_ok_for_hw_watchpoint, t);
- INHERIT (to_can_accel_watchpoint_condition, t);
+ /* Do not inherit to_watchpoint_addr_within_range. */
+ /* Do not inherit to_region_ok_for_hw_watchpoint. */
+ /* Do not inherit to_can_accel_watchpoint_condition. */
/* Do not inherit to_masked_watch_num_registers. */
- INHERIT (to_terminal_init, t);
- INHERIT (to_terminal_inferior, t);
- INHERIT (to_terminal_ours_for_output, t);
- INHERIT (to_terminal_ours, t);
- INHERIT (to_terminal_save_ours, t);
- INHERIT (to_terminal_info, t);
+ /* Do not inherit to_terminal_init. */
+ /* Do not inherit to_terminal_inferior. */
+ /* Do not inherit to_terminal_ours_for_output. */
+ /* Do not inherit to_terminal_ours. */
+ /* Do not inherit to_terminal_save_ours. */
+ /* Do not inherit to_terminal_info. */
/* Do not inherit to_kill. */
INHERIT (to_load, t);
/* Do no inherit to_create_inferior. */
@@ -734,35 +734,6 @@ update_current_target (void)
(int (*) (CORE_ADDR, gdb_byte *, int, int,
struct mem_attrib *, struct target_ops *))
nomemory);
- de_fault (to_remove_watchpoint,
- (int (*) (struct target_ops *, CORE_ADDR, int, int,
- struct expression *))
- return_minus_one);
- de_fault (to_watchpoint_addr_within_range,
- default_watchpoint_addr_within_range);
- de_fault (to_region_ok_for_hw_watchpoint,
- default_region_ok_for_hw_watchpoint);
- de_fault (to_can_accel_watchpoint_condition,
- (int (*) (struct target_ops *, CORE_ADDR, int, int,
- struct expression *))
- return_zero);
- de_fault (to_terminal_init,
- (void (*) (struct target_ops *))
- target_ignore);
- de_fault (to_terminal_inferior,
- (void (*) (struct target_ops *))
- target_ignore);
- de_fault (to_terminal_ours_for_output,
- (void (*) (struct target_ops *))
- target_ignore);
- de_fault (to_terminal_ours,
- (void (*) (struct target_ops *))
- target_ignore);
- de_fault (to_terminal_save_ours,
- (void (*) (struct target_ops *))
- target_ignore);
- de_fault (to_terminal_info,
- default_terminal_info);
de_fault (to_load,
(void (*) (struct target_ops *, char *, int))
tcomplain);
diff --git a/gdb/target.h b/gdb/target.h
index ad552a9..001b161 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -459,7 +459,8 @@ struct target_ops
/* Documentation of what the two routines below are expected to do is
provided with the corresponding target_* macros. */
int (*to_remove_watchpoint) (struct target_ops *,
- CORE_ADDR, int, int, struct expression *);
+ CORE_ADDR, int, int, struct expression *)
+ TARGET_DEFAULT_RETURN (-1);
int (*to_insert_watchpoint) (struct target_ops *,
CORE_ADDR, int, int, struct expression *)
TARGET_DEFAULT_RETURN (-1);
@@ -475,24 +476,33 @@ struct target_ops
int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *)
TARGET_DEFAULT_RETURN (0);
int (*to_watchpoint_addr_within_range) (struct target_ops *,
- CORE_ADDR, CORE_ADDR, int);
+ CORE_ADDR, CORE_ADDR, int)
+ TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
/* Documentation of this routine is provided with the corresponding
target_* macro. */
int (*to_region_ok_for_hw_watchpoint) (struct target_ops *,
- CORE_ADDR, int);
+ CORE_ADDR, int)
+ TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
int (*to_can_accel_watchpoint_condition) (struct target_ops *,
CORE_ADDR, int, int,
- struct expression *);
+ struct expression *)
+ TARGET_DEFAULT_RETURN (0);
int (*to_masked_watch_num_registers) (struct target_ops *,
CORE_ADDR, CORE_ADDR);
- void (*to_terminal_init) (struct target_ops *);
- void (*to_terminal_inferior) (struct target_ops *);
- void (*to_terminal_ours_for_output) (struct target_ops *);
- void (*to_terminal_ours) (struct target_ops *);
- void (*to_terminal_save_ours) (struct target_ops *);
- void (*to_terminal_info) (struct target_ops *, const char *, int);
+ void (*to_terminal_init) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
+ void (*to_terminal_inferior) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
+ void (*to_terminal_ours_for_output) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
+ void (*to_terminal_ours) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
+ void (*to_terminal_save_ours) (struct target_ops *)
+ TARGET_DEFAULT_IGNORE ();
+ void (*to_terminal_info) (struct target_ops *, const char *, int)
+ TARGET_DEFAULT_FUNC (default_terminal_info);
void (*to_kill) (struct target_ops *);
void (*to_load) (struct target_ops *, char *, int);
void (*to_create_inferior) (struct target_ops *,
--
1.8.1.4
next prev parent reply other threads:[~2014-02-06 21:23 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 20:55 [RFC v2 00/38] clean up target delegation Tom Tromey
2014-02-06 20:55 ` [RFC v2 02/38] introduce and use find_target_at Tom Tromey
2014-02-07 15:43 ` Pedro Alves
2014-02-07 21:54 ` Tom Tromey
2014-02-10 14:28 ` Pedro Alves
2014-02-06 20:55 ` [RFC v2 08/38] Add target_ops argument to to_terminal_init Tom Tromey
2014-02-06 20:55 ` [RFC v2 09/38] Add target_ops argument to to_insert_vfork_catchpoint Tom Tromey
2014-02-06 20:55 ` [RFC v2 03/38] add make-target-delegates Tom Tromey
2014-02-06 20:55 ` [RFC v2 16/38] Add target_ops argument to to_static_tracepoint_markers_by_strid Tom Tromey
2014-02-06 20:56 ` [RFC v2 36/38] convert to_decr_pc_after_break Tom Tromey
2014-02-06 20:56 ` [RFC v2 32/38] remove function casts from target.c Tom Tromey
2014-02-06 20:56 ` [RFC v2 24/38] convert to_upload_trace_state_variables Tom Tromey
2014-02-06 20:56 ` [RFC v2 34/38] remove exec_set_find_memory_regions Tom Tromey
2014-02-06 20:56 ` [RFC v2 26/38] convert to_insert_mask_watchpoint Tom Tromey
2014-02-06 20:56 ` [RFC v2 21/38] convert to_extra_thread_info Tom Tromey
2014-02-06 20:56 ` [RFC v2 10/38] Add target_ops argument to to_thread_name Tom Tromey
2014-02-06 20:56 ` [RFC v2 23/38] convert to_disable_tracepoint Tom Tromey
2014-02-06 20:56 ` [RFC v2 28/38] convert to_insn_history Tom Tromey
2014-02-06 20:56 ` [RFC v2 27/38] convert to_get_section_table Tom Tromey
2014-02-06 20:56 ` [RFC v2 37/38] fix buglet in nto-procfs.c Tom Tromey
2014-02-07 16:01 ` Pedro Alves
2014-02-06 20:56 ` [RFC v2 07/38] Add target_ops argument to to_close Tom Tromey
2014-02-08 3:00 ` Yao Qi
2014-02-10 17:50 ` Tom Tromey
2014-02-06 20:56 ` [RFC v2 35/38] remove some calls to INHERIT and de_fault Tom Tromey
2014-02-06 20:56 ` [RFC v2 01/38] add "this" pointers to more target APIs Tom Tromey
2014-02-08 5:19 ` Doug Evans
2014-02-10 22:36 ` Doug Evans
2014-02-10 23:01 ` Doug Evans
2014-02-12 19:56 ` Tom Tromey
2014-02-12 20:22 ` Doug Evans
2014-02-06 20:56 ` [RFC v2 22/38] convert to_thread_architecture Tom Tromey
2014-02-06 20:56 ` [RFC v2 29/38] convert to_search_memory Tom Tromey
2014-02-06 20:58 ` [RFC v2 20/38] convert to_load Tom Tromey
2014-02-06 20:58 ` [RFC v2 17/38] Add target_ops argument to to_save_record Tom Tromey
2014-02-06 20:58 ` [RFC v2 04/38] add target method delegation Tom Tromey
2014-02-07 15:53 ` Pedro Alves
2014-02-07 21:37 ` Tom Tromey
2014-02-06 20:58 ` [RFC v2 11/38] Add target_ops argument to to_get_ada_task_ptid Tom Tromey
2014-02-06 20:58 ` [RFC v2 25/38] convert to_static_tracepoint_markers_by_strid Tom Tromey
2014-02-06 21:23 ` [RFC v2 15/38] Add target_ops argument to to_upload_trace_state_variables Tom Tromey
2014-02-06 21:23 ` Tom Tromey [this message]
2014-02-06 21:23 ` [RFC v2 12/38] Add target_ops argument to to_can_execute_reverse Tom Tromey
2014-02-06 21:23 ` [RFC v2 06/38] introduce remote_load Tom Tromey
2014-02-06 21:24 ` [RFC v2 05/38] convert to_supports_btrace Tom Tromey
2014-02-06 21:24 ` [RFC v2 14/38] Add target_ops argument to to_disable_tracepoint Tom Tromey
2014-02-06 21:24 ` [RFC v2 13/38] Add target_ops argument to to_fileio_pwrite Tom Tromey
2014-02-06 21:24 ` [RFC v2 31/38] minor cleanups to update_current_target Tom Tromey
2014-02-06 21:38 ` [RFC v2 33/38] pass NULL to TARGET_DEFAULT_RETURN when appropriate Tom Tromey
2014-02-06 21:38 ` [RFC v2 30/38] change delegation for to_read_description Tom Tromey
2014-02-06 21:42 ` [RFC v2 18/38] convert to_detach Tom Tromey
2014-02-06 21:47 ` [RFC v2 38/38] convert to_get_unwinder and to_get_tailcall_unwinder to methods Tom Tromey
2014-02-07 16:02 ` Pedro Alves
2014-02-07 16:47 ` [RFC v2 00/38] clean up target delegation Pedro Alves
2014-02-19 16:35 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391720136-2121-20-git-send-email-tromey@redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox