diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2017-03-07 13:46:08 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-03-07 16:47:46 -0500 |
commit | a243d6ae94bdc69081e7f8c3a0f55465a8077e28 (patch) | |
tree | 74e470200e6695822f1668073a9100581674ebe8 | |
parent | 0815e83131004e620c789b7f40d953ec1f8c5428 (diff) | |
download | fsf-binutils-gdb-users/simark/ptid-in-fetch-store-regs.zip fsf-binutils-gdb-users/simark/ptid-in-fetch-store-regs.tar.gz fsf-binutils-gdb-users/simark/ptid-in-fetch-store-regs.tar.bz2 |
Pass ptid to to_prepare_to_storeusers/simark/ptid-in-fetch-store-regs
In the same vein as to_fetch_registers and to_store_registers, we can
update to_prepare_to_store to take the ptid of the thread whose register
we want to store as a parameter, rather than reading it from
inferior_ptid.
gdb/ChangeLog:
* target.h (struct target_ops) <to_prepare_to_store>: Add ptid_t
parameter.
(target_prepare_to_store): Likewise.
* target-delegates.c: Re-generate.
* inf-child.c (inf_child_prepare_to_store): Add ptid parameter.
* ppc-ravenscar-thread.c
(ppc_ravenscar_generic_prepare_to_store): Likewise.
* ravenscar-thread.c (ravenscar_prepare_to_store): Add ptid
parameter and use it instead of inferior_ptid.
* ravenscar-thread.h (struct ravenscar_arch_ops)
<to_prepare_to_store>: Add ptid parameter.
* record-btrace.c (record_btrace_prepare_to_store): Add ptid
parameter and use it instead of inferior_ptid.
* record-full.c (record_full_core_prepare_to_store): Add ptid
parameter.
* regcache.c (regcache_raw_write): Pass ptid to
target_prepare_to_store.
* remote-sim.c (gdbsim_prepare_to_store): Add ptid parameter.
* remote.c (remote_prepare_to_store): Add ptid parameter.
* sparc-ravenscar-thread.c (sparc_ravenscar_prepare_to_store):
Add ptid parameter.
-rw-r--r-- | gdb/inf-child.c | 3 | ||||
-rw-r--r-- | gdb/ppc-ravenscar-thread.c | 2 | ||||
-rw-r--r-- | gdb/ravenscar-thread.c | 14 | ||||
-rw-r--r-- | gdb/ravenscar-thread.h | 2 | ||||
-rw-r--r-- | gdb/record-btrace.c | 7 | ||||
-rw-r--r-- | gdb/record-full.c | 3 | ||||
-rw-r--r-- | gdb/regcache.c | 2 | ||||
-rw-r--r-- | gdb/remote-sim.c | 6 | ||||
-rw-r--r-- | gdb/remote.c | 6 | ||||
-rw-r--r-- | gdb/sparc-ravenscar-thread.c | 5 | ||||
-rw-r--r-- | gdb/target-delegates.c | 12 | ||||
-rw-r--r-- | gdb/target.h | 6 |
12 files changed, 40 insertions, 28 deletions
diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 0f128c4..e5bf2f9 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -111,7 +111,8 @@ inf_child_post_attach (struct target_ops *self, int pid) static void inf_child_prepare_to_store (struct target_ops *self, - struct regcache *regcache) + struct regcache *regcache, + ptid_t ptid) { } diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c index 1e4eb03..078182e 100644 --- a/gdb/ppc-ravenscar-thread.c +++ b/gdb/ppc-ravenscar-thread.c @@ -173,7 +173,7 @@ ppc_ravenscar_generic_fetch_registers thread. */ static void -ppc_ravenscar_generic_prepare_to_store (struct regcache *regcache) +ppc_ravenscar_generic_prepare_to_store (struct regcache *regcache, ptid_t ptid) { /* Nothing to do. */ } diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 0660d03..2755457 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -58,7 +58,8 @@ static char *ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp); static int ravenscar_thread_alive (struct target_ops *ops, ptid_t ptid); static void ravenscar_prepare_to_store (struct target_ops *self, - struct regcache *regcache); + struct regcache *regcache, + ptid_t ptid); 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); @@ -302,21 +303,22 @@ ravenscar_store_registers (struct target_ops *ops, static void ravenscar_prepare_to_store (struct target_ops *self, - struct regcache *regcache) + struct regcache *regcache, + ptid_t ptid) { struct target_ops *beneath = find_target_beneath (self); if (!ravenscar_runtime_initialized () - || ptid_equal (inferior_ptid, base_magic_null_ptid) - || ptid_equal (inferior_ptid, ravenscar_running_thread ())) - beneath->to_prepare_to_store (beneath, regcache); + || ptid_equal (ptid, base_magic_null_ptid) + || ptid_equal (ptid, ravenscar_running_thread ())) + beneath->to_prepare_to_store (beneath, regcache, ptid); else { struct gdbarch *gdbarch = get_regcache_arch (regcache); struct ravenscar_arch_ops *arch_ops = gdbarch_ravenscar_ops (gdbarch); - arch_ops->to_prepare_to_store (regcache); + arch_ops->to_prepare_to_store (regcache, ptid); } } diff --git a/gdb/ravenscar-thread.h b/gdb/ravenscar-thread.h index 2df8898..ab2f9a7 100644 --- a/gdb/ravenscar-thread.h +++ b/gdb/ravenscar-thread.h @@ -26,7 +26,7 @@ struct ravenscar_arch_ops { void (*to_fetch_registers) (struct regcache *, ptid_t, int); void (*to_store_registers) (struct regcache *, ptid_t, int); - void (*to_prepare_to_store) (struct regcache *); + void (*to_prepare_to_store) (struct regcache *, ptid_t); }; #endif /* !defined (RAVENSCAR_THREAD_H) */ diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 6c16148..6674eac 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1481,16 +1481,17 @@ record_btrace_store_registers (struct target_ops *ops, static void record_btrace_prepare_to_store (struct target_ops *ops, - struct regcache *regcache) + struct regcache *regcache, + ptid_t ptid) { struct target_ops *t; if (!record_btrace_generating_corefile - && record_btrace_is_replaying (ops, inferior_ptid)) + && record_btrace_is_replaying (ops, ptid)) return; t = ops->beneath; - t->to_prepare_to_store (t, regcache); + t->to_prepare_to_store (t, regcache, ptid); } /* The branch trace frame cache. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index c55fb41..220e996 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -2065,7 +2065,8 @@ record_full_core_fetch_registers (struct target_ops *ops, static void record_full_core_prepare_to_store (struct target_ops *self, - struct regcache *regcache) + struct regcache *regcache, + ptid_t ptid) { } diff --git a/gdb/regcache.c b/gdb/regcache.c index c8eb200..1b01750 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -949,7 +949,7 @@ regcache_raw_write (struct regcache *regcache, int regnum, chain_before_save_inferior = save_inferior_ptid (); inferior_ptid = regcache->ptid; - target_prepare_to_store (regcache); + target_prepare_to_store (regcache, regcache->ptid); regcache_raw_set_cached_value (regcache, regnum, buf); /* Register a cleanup function for invalidating the register after it is diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index b7ecdbb..81626f3 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -82,7 +82,8 @@ static void gdbsim_detach (struct target_ops *ops, const char *args, int from_tty); static void gdbsim_prepare_to_store (struct target_ops *self, - struct regcache *regcache); + struct regcache *regcache, + ptid_t ptid); static void gdbsim_files_info (struct target_ops *target); @@ -1060,7 +1061,8 @@ gdbsim_wait (struct target_ops *ops, debugged. */ static void -gdbsim_prepare_to_store (struct target_ops *self, struct regcache *regcache) +gdbsim_prepare_to_store (struct target_ops *self, struct regcache *regcache, + ptid_t ptid) { /* Do nothing, since we can store individual regs. */ } diff --git a/gdb/remote.c b/gdb/remote.c index b7ffa4a..e4c4717 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -106,7 +106,8 @@ static int getpkt_or_notif_sane (char **buf, long *sizeof_buf, static void remote_files_info (struct target_ops *ignore); static void remote_prepare_to_store (struct target_ops *self, - struct regcache *regcache); + struct regcache *regcache, + ptid_t ptid); static void remote_open_1 (const char *, int, struct target_ops *, int extended_p); @@ -7755,7 +7756,8 @@ remote_fetch_registers (struct target_ops *ops, struct regcache *regcache, first. */ static void -remote_prepare_to_store (struct target_ops *self, struct regcache *regcache) +remote_prepare_to_store (struct target_ops *self, struct regcache *regcache, + ptid_t ptid) { struct remote_arch_state *rsa = get_remote_arch_state (); int i; diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c index 4e63ec5..9d340d2 100644 --- a/gdb/sparc-ravenscar-thread.c +++ b/gdb/sparc-ravenscar-thread.c @@ -25,7 +25,8 @@ #include "ravenscar-thread.h" #include "sparc-ravenscar-thread.h" -static void sparc_ravenscar_prepare_to_store (struct regcache *regcache); +static void sparc_ravenscar_prepare_to_store (struct regcache *regcache, + ptid_t ptid); /* Register offsets from a referenced address (exempli gratia the Thread_Descriptor). The referenced address depends on the register @@ -141,7 +142,7 @@ sparc_ravenscar_fetch_registers (struct regcache *regcache, ptid_t ptid, thread. */ static void -sparc_ravenscar_prepare_to_store (struct regcache *regcache) +sparc_ravenscar_prepare_to_store (struct regcache *regcache, ptid_t ptid) { /* Nothing to do. */ } diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 3f1c236..2653438 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -216,27 +216,29 @@ debug_store_registers (struct target_ops *self, struct regcache *arg1, ptid_t ar } static void -delegate_prepare_to_store (struct target_ops *self, struct regcache *arg1) +delegate_prepare_to_store (struct target_ops *self, struct regcache *arg1, ptid_t arg2) { self = self->beneath; - self->to_prepare_to_store (self, arg1); + self->to_prepare_to_store (self, arg1, arg2); } static void -tdefault_prepare_to_store (struct target_ops *self, struct regcache *arg1) +tdefault_prepare_to_store (struct target_ops *self, struct regcache *arg1, ptid_t arg2) { noprocess (); } static void -debug_prepare_to_store (struct target_ops *self, struct regcache *arg1) +debug_prepare_to_store (struct target_ops *self, struct regcache *arg1, ptid_t arg2) { fprintf_unfiltered (gdb_stdlog, "-> %s->to_prepare_to_store (...)\n", debug_target.to_shortname); - debug_target.to_prepare_to_store (&debug_target, arg1); + debug_target.to_prepare_to_store (&debug_target, arg1, arg2); fprintf_unfiltered (gdb_stdlog, "<- %s->to_prepare_to_store (", debug_target.to_shortname); target_debug_print_struct_target_ops_p (&debug_target); fputs_unfiltered (", ", gdb_stdlog); target_debug_print_struct_regcache_p (arg1); + fputs_unfiltered (", ", gdb_stdlog); + target_debug_print_ptid_t (arg2); fputs_unfiltered (")\n", gdb_stdlog); } diff --git a/gdb/target.h b/gdb/target.h index d6c07ad..4a0749d 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -474,7 +474,7 @@ struct target_ops void (*to_store_registers) (struct target_ops *, struct regcache *, ptid_t, int) TARGET_DEFAULT_NORETURN (noprocess ()); - void (*to_prepare_to_store) (struct target_ops *, struct regcache *) + void (*to_prepare_to_store) (struct target_ops *, struct regcache *, ptid_t) TARGET_DEFAULT_NORETURN (noprocess ()); void (*to_files_info) (struct target_ops *) @@ -1401,8 +1401,8 @@ extern void target_store_registers (struct regcache *regcache, ptid_t ptid, that REGISTERS contains all the registers from the program being debugged. */ -#define target_prepare_to_store(regcache) \ - (*current_target.to_prepare_to_store) (¤t_target, regcache) +#define target_prepare_to_store(regcache, ptid) \ + (*current_target.to_prepare_to_store) (¤t_target, regcache, ptid) /* Determine current address space of thread PTID. */ |