This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC v2 17/38] Add target_ops argument to to_save_record


2014-02-06  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-02-06  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-02-06  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.
	* record-btrace.c (record_btrace_is_replaying): Add 'self'
	argument.
	(record_btrace_xfer_partial, record_btrace_store_registers)
	(record_btrace_prepare_to_store, record_btrace_resume)
	(record_btrace_wait, record_btrace_decr_pc_after_break)
	(record_btrace_find_new_threads, record_btrace_thread_alive):
	Update.

Add target_ops argument to to_goto_record_begin

2014-02-06  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.
	* record-btrace.c (record_btrace_goto_begin): Add 'self'
	argument.

Add target_ops argument to to_goto_record_end

2014-02-06  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.
	* record-btrace.c (record_btrace_goto_end): Add 'self' argument.

Add target_ops argument to to_goto_record

2014-02-06  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.
	* record-btrace.c (record_btrace_goto): Add 'self' argument.

Add target_ops argument to to_insn_history

2014-02-06  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-02-06  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-02-06  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-02-06  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-02-06  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-02-06  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-02-06  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       | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/record-btrace.c |  44 +++++++++++----------
 gdb/record-full.c   |  15 ++++----
 gdb/remote.c        |   2 +-
 gdb/target.c        |  26 ++++++-------
 gdb/target.h        |  32 +++++++++-------
 6 files changed, 171 insertions(+), 55 deletions(-)

diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 9f7951d..44882ad 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -312,7 +312,7 @@ btrace_insn_history (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 btrace_insn_history *history;
@@ -398,7 +398,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 btrace_insn_history *history;
@@ -450,7 +451,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;
 
@@ -477,7 +479,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.  */
@@ -615,7 +617,7 @@ btrace_call_history (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 btrace_call_history *history;
@@ -704,7 +706,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 btrace_call_history *history;
@@ -756,7 +759,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;
 
@@ -783,13 +787,13 @@ 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);
 }
 
 /* The to_record_is_replaying method of target record-btrace.  */
 
 static int
-record_btrace_is_replaying (void)
+record_btrace_is_replaying (struct target_ops *self)
 {
   struct thread_info *tp;
 
@@ -811,7 +815,7 @@ record_btrace_xfer_partial (struct target_ops *ops, enum target_object object,
   struct target_ops *t;
 
   /* Filter out requests that don't make sense during replay.  */
-  if (!record_btrace_allow_memory_access && record_btrace_is_replaying ())
+  if (!record_btrace_allow_memory_access && record_btrace_is_replaying (ops))
     {
       switch (object)
 	{
@@ -960,7 +964,7 @@ record_btrace_store_registers (struct target_ops *ops,
 {
   struct target_ops *t;
 
-  if (record_btrace_is_replaying ())
+  if (record_btrace_is_replaying (ops))
     error (_("This record target does not allow writing registers."));
 
   gdb_assert (may_write_registers != 0);
@@ -983,7 +987,7 @@ record_btrace_prepare_to_store (struct target_ops *ops,
 {
   struct target_ops *t;
 
-  if (record_btrace_is_replaying ())
+  if (record_btrace_is_replaying (ops))
     return;
 
   for (t = ops->beneath; t != NULL; t = t->beneath)
@@ -1457,7 +1461,7 @@ record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step,
       record_btrace_stop_replaying (other);
 
   /* As long as we're not replaying, just forward the request.  */
-  if (!record_btrace_is_replaying () && execution_direction != EXEC_REVERSE)
+  if (!record_btrace_is_replaying (ops) && execution_direction != EXEC_REVERSE)
     {
       for (ops = ops->beneath; ops != NULL; ops = ops->beneath)
 	if (ops->to_resume != NULL)
@@ -1673,7 +1677,7 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid,
   DEBUG ("wait %s (0x%x)", target_pid_to_str (ptid), options);
 
   /* As long as we're not replaying, just forward the request.  */
-  if (!record_btrace_is_replaying () && execution_direction != EXEC_REVERSE)
+  if (!record_btrace_is_replaying (ops) && execution_direction != EXEC_REVERSE)
     {
       for (ops = ops->beneath; ops != NULL; ops = ops->beneath)
 	if (ops->to_wait != NULL)
@@ -1725,7 +1729,7 @@ record_btrace_decr_pc_after_break (struct target_ops *ops,
 {
   /* When replaying, we do not actually execute the breakpoint instruction
      so there is no need to adjust the PC after hitting a breakpoint.  */
-  if (record_btrace_is_replaying ())
+  if (record_btrace_is_replaying (ops))
     return 0;
 
   return forward_target_decr_pc_after_break (ops->beneath, gdbarch);
@@ -1737,7 +1741,7 @@ static void
 record_btrace_find_new_threads (struct target_ops *ops)
 {
   /* Don't expect new threads if we're replaying.  */
-  if (record_btrace_is_replaying ())
+  if (record_btrace_is_replaying (ops))
     return;
 
   /* Forward the request.  */
@@ -1755,7 +1759,7 @@ static int
 record_btrace_thread_alive (struct target_ops *ops, ptid_t ptid)
 {
   /* We don't add or remove threads during replay.  */
-  if (record_btrace_is_replaying ())
+  if (record_btrace_is_replaying (ops))
     return find_thread_ptid (ptid) != NULL;
 
   /* Forward the request.  */
@@ -1797,7 +1801,7 @@ record_btrace_set_replay (struct thread_info *tp,
 /* The to_goto_record_begin method of target record-btrace.  */
 
 static void
-record_btrace_goto_begin (void)
+record_btrace_goto_begin (struct target_ops *self)
 {
   struct thread_info *tp;
   struct btrace_insn_iterator begin;
@@ -1813,7 +1817,7 @@ record_btrace_goto_begin (void)
 /* The to_goto_record_end method of target record-btrace.  */
 
 static void
-record_btrace_goto_end (void)
+record_btrace_goto_end (struct target_ops *ops)
 {
   struct thread_info *tp;
 
@@ -1827,7 +1831,7 @@ record_btrace_goto_end (void)
 /* The to_goto_record method of target record-btrace.  */
 
 static void
-record_btrace_goto (ULONGEST insn)
+record_btrace_goto (struct target_ops *self, ULONGEST insn)
 {
   struct thread_info *tp;
   struct btrace_insn_iterator it;
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 2b62f3e..d3f7279 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -230,7 +230,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.  */
@@ -1816,7 +1817,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);
 }
@@ -1824,7 +1825,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;
 }
@@ -1859,7 +1860,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;
 
@@ -1873,7 +1874,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;
 
@@ -1889,7 +1890,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;
 
@@ -2480,7 +2481,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 e2cefe0..be36234 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11560,7 +11560,7 @@ remote_read_btrace (struct target_ops *self,
 }
 
 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 ab4f1ff..6bfaa58 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -947,7 +947,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);
 
@@ -4239,7 +4239,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;
       }
 
@@ -4270,7 +4270,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;
       }
 
@@ -4286,7 +4286,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;
 }
@@ -4301,7 +4301,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;
       }
 
@@ -4318,7 +4318,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;
       }
 
@@ -4335,7 +4335,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;
       }
 
@@ -4352,7 +4352,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;
       }
 
@@ -4369,7 +4369,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;
       }
 
@@ -4386,7 +4386,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;
       }
 
@@ -4403,7 +4403,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;
       }
 
@@ -4420,7 +4420,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;
       }
 
@@ -4437,7 +4437,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 572671c..9fdd506 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -920,57 +920,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 (inclusive).  */
-    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 (inclusive).  */
-    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 *);
 
     /* Those unwinders are tried before any other arch unwinders.  Use NULL if
        it is not used.  */
@@ -1876,7 +1880,7 @@ extern char *target_fileio_read_stralloc (const char *filename);
   (*current_target.to_can_use_agent) (&current_target)
 
 #define target_augmented_libraries_svr4_read() \
-  (*current_target.to_augmented_libraries_svr4_read) ()
+  (*current_target.to_augmented_libraries_svr4_read) (&current_target)
 
 /* Command logging facility.  */
 
-- 
1.8.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]