[PATCH v10 13/28] Add target_ops argument to to_prepare_to_store

Markus Metzger
2014-01-14T08:05:24Z

2013-12-17 Tom Tromey <tromey@redhat.com>

* windows-nat.c (windows_prepare_to_store): Add 'self' argument.
* target.h (struct target_ops) <to_prepare_to_store>: Add
argument.
(target_prepare_to_store): Add argument.
* target.c (debug_to_prepare_to_store): Add argument.
(update_current_target): Update.
* remote.c (remote_prepare_to_store): Add 'self' argument.
* remote-sim.c (gdbsim_prepare_to_store): Add 'self' argument.
* remote-mips.c (mips_prepare_to_store): Add 'self' argument.
* remote-m32r-sdi.c (m32r_prepare_to_store): Add 'self' argument.
* record-full.c (record_full_core_prepare_to_store): Add 'self'
argument.
* ravenscar-thread.c (ravenscar_prepare_to_store): Add argument.
* nto-procfs.c (procfs_prepare_to_store): Add 'self' argument.
* monitor.c (monitor_prepare_to_store): Add 'self' argument.
* inf-child.c (inf_child_prepare_to_store): Add 'self' argument.
* go32-nat.c (go32_prepare_to_store): Add 'self' argument.

---
gdb/go32-nat.c | 5 +++--
gdb/inf-child.c | 3 ++-
gdb/monitor.c | 2 +-
gdb/nto-procfs.c | 2 +-
gdb/ravenscar-thread.c | 8 +++++---
gdb/record-full.c | 3 ++-
gdb/remote-m32r-sdi.c | 2 +-
gdb/remote-mips.c | 5 +++--
gdb/remote-sim.c | 5 +++--
gdb/remote.c | 5 +++--
gdb/target.c | 9 +++++----
gdb/target.h | 4 ++--
gdb/windows-nat.c | 2 +-
13 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 8c8e1c7..aea80e5 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -246,7 +246,8 @@ static void go32_fetch_registers (struct target_ops *ops,
static void store_register (const struct regcache *, int regno);
static void go32_store_registers (struct target_ops *ops,
struct regcache *, int regno);
-static void go32_prepare_to_store (struct regcache *);
+static void go32_prepare_to_store (struct target_ops *self,
+ struct regcache *);
static int go32_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
int write,
struct mem_attrib *attrib,
@@ -598,7 +599,7 @@ go32_store_registers (struct target_ops *ops,
}

static void
-go32_prepare_to_store (struct regcache *regcache)
+go32_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
}

diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 75944a0..549e44a 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -100,7 +100,8 @@ inf_child_post_attach (int pid)
program being debugged. */

static void
-inf_child_prepare_to_store (struct regcache *regcache)
+inf_child_prepare_to_store (struct target_ops *self,
+ struct regcache *regcache)
{
}

diff --git a/gdb/monitor.c b/gdb/monitor.c
index c86f040b..bbb06c6 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -1427,7 +1427,7 @@ monitor_store_registers (struct target_ops *ops,
debugged. */

static void
-monitor_prepare_to_store (struct regcache *regcache)
+monitor_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
/* Do nothing, since we can store individual regs. */
}
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index dee4988..c2d0d30 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -1229,7 +1229,7 @@ procfs_kill_inferior (struct target_ops *ops)
/* Store register REGNO, or all registers if REGNO == -1, from the contents
of REGISTERS. */
static void
-procfs_prepare_to_store (struct regcache *regcache)
+procfs_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
}

diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 3fdca52..fc87d79 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -62,7 +62,8 @@ static void ravenscar_fetch_registers (struct target_ops *ops,
struct regcache *regcache, int regnum);
static void ravenscar_store_registers (struct target_ops *ops,
struct regcache *regcache, int regnum);
-static void ravenscar_prepare_to_store (struct regcache *regcache);
+static void ravenscar_prepare_to_store (struct target_ops *self,
+ struct regcache *regcache);
static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
enum gdb_signal siggnal);
static void ravenscar_mourn_inferior (struct target_ops *ops);
@@ -303,14 +304,15 @@ ravenscar_store_registers (struct target_ops *ops,
}

static void
-ravenscar_prepare_to_store (struct regcache *regcache)
+ravenscar_prepare_to_store (struct target_ops *self,
+ struct regcache *regcache)
{
struct target_ops *beneath = find_target_beneath (&ravenscar_ops);

if (!ravenscar_runtime_initialized ()
|| ptid_equal (inferior_ptid, base_magic_null_ptid)
|| ptid_equal (inferior_ptid, ravenscar_running_thread ()))
- beneath->to_prepare_to_store (regcache);
+ beneath->to_prepare_to_store (beneath, regcache);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 3fb77ef..ce0504e 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2135,7 +2135,8 @@ record_full_core_fetch_registers (struct target_ops *ops,
/* "to_prepare_to_store" method for prec over corefile. */

static void
-record_full_core_prepare_to_store (struct regcache *regcache)
+record_full_core_prepare_to_store (struct target_ops *self,
+ struct regcache *regcache)
{
}

diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 7b122d7..9364b5f 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1012,7 +1012,7 @@ m32r_store_register (struct target_ops *ops,
debugged. */

static void
-m32r_prepare_to_store (struct regcache *regcache)
+m32r_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
/* Do nothing, since we can store individual regs. */
if (remote_debug)
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 04c4a40..adf2643 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -90,7 +90,8 @@ static int mips_map_regno (struct gdbarch *, int);

static void mips_set_register (int regno, ULONGEST value);

-static void mips_prepare_to_store (struct regcache *regcache);
+static void mips_prepare_to_store (struct target_ops *self,
+ struct regcache *regcache);

static int mips_fetch_word (CORE_ADDR addr, unsigned int *valp);

@@ -2064,7 +2065,7 @@ mips_fetch_registers (struct target_ops *ops,
registers, so this function doesn't have to do anything. */

static void
-mips_prepare_to_store (struct regcache *regcache)
+mips_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
}

diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 7263727..3e7fd20 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -81,7 +81,8 @@ static void gdbsim_close (void);
static void gdbsim_detach (struct target_ops *ops, const char *args,
int from_tty);

-static void gdbsim_prepare_to_store (struct regcache *regcache);
+static void gdbsim_prepare_to_store (struct target_ops *self,
+ struct regcache *regcache);

static void gdbsim_files_info (struct target_ops *target);

@@ -1052,7 +1053,7 @@ gdbsim_wait (struct target_ops *ops,
debugged. */

static void
-gdbsim_prepare_to_store (struct regcache *regcache)
+gdbsim_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
/* Do nothing, since we can store individual regs. */
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 4250404..4370f6d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -97,7 +97,8 @@ static void async_handle_remote_sigint_twice (int);

static void remote_files_info (struct target_ops *ignore);

-static void remote_prepare_to_store (struct regcache *regcache);
+static void remote_prepare_to_store (struct target_ops *self,
+ struct regcache *regcache);

static void remote_open (char *name, int from_tty);

@@ -6466,7 +6467,7 @@ remote_fetch_registers (struct target_ops *ops,
first. */

static void
-remote_prepare_to_store (struct regcache *regcache)
+remote_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
diff --git a/gdb/target.c b/gdb/target.c
index 42a8741..36064ca 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -85,7 +85,8 @@ static struct target_ops debug_target;

static void debug_to_open (char *, int);

-static void debug_to_prepare_to_store (struct regcache *);
+static void debug_to_prepare_to_store (struct target_ops *self,
+ struct regcache *);

static void debug_to_files_info (struct target_ops *);

@@ -716,7 +717,7 @@ update_current_target (void)
(void (*) (int))
target_ignore);
de_fault (to_prepare_to_store,
- (void (*) (struct regcache *))
+ (void (*) (struct target_ops *, struct regcache *))
noprocess);
de_fault (deprecated_xfer_memory,
(int (*) (CORE_ADDR, gdb_byte *, int, int,
@@ -4463,9 +4464,9 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
}

static void
-debug_to_prepare_to_store (struct regcache *regcache)
+debug_to_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
- debug_target.to_prepare_to_store (regcache);
+ debug_target.to_prepare_to_store (&debug_target, regcache);

fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
}
diff --git a/gdb/target.h b/gdb/target.h
index 7e14075..757a927 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -374,7 +374,7 @@ struct target_ops
ptid_t, struct target_waitstatus *, int);
void (*to_fetch_registers) (struct target_ops *, struct regcache *, int);
void (*to_store_registers) (struct target_ops *, struct regcache *, int);
- void (*to_prepare_to_store) (struct regcache *);
+ void (*to_prepare_to_store) (struct target_ops *, struct regcache *);

/* Transfer LEN bytes of memory between GDB address MYADDR and
target address MEMADDR. If WRITE, transfer them to the target, else
@@ -1006,7 +1006,7 @@ extern void target_store_registers (struct regcache *regcache, int regs);
debugged. */

#define target_prepare_to_store(regcache) \
- (*current_target.to_prepare_to_store) (regcache)
+ (*current_target.to_prepare_to_store) (&current_target, regcache)

/* Determine current address space of thread PTID. */

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index b42e5df..28f421a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2468,7 +2468,7 @@ windows_kill_inferior (struct target_ops *ops)
}

static void
-windows_prepare_to_store (struct regcache *regcache)
+windows_prepare_to_store (struct target_ops *self, struct regcache *regcache)
{
/* Do nothing, since we can store individual regs. */
}
--
1.8.3.1