From: Markus Metzger <markus.t.metzger@intel.com>
To: jan.kratochvil@redhat.com
Cc: gdb-patches@sourceware.org
Subject: [patch v8 13/24] target: add ops parameter to to_prepare_to_store method
Date: Thu, 12 Dec 2013 09:16:00 -0000 [thread overview]
Message-ID: <1386839747-8860-14-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <1386839747-8860-1-git-send-email-markus.t.metzger@intel.com>
To allow forwarding the prepare_to_store request to the target beneath,
add a target_ops * parameter.
2013-12-12 Markus Metzger <markus.t.metzger@intel.com>
* target.h (target_ops) <to_prepare_to_store>: Add parameter.
(target_prepare_to_store): Remove macro. New function.
* target.c (update_current_target): Do not inherit/default
prepare_to_store.
(target_prepare_to_store): New.
(debug_to_prepare_to_store): Remove.
* remote.c (remote_prepare_to_store): Add parameter.
* remote-mips.c (mips_prepare_to_store): Add parameter.
* remote-m32r-sdi.c (m32r_prepare_to_store): Add parameter.
* ravenscar-thread.c (ravenscar_prepare_to_store): Add
parameter.
* monitor.c (monitor_prepare_to_store): Add parameter.
* inf-child.c (inf_child_prepare_to_store): Add parameter.
---
gdb/inf-child.c | 2 +-
gdb/monitor.c | 2 +-
gdb/ravenscar-thread.c | 7 ++++---
gdb/record-full.c | 3 ++-
gdb/remote-m32r-sdi.c | 2 +-
gdb/remote-mips.c | 5 +++--
gdb/remote.c | 5 +++--
gdb/target.c | 36 +++++++++++++++++++++---------------
gdb/target.h | 5 ++---
9 files changed, 38 insertions(+), 29 deletions(-)
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 3db09c9..123ff14 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -100,7 +100,7 @@ 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 *ops, struct regcache *regcache)
{
}
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 2d94d42..5d2c3f3 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 *ops, struct regcache *regcache)
{
/* Do nothing, since we can store individual regs. */
}
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 9ef265d..53e0446 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 *ops,
+ 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,14 @@ ravenscar_store_registers (struct target_ops *ops,
}
static void
-ravenscar_prepare_to_store (struct regcache *regcache)
+ravenscar_prepare_to_store (struct target_ops *ops, 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 f9af408..19ab774 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2148,7 +2148,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 *ops,
+ struct regcache *regcache)
{
}
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index e81b2de..f560388 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1013,7 +1013,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 *target, 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 e4e5083..5b3254d 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 *ops,
+ 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 *ops, struct regcache *regcache)
{
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 8472e2a..5fe1c53 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -98,7 +98,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 *ops,
+ struct regcache *regcache);
static void remote_open (char *name, int from_tty);
@@ -6413,7 +6414,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 *ops, 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 85b5037..342850f 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -91,8 +91,6 @@ 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_files_info (struct target_ops *);
static int debug_to_insert_breakpoint (struct gdbarch *,
@@ -587,7 +585,7 @@ update_current_target (void)
/* Do not inherit to_wait. */
/* Do not inherit to_fetch_registers. */
/* Do not inherit to_store_registers. */
- INHERIT (to_prepare_to_store, t);
+ /* Do not inherit to_prepare_to_store. */
INHERIT (deprecated_xfer_memory, t);
INHERIT (to_files_info, t);
INHERIT (to_insert_breakpoint, t);
@@ -721,9 +719,6 @@ update_current_target (void)
de_fault (to_post_attach,
(void (*) (int))
target_ignore);
- de_fault (to_prepare_to_store,
- (void (*) (struct regcache *))
- noprocess);
de_fault (deprecated_xfer_memory,
(int (*) (CORE_ADDR, gdb_byte *, int, int,
struct mem_attrib *, struct target_ops *))
@@ -4004,6 +3999,26 @@ target_store_registers (struct regcache *regcache, int regno)
noprocess ();
}
+/* See target.h. */
+
+void
+target_prepare_to_store (struct regcache *regcache)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ {
+ if (t->to_prepare_to_store != NULL)
+ {
+ t->to_prepare_to_store (t, regcache);
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
+
+ return;
+ }
+ }
+}
+
int
target_core_of_thread (ptid_t ptid)
{
@@ -4462,14 +4477,6 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
tcomplain ();
}
-static void
-debug_to_prepare_to_store (struct regcache *regcache)
-{
- debug_target.to_prepare_to_store (regcache);
-
- fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
-}
-
static int
deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
int write, struct mem_attrib *attrib,
@@ -4921,7 +4928,6 @@ setup_target_debug (void)
current_target.to_open = debug_to_open;
current_target.to_post_attach = debug_to_post_attach;
- current_target.to_prepare_to_store = debug_to_prepare_to_store;
current_target.deprecated_xfer_memory = deprecated_debug_xfer_memory;
current_target.to_files_info = debug_to_files_info;
current_target.to_insert_breakpoint = debug_to_insert_breakpoint;
diff --git a/gdb/target.h b/gdb/target.h
index 1e1467e..db4b5a3 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -370,7 +370,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
@@ -1001,8 +1001,7 @@ extern void target_store_registers (struct regcache *regcache, int regs);
that REGISTERS contains all the registers from the program being
debugged. */
-#define target_prepare_to_store(regcache) \
- (*current_target.to_prepare_to_store) (regcache)
+extern void target_prepare_to_store (struct regcache *);
/* Determine current address space of thread PTID. */
--
1.8.3.1
next prev parent reply other threads:[~2013-12-12 9:16 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 9:15 [patch v8 00/24] record-btrace: reverse Markus Metzger
2013-12-12 9:15 ` [patch v8 01/24] btrace, linux: fix memory leak when reading branch trace Markus Metzger
2013-12-12 9:15 ` [patch v8 16/24] record-btrace, frame: supply target-specific unwinder Markus Metzger
2013-12-12 9:15 ` [patch v8 14/24] record-btrace: supply register target methods Markus Metzger
2013-12-12 9:15 ` [patch v8 03/24] gdbarch: add instruction predicate methods Markus Metzger
2013-12-12 9:16 ` [patch v8 07/24] record-btrace: fix insn range in function call history Markus Metzger
2013-12-12 9:16 ` [patch v8 08/24] record-btrace: start counting at one Markus Metzger
2013-12-12 9:16 ` [patch v8 18/24] record-btrace: add to_wait and to_resume target methods Markus Metzger
2013-12-12 9:16 ` [patch v8 17/24] record-btrace: provide xfer_partial target method Markus Metzger
2013-12-13 18:43 ` Pedro Alves
2013-12-16 10:53 ` Metzger, Markus T
2013-12-16 19:16 ` Pedro Alves
2013-12-17 11:58 ` Metzger, Markus T
2013-12-17 16:56 ` Pedro Alves
2013-12-18 9:26 ` Metzger, Markus T
2013-12-18 10:39 ` Pedro Alves
2013-12-12 9:16 ` [patch v8 15/24] frame, backtrace: allow targets to supply a frame unwinder Markus Metzger
2013-12-13 18:27 ` Pedro Alves
2013-12-16 9:18 ` Metzger, Markus T
2013-12-16 19:02 ` Pedro Alves
2013-12-17 8:26 ` Metzger, Markus T
2013-12-17 9:48 ` Pedro Alves
2013-12-12 9:16 ` Markus Metzger [this message]
2013-12-12 9:16 ` [patch v8 04/24] frame: add frame_is_tailcall function Markus Metzger
2013-12-12 9:16 ` [patch v8 10/24] record-btrace: optionally indent function call history Markus Metzger
2013-12-12 9:16 ` [patch v8 22/24] btrace, gdbserver: read branch trace incrementally Markus Metzger
2013-12-13 19:46 ` Pedro Alves
2013-12-16 12:47 ` Metzger, Markus T
2013-12-16 19:23 ` Pedro Alves
2013-12-12 9:16 ` [patch v8 11/24] record-btrace: make ranges include begin and end Markus Metzger
2013-12-13 17:56 ` Pedro Alves
2013-12-12 9:16 ` [patch v8 05/24] frame: artificial frame id's Markus Metzger
2013-12-12 19:39 ` Pedro Alves
2013-12-12 19:55 ` Jan Kratochvil
2013-12-13 8:04 ` Metzger, Markus T
2013-12-13 11:27 ` Jan Kratochvil
2013-12-13 11:42 ` Metzger, Markus T
2013-12-13 12:09 ` Pedro Alves
2013-12-13 13:01 ` Metzger, Markus T
2013-12-13 15:44 ` Pedro Alves
2013-12-13 17:51 ` Pedro Alves
2013-12-18 13:30 ` Metzger, Markus T
2013-12-12 9:16 ` [patch v8 23/24] record-btrace: show trace from enable location Markus Metzger
2013-12-13 19:50 ` Pedro Alves
2013-12-16 12:57 ` Metzger, Markus T
2013-12-16 19:41 ` Pedro Alves
2013-12-17 13:20 ` Metzger, Markus T
2013-12-17 16:59 ` Pedro Alves
2013-12-12 9:16 ` [patch v8 20/24] record-btrace: add record goto target methods Markus Metzger
2013-12-12 9:16 ` [patch v8 21/24] record-btrace: extend unwinder Markus Metzger
2013-12-13 19:45 ` Pedro Alves
2013-12-16 12:42 ` Metzger, Markus T
2013-12-16 19:22 ` Pedro Alves
2013-12-17 12:56 ` Metzger, Markus T
2013-12-12 9:16 ` [patch v8 24/24] record-btrace: add (reverse-)stepping support Markus Metzger
2013-12-12 16:36 ` Eli Zaretskii
2013-12-13 19:22 ` Pedro Alves
2013-12-16 15:56 ` Metzger, Markus T
2013-12-16 20:30 ` Pedro Alves
2013-12-17 14:14 ` Metzger, Markus T
2013-12-17 15:07 ` Metzger, Markus T
2013-12-17 15:48 ` Metzger, Markus T
2013-12-17 20:41 ` Pedro Alves
2013-12-17 20:34 ` Pedro Alves
2013-12-17 20:07 ` Pedro Alves
2013-12-18 9:44 ` Metzger, Markus T
2013-12-12 9:16 ` [patch v8 02/24] btrace: uppercase btrace_read_type Markus Metzger
2013-12-12 9:16 ` [patch v8 06/24] btrace: change branch trace data structure Markus Metzger
2013-12-12 9:16 ` [patch v8 12/24] btrace: add replay position to btrace thread info Markus Metzger
2013-12-12 9:16 ` [patch v8 09/24] btrace: increase buffer size Markus Metzger
2013-12-12 9:16 ` [patch v8 19/24] record-btrace: provide target_find_new_threads method Markus Metzger
2013-12-12 14:07 ` [patch v8 00/24] record-btrace: reverse Jan Kratochvil
2013-12-12 14:19 ` Metzger, Markus T
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386839747-8860-14-git-send-email-markus.t.metzger@intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox