This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC 18/32] Add target_ops argument to to_save_record
- 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:33 -0700
- Subject: [RFC 18/32] Add target_ops argument to to_save_record
- 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.h (struct target_ops) <to_save_record>: Add argument.
* target.c (target_save_record): Add argument.
* record-full.c (record_full_save): Add 'self' argument.
(record_full_save): Add 'self' argument.
Add target_ops argument to to_delete_record
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_delete_record>: Add argument.
* target.c (target_delete_record): Add argument.
* record-full.c (record_full_delete): Add 'self' argument.
Add target_ops argument to to_record_is_replaying
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_record_is_replaying>: Add
argument.
* target.c (target_record_is_replaying): Add argument.
* record-full.c (record_full_is_replaying): Add 'self' argument.
Add target_ops argument to to_goto_record_begin
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_goto_record_begin>: Add
argument.
* target.c (target_goto_record_begin): Add argument.
* record-full.c (record_full_goto_begin): Add 'self' argument.
Add target_ops argument to to_goto_record_end
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_goto_record_end>: Add argument.
* target.c (target_goto_record_end): Add argument.
* record-full.c (record_full_goto_end): Add 'self' argument.
Add target_ops argument to to_goto_record
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_goto_record>: Add argument.
* target.c (target_goto_record): Add argument.
* record-full.c (record_full_goto): Add 'self' argument.
Add target_ops argument to to_insn_history
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_insn_history>: Add argument.
* target.c (target_insn_history): Add argument.
* record-btrace.c (record_btrace_insn_history): Add 'self'
argument.
Add target_ops argument to to_insn_history_from
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_insn_history_from>: Add
argument.
* target.c (target_insn_history_from): Add argument.
* record-btrace.c (record_btrace_insn_history_from): Add 'self'
argument.
Add target_ops argument to to_insn_history_range
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_insn_history_range>: Add
argument.
* target.c (target_insn_history_range): Add argument.
* record-btrace.c (record_btrace_insn_history_range): Add 'self'
argument.
(record_btrace_insn_history_from): Update.
Add target_ops argument to to_call_history
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_call_history>: Add argument.
* target.c (target_call_history): Add argument.
* record-btrace.c (record_btrace_call_history): Add 'self'
argument.
Add target_ops argument to to_call_history_from
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_call_history_from>: Add
argument.
* target.c (target_call_history_from): Add argument.
* record-btrace.c (record_btrace_call_history_from): Add 'self'
argument.
Add target_ops argument to to_call_history_range
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_call_history_range>: Add
argument.
* target.c (target_call_history_range): Add argument.
* record-btrace.c (record_btrace_call_history_range): Add 'self'
argument.
(record_btrace_call_history_from): Update.
Add target_ops argument to to_augmented_libraries_svr4_read
2014-01-08 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_augmented_libraries_svr4_read>:
Add argument.
(target_augmented_libraries_svr4_read): Add argument.
* target.c (update_current_target): Update.
* remote.c (remote_augmented_libraries_svr4_read): Add 'self'
argument.
---
gdb/ChangeLog | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
gdb/record-btrace.c | 20 ++++++-----
gdb/record-full.c | 15 +++++----
gdb/remote.c | 2 +-
gdb/target.c | 26 +++++++--------
gdb/target.h | 32 ++++++++++--------
6 files changed, 148 insertions(+), 43 deletions(-)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index c99e7c2..d536fea 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -263,7 +263,7 @@ btrace_insn_history (struct btrace_thread_info *btinfo, struct ui_out *uiout,
/* The to_insn_history method of target record-btrace. */
static void
-record_btrace_insn_history (int size, int flags)
+record_btrace_insn_history (struct target_ops *self, int size, int flags)
{
struct btrace_thread_info *btinfo;
struct cleanup *uiout_cleanup;
@@ -338,7 +338,8 @@ record_btrace_insn_history (int size, int flags)
/* The to_insn_history_range method of target record-btrace. */
static void
-record_btrace_insn_history_range (ULONGEST from, ULONGEST to, int flags)
+record_btrace_insn_history_range (struct target_ops *self,
+ ULONGEST from, ULONGEST to, int flags)
{
struct btrace_thread_info *btinfo;
struct cleanup *uiout_cleanup;
@@ -381,7 +382,8 @@ record_btrace_insn_history_range (ULONGEST from, ULONGEST to, int flags)
/* The to_insn_history_from method of target record-btrace. */
static void
-record_btrace_insn_history_from (ULONGEST from, int size, int flags)
+record_btrace_insn_history_from (struct target_ops *self,
+ ULONGEST from, int size, int flags)
{
ULONGEST begin, end, context;
@@ -406,7 +408,7 @@ record_btrace_insn_history_from (ULONGEST from, int size, int flags)
end = ULONGEST_MAX;
}
- record_btrace_insn_history_range (begin, end, flags);
+ record_btrace_insn_history_range (self, begin, end, flags);
}
/* Print the instruction number range for a function call history line. */
@@ -492,7 +494,7 @@ btrace_func_history (struct btrace_thread_info *btinfo, struct ui_out *uiout,
/* The to_call_history method of target record-btrace. */
static void
-record_btrace_call_history (int size, int flags)
+record_btrace_call_history (struct target_ops *self, int size, int flags)
{
struct btrace_thread_info *btinfo;
struct cleanup *uiout_cleanup;
@@ -567,7 +569,8 @@ record_btrace_call_history (int size, int flags)
/* The to_call_history_range method of target record-btrace. */
static void
-record_btrace_call_history_range (ULONGEST from, ULONGEST to, int flags)
+record_btrace_call_history_range (struct target_ops *self,
+ ULONGEST from, ULONGEST to, int flags)
{
struct btrace_thread_info *btinfo;
struct cleanup *uiout_cleanup;
@@ -610,7 +613,8 @@ record_btrace_call_history_range (ULONGEST from, ULONGEST to, int flags)
/* The to_call_history_from method of target record-btrace. */
static void
-record_btrace_call_history_from (ULONGEST from, int size, int flags)
+record_btrace_call_history_from (struct target_ops *self,
+ ULONGEST from, int size, int flags)
{
ULONGEST begin, end, context;
@@ -635,7 +639,7 @@ record_btrace_call_history_from (ULONGEST from, int size, int flags)
end = ULONGEST_MAX;
}
- record_btrace_call_history_range (begin, end, flags);
+ record_btrace_call_history_range (self, begin, end, flags);
}
/* Initialize the record-btrace target ops. */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 8769795..eedb223 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -217,7 +217,8 @@ static struct cmd_list_element *record_full_cmdlist;
static void record_full_goto_insn (struct record_full_entry *entry,
enum exec_direction_kind dir);
-static void record_full_save (const char *recfilename);
+static void record_full_save (struct target_ops *self,
+ const char *recfilename);
/* Alloc and free functions for record_full_reg, record_full_mem, and
record_full_end entries. */
@@ -1792,7 +1793,7 @@ record_full_info (struct target_ops *self)
/* The "to_record_delete" target method. */
static void
-record_full_delete (void)
+record_full_delete (struct target_ops *self)
{
record_full_list_release_following (record_full_list);
}
@@ -1800,7 +1801,7 @@ record_full_delete (void)
/* The "to_record_is_replaying" target method. */
static int
-record_full_is_replaying (void)
+record_full_is_replaying (struct target_ops *self)
{
return RECORD_FULL_IS_REPLAY;
}
@@ -1835,7 +1836,7 @@ record_full_goto_entry (struct record_full_entry *p)
/* The "to_goto_record_begin" target method. */
static void
-record_full_goto_begin (void)
+record_full_goto_begin (struct target_ops *self)
{
struct record_full_entry *p = NULL;
@@ -1849,7 +1850,7 @@ record_full_goto_begin (void)
/* The "to_goto_record_end" target method. */
static void
-record_full_goto_end (void)
+record_full_goto_end (struct target_ops *self)
{
struct record_full_entry *p = NULL;
@@ -1865,7 +1866,7 @@ record_full_goto_end (void)
/* The "to_goto_record" target method. */
static void
-record_full_goto (ULONGEST target_insn)
+record_full_goto (struct target_ops *self, ULONGEST target_insn)
{
struct record_full_entry *p = NULL;
@@ -2454,7 +2455,7 @@ record_full_save_cleanups (void *data)
format, with an extra section for our data. */
static void
-record_full_save (const char *recfilename)
+record_full_save (struct target_ops *self, const char *recfilename)
{
struct record_full_entry *cur_record_full_list;
uint32_t magic;
diff --git a/gdb/remote.c b/gdb/remote.c
index 5721178..34b8f6d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11501,7 +11501,7 @@ remote_read_btrace (struct target_ops *self, struct btrace_target_info *tinfo,
}
static int
-remote_augmented_libraries_svr4_read (void)
+remote_augmented_libraries_svr4_read (struct target_ops *self)
{
struct remote_state *rs = get_remote_state ();
diff --git a/gdb/target.c b/gdb/target.c
index 4a698fe..1f3562f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -943,7 +943,7 @@ update_current_target (void)
(int (*) (struct target_ops *))
return_zero);
de_fault (to_augmented_libraries_svr4_read,
- (int (*) (void))
+ (int (*) (struct target_ops *))
return_zero);
de_fault (to_execution_direction, default_execution_direction);
@@ -4220,7 +4220,7 @@ target_save_record (const char *filename)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_save_record != NULL)
{
- t->to_save_record (filename);
+ t->to_save_record (t, filename);
return;
}
@@ -4251,7 +4251,7 @@ target_delete_record (void)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_delete_record != NULL)
{
- t->to_delete_record ();
+ t->to_delete_record (t);
return;
}
@@ -4267,7 +4267,7 @@ target_record_is_replaying (void)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_record_is_replaying != NULL)
- return t->to_record_is_replaying ();
+ return t->to_record_is_replaying (t);
return 0;
}
@@ -4282,7 +4282,7 @@ target_goto_record_begin (void)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_goto_record_begin != NULL)
{
- t->to_goto_record_begin ();
+ t->to_goto_record_begin (t);
return;
}
@@ -4299,7 +4299,7 @@ target_goto_record_end (void)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_goto_record_end != NULL)
{
- t->to_goto_record_end ();
+ t->to_goto_record_end (t);
return;
}
@@ -4316,7 +4316,7 @@ target_goto_record (ULONGEST insn)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_goto_record != NULL)
{
- t->to_goto_record (insn);
+ t->to_goto_record (t, insn);
return;
}
@@ -4333,7 +4333,7 @@ target_insn_history (int size, int flags)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_insn_history != NULL)
{
- t->to_insn_history (size, flags);
+ t->to_insn_history (t, size, flags);
return;
}
@@ -4350,7 +4350,7 @@ target_insn_history_from (ULONGEST from, int size, int flags)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_insn_history_from != NULL)
{
- t->to_insn_history_from (from, size, flags);
+ t->to_insn_history_from (t, from, size, flags);
return;
}
@@ -4367,7 +4367,7 @@ target_insn_history_range (ULONGEST begin, ULONGEST end, int flags)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_insn_history_range != NULL)
{
- t->to_insn_history_range (begin, end, flags);
+ t->to_insn_history_range (t, begin, end, flags);
return;
}
@@ -4384,7 +4384,7 @@ target_call_history (int size, int flags)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_call_history != NULL)
{
- t->to_call_history (size, flags);
+ t->to_call_history (t, size, flags);
return;
}
@@ -4401,7 +4401,7 @@ target_call_history_from (ULONGEST begin, int size, int flags)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_call_history_from != NULL)
{
- t->to_call_history_from (begin, size, flags);
+ t->to_call_history_from (t, begin, size, flags);
return;
}
@@ -4418,7 +4418,7 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_call_history_range != NULL)
{
- t->to_call_history_range (begin, end, flags);
+ t->to_call_history_range (t, begin, end, flags);
return;
}
diff --git a/gdb/target.h b/gdb/target.h
index ca70a9e..4668c23 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -911,57 +911,61 @@ struct target_ops
void (*to_info_record) (struct target_ops *);
/* Save the recorded execution trace into a file. */
- void (*to_save_record) (const char *filename);
+ void (*to_save_record) (struct target_ops *, const char *filename);
/* Delete the recorded execution trace from the current position onwards. */
- void (*to_delete_record) (void);
+ void (*to_delete_record) (struct target_ops *);
/* Query if the record target is currently replaying. */
- int (*to_record_is_replaying) (void);
+ int (*to_record_is_replaying) (struct target_ops *);
/* Go to the begin of the execution trace. */
- void (*to_goto_record_begin) (void);
+ void (*to_goto_record_begin) (struct target_ops *);
/* Go to the end of the execution trace. */
- void (*to_goto_record_end) (void);
+ void (*to_goto_record_end) (struct target_ops *);
/* Go to a specific location in the recorded execution trace. */
- void (*to_goto_record) (ULONGEST insn);
+ void (*to_goto_record) (struct target_ops *, ULONGEST insn);
/* Disassemble SIZE instructions in the recorded execution trace from
the current position.
If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
disassemble SIZE succeeding instructions. */
- void (*to_insn_history) (int size, int flags);
+ void (*to_insn_history) (struct target_ops *, int size, int flags);
/* Disassemble SIZE instructions in the recorded execution trace around
FROM.
If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
disassemble SIZE instructions after FROM. */
- void (*to_insn_history_from) (ULONGEST from, int size, int flags);
+ void (*to_insn_history_from) (struct target_ops *,
+ ULONGEST from, int size, int flags);
/* Disassemble a section of the recorded execution trace from instruction
BEGIN (inclusive) to instruction END (exclusive). */
- void (*to_insn_history_range) (ULONGEST begin, ULONGEST end, int flags);
+ void (*to_insn_history_range) (struct target_ops *,
+ ULONGEST begin, ULONGEST end, int flags);
/* Print a function trace of the recorded execution trace.
If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
succeeding functions. */
- void (*to_call_history) (int size, int flags);
+ void (*to_call_history) (struct target_ops *, int size, int flags);
/* Print a function trace of the recorded execution trace starting
at function FROM.
If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
SIZE functions after FROM. */
- void (*to_call_history_from) (ULONGEST begin, int size, int flags);
+ void (*to_call_history_from) (struct target_ops *,
+ ULONGEST begin, int size, int flags);
/* Print a function trace of an execution trace section from function BEGIN
(inclusive) to function END (exclusive). */
- void (*to_call_history_range) (ULONGEST begin, ULONGEST end, int flags);
+ void (*to_call_history_range) (struct target_ops *,
+ ULONGEST begin, ULONGEST end, int flags);
/* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
non-empty annex. */
- int (*to_augmented_libraries_svr4_read) (void);
+ int (*to_augmented_libraries_svr4_read) (struct target_ops *);
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
@@ -1849,7 +1853,7 @@ extern char *target_fileio_read_stralloc (const char *filename);
(*current_target.to_can_use_agent) (¤t_target)
#define target_augmented_libraries_svr4_read() \
- (*current_target.to_augmented_libraries_svr4_read) ()
+ (*current_target.to_augmented_libraries_svr4_read) (¤t_target)
/* Command logging facility. */
--
1.8.1.4