From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [RFC v2 22/38] convert to_thread_architecture
Date: Thu, 06 Feb 2014 20:56:00 -0000 [thread overview]
Message-ID: <1391720136-2121-23-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_thread_architecture.
* target.h (struct target_ops) <to_thread_architecture>: Use
TARGET_DEFAULT_FUNC.
convert to_get_ada_task_ptid
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_get_ada_task_ptid.
* target.h (struct target_ops) <to_get_ada_task_ptid>: Use
TARGET_DEFAULT_FUNC.
convert to_supports_multi_process
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_supports_multi_process.
* target.h (struct target_ops) <to_supports_multi_process>: Use
TARGET_DEFAULT_RETURN.
convert to_supports_enable_disable_tracepoint
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_supports_enable_disable_tracepoint.
* target.h (struct target_ops)
<to_supports_enable_disable_tracepoint>: Use
TARGET_DEFAULT_RETURN.
convert to_supports_string_tracing
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_supports_string_tracing.
* target.h (struct target_ops) <to_supports_string_tracing>: Use
TARGET_DEFAULT_RETURN.
convert to_trace_init
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_trace_init.
* target.h (struct target_ops) <to_trace_init>: Use
TARGET_DEFAULT_RETURN.
convert to_download_tracepoint
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_download_tracepoint.
* target.h (struct target_ops) <to_download_tracepoint>: Use
TARGET_DEFAULT_NORETURN.
convert to_can_download_tracepoint
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_can_download_tracepoint.
* target.h (struct target_ops) <to_can_download_tracepoint>: Use
TARGET_DEFAULT_RETURN.
convert to_download_trace_state_variable
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_download_trace_state_variable.
* target.h (struct target_ops) <to_download_trace_state_variable>:
Use TARGET_DEFAULT_NORETURN.
convert to_enable_tracepoint
2014-02-06 Tom Tromey <tromey@redhat.com>
* target-delegates.c: Rebuild.
* target.c (update_current_target): Don't inherit or default
to_enable_tracepoint.
* target.h (struct target_ops) <to_enable_tracepoint>: Use
TARGET_DEFAULT_NORETURN.
---
gdb/ChangeLog | 81 +++++++++++++++++++++++++++
gdb/target-delegates.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
gdb/target.c | 52 +++++------------
gdb/target.h | 30 ++++++----
4 files changed, 262 insertions(+), 49 deletions(-)
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 13e547d..358a64b 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -564,6 +564,13 @@ tdefault_xfer_partial (struct target_ops *self, enum target_object arg1, const
return -1;
}
+static ptid_t
+delegate_get_ada_task_ptid (struct target_ops *self, long arg1, long arg2)
+{
+ self = self->beneath;
+ return self->to_get_ada_task_ptid (self, arg1, arg2);
+}
+
static int
delegate_can_execute_reverse (struct target_ops *self)
{
@@ -585,6 +592,117 @@ delegate_execution_direction (struct target_ops *self)
}
static int
+delegate_supports_multi_process (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_supports_multi_process (self);
+}
+
+static int
+tdefault_supports_multi_process (struct target_ops *self)
+{
+ return 0;
+}
+
+static int
+delegate_supports_enable_disable_tracepoint (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_supports_enable_disable_tracepoint (self);
+}
+
+static int
+tdefault_supports_enable_disable_tracepoint (struct target_ops *self)
+{
+ return 0;
+}
+
+static int
+delegate_supports_string_tracing (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_supports_string_tracing (self);
+}
+
+static int
+tdefault_supports_string_tracing (struct target_ops *self)
+{
+ return 0;
+}
+
+static struct gdbarch *
+delegate_thread_architecture (struct target_ops *self, ptid_t arg1)
+{
+ self = self->beneath;
+ return self->to_thread_architecture (self, arg1);
+}
+
+static void
+delegate_trace_init (struct target_ops *self)
+{
+ self = self->beneath;
+ self->to_trace_init (self);
+}
+
+static void
+tdefault_trace_init (struct target_ops *self)
+{
+ tcomplain ();
+}
+
+static void
+delegate_download_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+ self = self->beneath;
+ self->to_download_tracepoint (self, arg1);
+}
+
+static void
+tdefault_download_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+ tcomplain ();
+}
+
+static int
+delegate_can_download_tracepoint (struct target_ops *self)
+{
+ self = self->beneath;
+ return self->to_can_download_tracepoint (self);
+}
+
+static int
+tdefault_can_download_tracepoint (struct target_ops *self)
+{
+ return 0;
+}
+
+static void
+delegate_download_trace_state_variable (struct target_ops *self, struct trace_state_variable *arg1)
+{
+ self = self->beneath;
+ self->to_download_trace_state_variable (self, arg1);
+}
+
+static void
+tdefault_download_trace_state_variable (struct target_ops *self, struct trace_state_variable *arg1)
+{
+ tcomplain ();
+}
+
+static void
+delegate_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+ self = self->beneath;
+ self->to_enable_tracepoint (self, arg1);
+}
+
+static void
+tdefault_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+{
+ tcomplain ();
+}
+
+static int
delegate_supports_btrace (struct target_ops *self)
{
self = self->beneath;
@@ -698,10 +816,30 @@ install_delegators (struct target_ops *ops)
ops->to_goto_bookmark = delegate_goto_bookmark;
if (ops->to_xfer_partial == NULL)
ops->to_xfer_partial = delegate_xfer_partial;
+ if (ops->to_get_ada_task_ptid == NULL)
+ ops->to_get_ada_task_ptid = delegate_get_ada_task_ptid;
if (ops->to_can_execute_reverse == NULL)
ops->to_can_execute_reverse = delegate_can_execute_reverse;
if (ops->to_execution_direction == NULL)
ops->to_execution_direction = delegate_execution_direction;
+ if (ops->to_supports_multi_process == NULL)
+ ops->to_supports_multi_process = delegate_supports_multi_process;
+ if (ops->to_supports_enable_disable_tracepoint == NULL)
+ 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_thread_architecture == NULL)
+ ops->to_thread_architecture = delegate_thread_architecture;
+ if (ops->to_trace_init == NULL)
+ ops->to_trace_init = delegate_trace_init;
+ if (ops->to_download_tracepoint == NULL)
+ ops->to_download_tracepoint = delegate_download_tracepoint;
+ if (ops->to_can_download_tracepoint == NULL)
+ ops->to_can_download_tracepoint = delegate_can_download_tracepoint;
+ if (ops->to_download_trace_state_variable == NULL)
+ 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_supports_btrace == NULL)
ops->to_supports_btrace = delegate_supports_btrace;
}
@@ -758,7 +896,17 @@ install_dummy_methods (struct target_ops *ops)
ops->to_get_bookmark = tdefault_get_bookmark;
ops->to_goto_bookmark = tdefault_goto_bookmark;
ops->to_xfer_partial = tdefault_xfer_partial;
+ ops->to_get_ada_task_ptid = default_get_ada_task_ptid;
ops->to_can_execute_reverse = tdefault_can_execute_reverse;
ops->to_execution_direction = default_execution_direction;
+ 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_thread_architecture = default_thread_architecture;
+ ops->to_trace_init = tdefault_trace_init;
+ ops->to_download_tracepoint = tdefault_download_tracepoint;
+ 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_supports_btrace = tdefault_supports_btrace;
}
diff --git a/gdb/target.c b/gdb/target.c
index b657900..2efd21f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -57,6 +57,9 @@ static int default_region_ok_for_hw_watchpoint (struct target_ops *,
static void default_rcmd (struct target_ops *, char *, struct ui_file *);
+static ptid_t default_get_ada_task_ptid (struct target_ops *self,
+ long lwp, long tid);
+
static void tcomplain (void) ATTRIBUTE_NORETURN;
static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
@@ -678,18 +681,18 @@ update_current_target (void)
/* Do not inherit to_get_thread_local_address. */
/* Do not inherit to_can_execute_reverse. */
/* Do not inherit to_execution_direction. */
- INHERIT (to_thread_architecture, t);
+ /* Do not inherit to_thread_architecture. */
/* Do not inherit to_read_description. */
- INHERIT (to_get_ada_task_ptid, t);
+ /* Do not inherit to_get_ada_task_ptid. */
/* Do not inherit to_search_memory. */
- INHERIT (to_supports_multi_process, t);
- INHERIT (to_supports_enable_disable_tracepoint, t);
- INHERIT (to_supports_string_tracing, t);
- INHERIT (to_trace_init, t);
- INHERIT (to_download_tracepoint, t);
- INHERIT (to_can_download_tracepoint, t);
- INHERIT (to_download_trace_state_variable, t);
- INHERIT (to_enable_tracepoint, t);
+ /* Do not inherit to_supports_multi_process. */
+ /* Do not inherit to_supports_enable_disable_tracepoint. */
+ /* Do not inherit to_supports_string_tracing. */
+ /* Do not inherit to_trace_init. */
+ /* Do not inherit to_download_tracepoint. */
+ /* 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);
@@ -748,36 +751,7 @@ update_current_target (void)
de_fault (to_stop,
(void (*) (struct target_ops *, ptid_t))
target_ignore);
- de_fault (to_thread_architecture,
- default_thread_architecture);
current_target.to_read_description = NULL;
- de_fault (to_get_ada_task_ptid,
- (ptid_t (*) (struct target_ops *, long, long))
- default_get_ada_task_ptid);
- de_fault (to_supports_multi_process,
- (int (*) (struct target_ops *))
- return_zero);
- de_fault (to_supports_enable_disable_tracepoint,
- (int (*) (struct target_ops *))
- return_zero);
- de_fault (to_supports_string_tracing,
- (int (*) (struct target_ops *))
- return_zero);
- de_fault (to_trace_init,
- (void (*) (struct target_ops *))
- tcomplain);
- de_fault (to_download_tracepoint,
- (void (*) (struct target_ops *, struct bp_location *))
- tcomplain);
- de_fault (to_can_download_tracepoint,
- (int (*) (struct target_ops *))
- return_zero);
- de_fault (to_download_trace_state_variable,
- (void (*) (struct target_ops *, struct trace_state_variable *))
- tcomplain);
- de_fault (to_enable_tracepoint,
- (void (*) (struct target_ops *, struct bp_location *))
- tcomplain);
de_fault (to_disable_tracepoint,
(void (*) (struct target_ops *, struct bp_location *))
tcomplain);
diff --git a/gdb/target.h b/gdb/target.h
index 625968c..bd76453 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -667,7 +667,8 @@ struct target_ops
task Private_Data section of the Ada Task Control Block, and
their interpretation depends on the target. */
ptid_t (*to_get_ada_task_ptid) (struct target_ops *,
- long lwp, long thread);
+ long lwp, long thread)
+ TARGET_DEFAULT_FUNC (default_get_ada_task_ptid);
/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
Return 0 if *READPTR is already at the end of the buffer.
@@ -699,17 +700,20 @@ struct target_ops
/* Does this target support debugging multiple processes
simultaneously? */
- int (*to_supports_multi_process) (struct target_ops *);
+ int (*to_supports_multi_process) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Does this target support enabling and disabling tracepoints while a trace
experiment is running? */
- int (*to_supports_enable_disable_tracepoint) (struct target_ops *);
+ int (*to_supports_enable_disable_tracepoint) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Does this target support disabling address space randomization? */
int (*to_supports_disable_randomization) (struct target_ops *);
/* Does this target support the tracenz bytecode for string collection? */
- int (*to_supports_string_tracing) (struct target_ops *);
+ int (*to_supports_string_tracing) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Does this target support evaluation of breakpoint conditions on its
end? */
@@ -729,7 +733,8 @@ struct target_ops
ptrace operations need to operate according to target_gdbarch ().
The default implementation always returns target_gdbarch (). */
- struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t);
+ struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t)
+ TARGET_DEFAULT_FUNC (default_thread_architecture);
/* Determine current address space of thread PTID.
@@ -783,23 +788,28 @@ struct target_ops
/* Tracepoint-related operations. */
/* Prepare the target for a tracing run. */
- void (*to_trace_init) (struct target_ops *);
+ void (*to_trace_init) (struct target_ops *)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* Send full details of a tracepoint location to the target. */
void (*to_download_tracepoint) (struct target_ops *,
- struct bp_location *location);
+ struct bp_location *location)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* Is the target able to download tracepoint locations in current
state? */
- int (*to_can_download_tracepoint) (struct target_ops *);
+ int (*to_can_download_tracepoint) (struct target_ops *)
+ TARGET_DEFAULT_RETURN (0);
/* Send full details of a trace state variable to the target. */
void (*to_download_trace_state_variable) (struct target_ops *,
- struct trace_state_variable *tsv);
+ struct trace_state_variable *tsv)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* Enable a tracepoint on the target. */
void (*to_enable_tracepoint) (struct target_ops *,
- struct bp_location *location);
+ struct bp_location *location)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disable a tracepoint on the target. */
void (*to_disable_tracepoint) (struct target_ops *,
--
1.8.1.4
next prev parent reply other threads:[~2014-02-06 20:56 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 16/38] Add target_ops argument to to_static_tracepoint_markers_by_strid Tom Tromey
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 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 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:56 ` [RFC v2 23/38] convert to_disable_tracepoint 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 10/38] Add target_ops argument to to_thread_name Tom Tromey
2014-02-06 20:56 ` [RFC v2 36/38] convert to_decr_pc_after_break Tom Tromey
2014-02-06 20:56 ` Tom Tromey [this message]
2014-02-06 20:56 ` [RFC v2 28/38] convert to_insn_history 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 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 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 24/38] convert to_upload_trace_state_variables 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 29/38] convert to_search_memory 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 32/38] remove function casts from target.c Tom Tromey
2014-02-06 20:58 ` [RFC v2 20/38] convert to_load 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 17/38] Add target_ops argument to to_save_record 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 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:23 ` [RFC v2 19/38] convert to_remove_watchpoint 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:24 ` [RFC v2 05/38] convert to_supports_btrace 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:24 ` [RFC v2 14/38] Add target_ops argument to to_disable_tracepoint Tom Tromey
2014-02-06 21:38 ` [RFC v2 30/38] change delegation for to_read_description 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: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-23-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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).