This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC v2 16/38] Add target_ops argument to to_static_tracepoint_markers_by_strid
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Thu, 6 Feb 2014 13:55:14 -0700
- Subject: [RFC v2 16/38] Add target_ops argument to to_static_tracepoint_markers_by_strid
- Authentication-results: sourceware.org; auth=none
- References: <1391720136-2121-1-git-send-email-tromey at redhat dot com>
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (target_static_tracepoint_markers_by_strid): Add
argument.
(struct target_ops) <to_static_tracepoint_markers_by_strid>: Add
'self' argument.
* target.c (update_current_target): Update.
* remote.c (struct target_ops)
<to_static_tracepoint_markers_by_strid>: Add 'self' argument.
* linux-nat.c (struct target_ops)
<to_static_tracepoint_markers_by_strid>: Add 'self' argument.
Add target_ops argument to to_traceframe_info
2014-02-06 Tom Tromey <tromey@redhat.com>
* tracepoint.c (tfile_traceframe_info): Add 'self' argument.
* target.h (struct target_ops) <to_traceframe_info>: Add argument.
(target_traceframe_info): Add argument.
* target.c (update_current_target): Update.
* remote.c (remote_traceframe_info): Add 'self' argument.
* ctf.c (ctf_traceframe_info): Add 'self' argument.
Add target_ops argument to to_use_agent
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_use_agent>: Add argument.
(target_use_agent): Add argument.
* target.c (update_current_target): Update.
* remote.c (remote_use_agent): Add 'self' argument.
* inf-child.c (inf_child_use_agent): Add 'self' argument.
Add target_ops argument to to_can_use_agent
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_can_use_agent>: Add argument.
(target_can_use_agent): Add argument.
* target.c (update_current_target): Update.
* remote.c (remote_can_use_agent): Add 'self' argument.
* inf-child.c (inf_child_can_use_agent): Add 'self' argument.
Add target_ops argument to to_enable_btrace
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_enable_btrace>: Add argument.
* target.c (target_enable_btrace): Add argument.
* remote.c (remote_enable_btrace): Add 'self' argument.
* i386-linux-nat.c (i386_linux_enable_btrace): Add 'self'
argument.
* amd64-linux-nat.c (amd64_linux_enable_btrace): Add 'self'
argument.
Add target_ops argument to to_disable_btrace
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_disable_btrace>: Add argument.
* target.c (target_disable_btrace): Add argument.
* remote.c (remote_disable_btrace): Add 'self' argument.
* i386-linux-nat.c (i386_linux_disable_btrace): Add 'self'
argument.
* amd64-linux-nat.c (amd64_linux_disable_btrace): Add 'self'
argument.
Add target_ops argument to to_teardown_btrace
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_teardown_btrace>: Add argument.
* target.c (target_teardown_btrace): Add argument.
* remote.c (remote_teardown_btrace): Add 'self' argument.
* i386-linux-nat.c (i386_linux_teardown_btrace): Add 'self'
argument.
* amd64-linux-nat.c (amd64_linux_teardown_btrace): Add 'self'
argument.
Add target_ops argument to to_read_btrace
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_read_btrace>: Add argument.
* target.c (struct target_ops) <to_read_btrace>: Add argument.
* remote.c (struct target_ops) <to_read_btrace>: Add 'self'
argument.
* amd64-linux-nat.c (amd64_linux_read_btrace): New function.
(_initialize_amd64_linux_nat): Use it.
* i386-linux-nat.c (i386_linux_read_btrace): New function.
(_initialize_i386_linux_nat): Use it.
Add target_ops argument to to_stop_recording
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_stop_recording>: Add argument.
* target.c (target_stop_recording): Add argument.
* record.c (record_stop): Add argument.
* record-btrace.c (record_btrace_stop_recording): Add 'self'
argument.
Add target_ops argument to to_info_record
2014-02-06 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_info_record>: Add argument.
* target.c (target_info_record): Add argument.
* record.c (info_record_command): Add argument.
* record-full.c (record_full_info): Add 'self' argument.
* record-btrace.c (record_btrace_info): Add 'self' argument.
---
gdb/ChangeLog | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
gdb/amd64-linux-nat.c | 19 ++++++++---
gdb/ctf.c | 2 +-
gdb/i386-linux-nat.c | 19 ++++++++---
gdb/inf-child.c | 4 +--
gdb/linux-nat.c | 3 +-
gdb/record-btrace.c | 4 +--
gdb/record-full.c | 2 +-
gdb/record.c | 4 +--
gdb/remote.c | 20 ++++++-----
gdb/target.c | 21 ++++++------
gdb/target.h | 33 ++++++++++--------
gdb/tracepoint.c | 2 +-
13 files changed, 177 insertions(+), 50 deletions(-)
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index af84142..b7b889b 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -1150,7 +1150,7 @@ amd64_linux_read_description (struct target_ops *ops)
/* Enable branch tracing. */
static struct btrace_target_info *
-amd64_linux_enable_btrace (ptid_t ptid)
+amd64_linux_enable_btrace (struct target_ops *self, ptid_t ptid)
{
struct btrace_target_info *tinfo;
struct gdbarch *gdbarch;
@@ -1172,7 +1172,8 @@ amd64_linux_enable_btrace (ptid_t ptid)
/* Disable branch tracing. */
static void
-amd64_linux_disable_btrace (struct btrace_target_info *tinfo)
+amd64_linux_disable_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
enum btrace_error errcode = linux_disable_btrace (tinfo);
@@ -1183,12 +1184,22 @@ amd64_linux_disable_btrace (struct btrace_target_info *tinfo)
/* Teardown branch tracing. */
static void
-amd64_linux_teardown_btrace (struct btrace_target_info *tinfo)
+amd64_linux_teardown_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
/* Ignore errors. */
linux_disable_btrace (tinfo);
}
+static enum btrace_error
+amd64_linux_read_btrace (struct target_ops *self,
+ VEC (btrace_block_s) **data,
+ struct btrace_target_info *btinfo,
+ enum btrace_read_type type)
+{
+ return linux_read_btrace (data, btinfo, type);
+}
+
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_amd64_linux_nat (void);
@@ -1232,7 +1243,7 @@ _initialize_amd64_linux_nat (void)
t->to_enable_btrace = amd64_linux_enable_btrace;
t->to_disable_btrace = amd64_linux_disable_btrace;
t->to_teardown_btrace = amd64_linux_teardown_btrace;
- t->to_read_btrace = linux_read_btrace;
+ t->to_read_btrace = amd64_linux_read_btrace;
/* Register the target. */
linux_nat_add_target (t);
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 67cc1c7..8b6a717 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1755,7 +1755,7 @@ ctf_thread_alive (struct target_ops *ops, ptid_t ptid)
traceframe_info. */
static struct traceframe_info *
-ctf_traceframe_info (void)
+ctf_traceframe_info (struct target_ops *self)
{
struct traceframe_info *info = XCNEW (struct traceframe_info);
const char *name;
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index f7be40c..84f20ab 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -1061,7 +1061,7 @@ i386_linux_read_description (struct target_ops *ops)
/* Enable branch tracing. */
static struct btrace_target_info *
-i386_linux_enable_btrace (ptid_t ptid)
+i386_linux_enable_btrace (struct target_ops *self, ptid_t ptid)
{
struct btrace_target_info *tinfo;
struct gdbarch *gdbarch;
@@ -1083,7 +1083,8 @@ i386_linux_enable_btrace (ptid_t ptid)
/* Disable branch tracing. */
static void
-i386_linux_disable_btrace (struct btrace_target_info *tinfo)
+i386_linux_disable_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
enum btrace_error errcode = linux_disable_btrace (tinfo);
@@ -1094,12 +1095,22 @@ i386_linux_disable_btrace (struct btrace_target_info *tinfo)
/* Teardown branch tracing. */
static void
-i386_linux_teardown_btrace (struct btrace_target_info *tinfo)
+i386_linux_teardown_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
/* Ignore errors. */
linux_disable_btrace (tinfo);
}
+static enum btrace_error
+i386_linux_read_btrace (struct target_ops *self,
+ VEC (btrace_block_s) **data,
+ struct btrace_target_info *btinfo,
+ enum btrace_read_type type)
+{
+ return linux_read_btrace (data, btinfo, type);
+}
+
/* -Wmissing-prototypes */
extern initialize_file_ftype _initialize_i386_linux_nat;
@@ -1138,7 +1149,7 @@ _initialize_i386_linux_nat (void)
t->to_enable_btrace = i386_linux_enable_btrace;
t->to_disable_btrace = i386_linux_disable_btrace;
t->to_teardown_btrace = i386_linux_teardown_btrace;
- t->to_read_btrace = linux_read_btrace;
+ t->to_read_btrace = i386_linux_read_btrace;
/* Register the target. */
linux_nat_add_target (t);
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 054e279..fd03a9f 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -372,7 +372,7 @@ inf_child_fileio_readlink (struct target_ops *self,
}
static int
-inf_child_use_agent (int use)
+inf_child_use_agent (struct target_ops *self, int use)
{
if (agent_loaded_p ())
{
@@ -384,7 +384,7 @@ inf_child_use_agent (int use)
}
static int
-inf_child_can_use_agent (void)
+inf_child_can_use_agent (struct target_ops *self)
{
return agent_loaded_p ();
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index a1dc8fa..e0d6bd0 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4392,7 +4392,8 @@ cleanup_target_stop (void *arg)
}
static VEC(static_tracepoint_marker_p) *
-linux_child_static_tracepoint_markers_by_strid (const char *strid)
+linux_child_static_tracepoint_markers_by_strid (struct target_ops *self,
+ const char *strid)
{
char s[IPA_CMD_BUF_SIZE];
struct cleanup *old_chain;
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 94ff83d..9f7951d 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -195,7 +195,7 @@ record_btrace_open (char *args, int from_tty)
/* The to_stop_recording method of target record-btrace. */
static void
-record_btrace_stop_recording (void)
+record_btrace_stop_recording (struct target_ops *self)
{
struct thread_info *tp;
@@ -228,7 +228,7 @@ record_btrace_close (struct target_ops *self)
/* The to_info_record method of target record-btrace. */
static void
-record_btrace_info (void)
+record_btrace_info (struct target_ops *self)
{
struct btrace_thread_info *btinfo;
struct thread_info *tp;
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 755c815..2b62f3e 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1770,7 +1770,7 @@ record_full_execution_direction (struct target_ops *self)
}
static void
-record_full_info (void)
+record_full_info (struct target_ops *self)
{
struct record_full_entry *p;
diff --git a/gdb/record.c b/gdb/record.c
index 41e167f..9dd02e8 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -115,7 +115,7 @@ record_stop (struct target_ops *t)
DEBUG ("stop %s", t->to_shortname);
if (t->to_stop_recording != NULL)
- t->to_stop_recording ();
+ t->to_stop_recording (t);
}
/* Unpush the record target. */
@@ -287,7 +287,7 @@ info_record_command (char *args, int from_tty)
printf_filtered (_("Active record target: %s\n"), t->to_shortname);
if (t->to_info_record != NULL)
- t->to_info_record ();
+ t->to_info_record (t);
}
/* The "record save" command. */
diff --git a/gdb/remote.c b/gdb/remote.c
index ce9bfd4..e2cefe0 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2986,7 +2986,8 @@ remote_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR addr,
}
static VEC(static_tracepoint_marker_p) *
-remote_static_tracepoint_markers_by_strid (const char *strid)
+remote_static_tracepoint_markers_by_strid (struct target_ops *self,
+ const char *strid)
{
struct remote_state *rs = get_remote_state ();
VEC(static_tracepoint_marker_p) *markers = NULL;
@@ -11243,7 +11244,7 @@ remote_set_circular_trace_buffer (struct target_ops *self, int val)
}
static struct traceframe_info *
-remote_traceframe_info (void)
+remote_traceframe_info (struct target_ops *self)
{
char *text;
@@ -11381,7 +11382,7 @@ remote_set_trace_notes (struct target_ops *self,
}
static int
-remote_use_agent (int use)
+remote_use_agent (struct target_ops *self, int use)
{
if (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE)
{
@@ -11403,7 +11404,7 @@ remote_use_agent (int use)
}
static int
-remote_can_use_agent (void)
+remote_can_use_agent (struct target_ops *self)
{
return (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE);
}
@@ -11432,7 +11433,7 @@ remote_supports_btrace (struct target_ops *self)
/* Enable branch tracing. */
static struct btrace_target_info *
-remote_enable_btrace (ptid_t ptid)
+remote_enable_btrace (struct target_ops *self, ptid_t ptid)
{
struct btrace_target_info *tinfo = NULL;
struct packet_config *packet = &remote_protocol_packets[PACKET_Qbtrace_bts];
@@ -11468,7 +11469,8 @@ remote_enable_btrace (ptid_t ptid)
/* Disable branch tracing. */
static void
-remote_disable_btrace (struct btrace_target_info *tinfo)
+remote_disable_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
struct packet_config *packet = &remote_protocol_packets[PACKET_Qbtrace_off];
struct remote_state *rs = get_remote_state ();
@@ -11500,7 +11502,8 @@ remote_disable_btrace (struct btrace_target_info *tinfo)
/* Teardown branch tracing. */
static void
-remote_teardown_btrace (struct btrace_target_info *tinfo)
+remote_teardown_btrace (struct target_ops *self,
+ struct btrace_target_info *tinfo)
{
/* We must not talk to the target during teardown. */
xfree (tinfo);
@@ -11509,7 +11512,8 @@ remote_teardown_btrace (struct btrace_target_info *tinfo)
/* Read the branch trace. */
static enum btrace_error
-remote_read_btrace (VEC (btrace_block_s) **btrace,
+remote_read_btrace (struct target_ops *self,
+ VEC (btrace_block_s) **btrace,
struct btrace_target_info *tinfo,
enum btrace_read_type type)
{
diff --git a/gdb/target.c b/gdb/target.c
index 379c4d2..ab4f1ff 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -928,10 +928,11 @@ update_current_target (void)
CORE_ADDR, struct static_tracepoint_marker *))
return_zero);
de_fault (to_static_tracepoint_markers_by_strid,
- (VEC(static_tracepoint_marker_p) * (*) (const char *))
+ (VEC(static_tracepoint_marker_p) * (*) (struct target_ops *,
+ const char *))
tcomplain);
de_fault (to_traceframe_info,
- (struct traceframe_info * (*) (void))
+ (struct traceframe_info * (*) (struct target_ops *))
return_null);
de_fault (to_supports_evaluation_of_breakpoint_conditions,
(int (*) (struct target_ops *))
@@ -940,10 +941,10 @@ update_current_target (void)
(int (*) (struct target_ops *))
return_zero);
de_fault (to_use_agent,
- (int (*) (int))
+ (int (*) (struct target_ops *, int))
tcomplain);
de_fault (to_can_use_agent,
- (int (*) (void))
+ (int (*) (struct target_ops *))
return_zero);
de_fault (to_augmented_libraries_svr4_read,
(int (*) (void))
@@ -4137,7 +4138,7 @@ target_enable_btrace (ptid_t ptid)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_enable_btrace != NULL)
- return t->to_enable_btrace (ptid);
+ return t->to_enable_btrace (t, ptid);
tcomplain ();
return NULL;
@@ -4153,7 +4154,7 @@ target_disable_btrace (struct btrace_target_info *btinfo)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_disable_btrace != NULL)
{
- t->to_disable_btrace (btinfo);
+ t->to_disable_btrace (t, btinfo);
return;
}
@@ -4170,7 +4171,7 @@ target_teardown_btrace (struct btrace_target_info *btinfo)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_teardown_btrace != NULL)
{
- t->to_teardown_btrace (btinfo);
+ t->to_teardown_btrace (t, btinfo);
return;
}
@@ -4188,7 +4189,7 @@ target_read_btrace (VEC (btrace_block_s) **btrace,
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_read_btrace != NULL)
- return t->to_read_btrace (btrace, btinfo, type);
+ return t->to_read_btrace (t, btrace, btinfo, type);
tcomplain ();
return BTRACE_ERR_NOT_SUPPORTED;
@@ -4204,7 +4205,7 @@ target_stop_recording (void)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_stop_recording != NULL)
{
- t->to_stop_recording ();
+ t->to_stop_recording (t);
return;
}
@@ -4221,7 +4222,7 @@ target_info_record (void)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_info_record != NULL)
{
- t->to_info_record ();
+ t->to_info_record (t);
return;
}
diff --git a/gdb/target.h b/gdb/target.h
index 56fbd96..572671c 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -860,7 +860,7 @@ 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)
- (const char *id);
+ (struct target_ops *, const char *id);
/* Return a traceframe info object describing the current
traceframe's contents. If the target doesn't support
@@ -875,14 +875,14 @@ 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) (void);
+ struct traceframe_info *(*to_traceframe_info) (struct target_ops *);
/* Ask the target to use or not to use agent according to USE. Return 1
successful, 0 otherwise. */
- int (*to_use_agent) (int use);
+ int (*to_use_agent) (struct target_ops *, int use);
/* Is the target able to use agent in current state? */
- int (*to_can_use_agent) (void);
+ int (*to_can_use_agent) (struct target_ops *);
/* Check whether the target supports branch tracing. */
int (*to_supports_btrace) (struct target_ops *)
@@ -890,30 +890,34 @@ struct target_ops
/* Enable branch tracing for PTID and allocate a branch trace target
information struct for reading and for disabling branch trace. */
- struct btrace_target_info *(*to_enable_btrace) (ptid_t ptid);
+ struct btrace_target_info *(*to_enable_btrace) (struct target_ops *,
+ ptid_t ptid);
/* Disable branch tracing and deallocate TINFO. */
- void (*to_disable_btrace) (struct btrace_target_info *tinfo);
+ void (*to_disable_btrace) (struct target_ops *,
+ struct btrace_target_info *tinfo);
/* Disable branch tracing and deallocate TINFO. This function is similar
to to_disable_btrace, except that it is called during teardown and is
only allowed to perform actions that are safe. A counter-example would
be attempting to talk to a remote target. */
- void (*to_teardown_btrace) (struct btrace_target_info *tinfo);
+ void (*to_teardown_btrace) (struct target_ops *,
+ struct btrace_target_info *tinfo);
/* Read branch trace data for the thread indicated by BTINFO into DATA.
DATA is cleared before new trace is added.
The branch trace will start with the most recent block and continue
towards older blocks. */
- enum btrace_error (*to_read_btrace) (VEC (btrace_block_s) **data,
+ enum btrace_error (*to_read_btrace) (struct target_ops *self,
+ VEC (btrace_block_s) **data,
struct btrace_target_info *btinfo,
enum btrace_read_type type);
/* Stop trace recording. */
- void (*to_stop_recording) (void);
+ void (*to_stop_recording) (struct target_ops *);
/* Print information about the recording. */
- void (*to_info_record) (void);
+ void (*to_info_record) (struct target_ops *);
/* Save the recorded execution trace into a file. */
void (*to_save_record) (const char *filename);
@@ -1859,16 +1863,17 @@ extern char *target_fileio_read_stralloc (const char *filename);
addr, marker)
#define target_static_tracepoint_markers_by_strid(marker_id) \
- (*current_target.to_static_tracepoint_markers_by_strid) (marker_id)
+ (*current_target.to_static_tracepoint_markers_by_strid) (¤t_target, \
+ marker_id)
#define target_traceframe_info() \
- (*current_target.to_traceframe_info) ()
+ (*current_target.to_traceframe_info) (¤t_target)
#define target_use_agent(use) \
- (*current_target.to_use_agent) (use)
+ (*current_target.to_use_agent) (¤t_target, use)
#define target_can_use_agent() \
- (*current_target.to_can_use_agent) ()
+ (*current_target.to_can_use_agent) (¤t_target)
#define target_augmented_libraries_svr4_read() \
(*current_target.to_augmented_libraries_svr4_read) ()
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index a3d5405..e745edb 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -5325,7 +5325,7 @@ build_traceframe_info (char blocktype, void *data)
}
static struct traceframe_info *
-tfile_traceframe_info (void)
+tfile_traceframe_info (struct target_ops *self)
{
struct traceframe_info *info = XCNEW (struct traceframe_info);
--
1.8.1.4