summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-08-29 00:24:40 +0100
committerPedro Alves <palves@redhat.com>2016-08-29 00:24:40 +0100
commited23ab28663bec93ae6e230aebb2dd64d58d4c43 (patch)
treebc038dfa2d8ab97441f3ed825135f02eef6c2f17
parentc2abbbebcccf6c9403f8d6327e3fe3655acffbc1 (diff)
downloadbinutils-gdb-ed23ab28663bec93ae6e230aebb2dd64d58d4c43.tar.gz
Convert struct target_ops to C++
I.e., use C++ virtual methods and inheritance instead of tables of function pointers. See src/README.target_ops-cxx for more.
-rw-r--r--README.target_ops-cxx113
-rw-r--r--gdb/amd64-linux-nat.c31
-rw-r--r--gdb/auxv.c13
-rw-r--r--gdb/auxv.h3
-rw-r--r--gdb/avr-tdep.c4
-rw-r--r--gdb/bfd-target.c97
-rw-r--r--gdb/bfd-target.h3
-rw-r--r--gdb/breakpoint.c7
-rw-r--r--gdb/bsd-uthread.c137
-rw-r--r--gdb/common/common-defs.h8
-rw-r--r--gdb/corefile.c12
-rw-r--r--gdb/corelow.c213
-rw-r--r--gdb/ctf.c105
-rw-r--r--gdb/darwin-nat.c130
-rw-r--r--gdb/darwin-nat.h44
-rw-r--r--gdb/elfread.c8
-rw-r--r--gdb/eval.c2
-rw-r--r--gdb/exec.c153
-rw-r--r--gdb/frame.c2
-rw-r--r--gdb/gdbcore.h4
-rw-r--r--gdb/gnu-v3-abi.c2
-rw-r--r--gdb/i386-darwin-nat.c31
-rw-r--r--gdb/i386-linux-nat.c41
-rw-r--r--gdb/ia64-tdep.c2
-rw-r--r--gdb/ia64-vms-tdep.c2
-rw-r--r--gdb/inf-child.c275
-rw-r--r--gdb/inf-child.h105
-rw-r--r--gdb/inf-ptrace.c289
-rw-r--r--gdb/inf-ptrace.h68
-rw-r--r--gdb/infcall.c4
-rw-r--r--gdb/infcmd.c34
-rw-r--r--gdb/infrun.c12
-rw-r--r--gdb/linespec.c8
-rw-r--r--gdb/linux-nat.c518
-rw-r--r--gdb/linux-nat.h143
-rw-r--r--gdb/linux-tdep.c18
-rw-r--r--gdb/linux-thread-db.c143
-rwxr-xr-xgdb/make-target-delegates202
-rw-r--r--gdb/mi/mi-main.c13
-rw-r--r--gdb/minsyms.c2
-rw-r--r--gdb/nto-procfs.c2
-rw-r--r--gdb/parse.c2
-rw-r--r--gdb/ppc-linux-nat.c2
-rw-r--r--gdb/ppc-linux-tdep.c10
-rw-r--r--gdb/procfs.c4
-rw-r--r--gdb/ravenscar-thread.c168
-rw-r--r--gdb/record-btrace.c451
-rw-r--r--gdb/record-full.c510
-rw-r--r--gdb/record.c18
-rw-r--r--gdb/remote-sim.c223
-rw-r--r--gdb/remote.c1313
-rw-r--r--gdb/rs6000-tdep.c2
-rw-r--r--gdb/s390-linux-nat.c2
-rw-r--r--gdb/s390-linux-tdep.c2
-rw-r--r--gdb/sol-thread.c4
-rw-r--r--gdb/solib-aix.c2
-rw-r--r--gdb/solib-darwin.c2
-rw-r--r--gdb/solib-dsbt.c4
-rw-r--r--gdb/solib-spu.c6
-rw-r--r--gdb/solib-svr4.c26
-rw-r--r--gdb/solib-target.c2
-rw-r--r--gdb/solib.c2
-rw-r--r--gdb/sparc-tdep.c2
-rw-r--r--gdb/spu-multiarch.c159
-rw-r--r--gdb/spu-tdep.c30
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/target-debug.h6
-rw-r--r--gdb/target-delegates.c4938
-rw-r--r--gdb/target-descriptions.c4
-rw-r--r--gdb/target-memory.c4
-rw-r--r--gdb/target.c787
-rw-r--r--gdb/target.h759
-rw-r--r--gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp4
-rw-r--r--gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp4
-rw-r--r--gdb/tracefile-tfile.c126
-rw-r--r--gdb/tracefile.c38
-rw-r--r--gdb/tracefile.h13
-rw-r--r--gdb/tracepoint.c2
-rw-r--r--gdb/valops.c4
-rw-r--r--gdb/valprint.c2
-rw-r--r--gdb/value.c2
-rw-r--r--gdb/windows-nat.c207
-rw-r--r--gdb/windows-tdep.c2
-rw-r--r--gdb/x86-linux-nat.c90
-rw-r--r--gdb/x86-linux-nat.h48
-rw-r--r--gdb/x86-nat.c38
-rw-r--r--gdb/x86-nat.h66
87 files changed, 6426 insertions, 6669 deletions
diff --git a/README.target_ops-cxx b/README.target_ops-cxx
new file mode 100644
index 00000000000..a539b7d245c
--- /dev/null
+++ b/README.target_ops-cxx
@@ -0,0 +1,113 @@
+Subject: [PATCH] Convert struct target_ops to C++ [2016-09-07]
+
+I.e., use C++ virtual methods and inheritance instead of tables of
+function pointers.
+
+* Status:
+
+ | target | converted? | testing |
+ |--------------------+------------+---------|
+ | i386 GNU/Linux | x | B |
+ | x86-64 GNU/Linux | x | T |
+ | windows-nat.c | x | B |
+ | exec.c | x | T |
+ | corelow.c | x | T |
+ | remote.c | x | B |
+ | ctf.c | x | B |
+ | record-full.c | x | T |
+ | record-btrace.c | x | B |
+ | darwin-nat.c | x | B |
+ | i386-darwin-nat.c | x | B |
+ | remote-sim.c | x | B |
+ | spu-multiarch.c | x | B |
+ | bsd-uthread.c | x | B |
+ | ravenscar-thread.c | x | B |
+
+ All host-independent targets an x86-64 GNU/Linux
+ --enable-targets=all build pulls in are converted.
+
+- Unconverted:
+
+ A bunch of Linux ports. Solaris, Nto. BSDs.
+
+ Essentially ALL other native targets in the tree must be converted.
+ Help much appreciated!
+
+* Implementation notes:
+
+- The flattened current_target is gone. References to current_target
+ or current_target.beneath are replaced to references to target_stack
+ (the top of the stack) directly.
+
+- To keep "set debug target" working, I added a new debug_stratum
+ layer that sits on top of the stack, prints the debug and delegates
+ to the target beneath. In addition, I made the shortname and
+ longname properties of target_ops be virtual methods instead of data
+ fields, and made the debug target defer those to the target beneath.
+ This is so that debug code sprinkled around that does "if
+ (debugtarget) ..." can transparently print the name of the target
+ beneath.
+
+- We can no longer check whether a target_ops implements a method by
+ comparing the function pointer. Fixing that required adding a new
+ more target_ops methods. E.g.,:
+
+ + for (t = target_stack; t != NULL; t = t->beneath)
+ {
+ - if (t->to_create_inferior != NULL)
+ + if (t->can_create_inferior ())
+ break;
+ }
+
+- make-target-delegates was adjusted to generate C++ classes and
+ methods.
+
+ It now generates a couple classes that inherit target_ops:
+ dummy_target and debug_target.
+
+ Since we need to generate the class declaration as well, we now
+ generate the code in two passes.
+
+- I eliminated to_xclose. It's not exactly clear how this will all
+ work on a multi-target world, so there's no point in keeping a
+ partial conversion in place. bfd-target.c now exports a function
+ that closes the target and then deletes it. See target_bfd_close.
+
+- We can no longer use x86_use_watchpoints to install custom methods.
+
+ Instead, we solve this with a template.
+
+- The old weird double-target linux_ops mechanism in linux-nat.c, is
+ gone, replaced by adding a few virtual methods to linux-nat.h's
+ target_ops, called low_XXX, that the concrete linux-nat
+ implementations override. Sort of like gdbserver's
+ linux_target_ops, but simpler, for requiring only one
+ target_ops-like hierarchy, which spares implementing the same method
+ twice when we need to forward the method to a low implementation.
+ The low target simply reimplements the target_ops method directly in
+ that case.
+
+- There are a few remaining linux-nat.c hooks that would be better converted to
+ low_ methods like above. E.g.:
+
+ linux_nat_set_new_thread (t, x86_linux_new_thread);
+ linux_nat_set_new_fork (t, x86_linux_new_fork);
+ linux_nat_set_forget_process
+
+- This needs fixing:
+
+ @@ -3721,10 +3684,13 @@ target_supports_delete_record (void)
+ {
+ struct target_ops *t;
+
+ - for (t = current_target.beneath; t != NULL; t = t->beneath)
+ + gdb_assert (0);
+ +#if 0
+ + for (t = target_stack; t != NULL; t = t->beneath)
+ if (t->to_delete_record != delegate_delete_record
+ && t->to_delete_record != tdefault_delete_record)
+ return 1;
+ +#endif
+
+ return 0;
+ }
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 5122b045eac..e68eb3eafa0 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -30,7 +30,6 @@
#include "gdb_proc_service.h"
#include "amd64-nat.h"
-#include "linux-nat.h"
#include "amd64-tdep.h"
#include "amd64-linux-tdep.h"
#include "i386-linux-tdep.h"
@@ -40,6 +39,13 @@
#include "nat/linux-ptrace.h"
#include "nat/amd64-linux-siginfo.h"
+struct amd64_linux_nat_target FINAL : public x86_linux_nat_target
+{
+ /* Add our register access methods. */
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+};
+
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout for GNU/Linux
i386.
@@ -123,9 +129,8 @@ fill_fpregset (const struct regcache *regcache,
this for all registers (including the floating point and SSE
registers). */
-static void
-amd64_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
@@ -178,9 +183,8 @@ amd64_linux_fetch_inferior_registers (struct target_ops *ops,
-1, do this for all registers (including the floating-point and SSE
registers). */
-static void
-amd64_linux_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int tid;
@@ -351,8 +355,6 @@ void _initialize_amd64_linux_nat (void);
void
_initialize_amd64_linux_nat (void)
{
- struct target_ops *t;
-
amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset;
amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS;
amd64_native_gregset64_reg_offset = amd64_linux_gregset_reg_offset;
@@ -361,16 +363,11 @@ _initialize_amd64_linux_nat (void)
gdb_assert (ARRAY_SIZE (amd64_linux_gregset32_reg_offset)
== amd64_native_gregset32_num_regs);
- /* Create a generic x86 GNU/Linux target. */
- t = x86_linux_create_target ();
-
- /* Add our register access methods. */
- t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
- t->to_store_registers = amd64_linux_store_inferior_registers;
+ linux_target = new amd64_linux_nat_target ();
/* Add the target. */
- x86_linux_add_target (t);
+ x86_linux_add_target (linux_target);
/* Add our siginfo layout converter. */
- linux_nat_set_siginfo_fixup (t, amd64_linux_siginfo_fixup);
+ linux_nat_set_siginfo_fixup (linux_target, amd64_linux_siginfo_fixup);
}
diff --git a/gdb/auxv.c b/gdb/auxv.c
index de9205d5af0..fee4880aa45 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -283,16 +283,15 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
int
-target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
- gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+target_auxv_parse (gdb_byte **readptr,
+ gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
struct gdbarch *gdbarch = target_gdbarch();
if (gdbarch_auxv_parse_p (gdbarch))
return gdbarch_auxv_parse (gdbarch, readptr, endptr, typep, valp);
- return current_target.to_auxv_parse (&current_target, readptr, endptr,
- typep, valp);
+ return target_stack->auxv_parse (readptr, endptr, typep, valp);
}
@@ -388,7 +387,7 @@ target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
return info->length;
while (1)
- switch (target_auxv_parse (ops, &ptr, data + info->length, &type, &val))
+ switch (target_auxv_parse (&ptr, data + info->length, &type, &val))
{
case 1: /* Here's an entry, check it. */
if (type == match)
@@ -540,7 +539,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
if (info->length <= 0)
return info->length;
- while (target_auxv_parse (ops, &ptr, data + info->length, &type, &val) > 0)
+ while (target_auxv_parse (&ptr, data + info->length, &type, &val) > 0)
{
gdbarch_print_auxv_entry (gdbarch, file, type, val);
++ents;
@@ -558,7 +557,7 @@ info_auxv_command (char *cmd, int from_tty)
error (_("The program has no auxiliary information now."));
else
{
- int ents = fprint_target_auxv (gdb_stdout, &current_target);
+ int ents = fprint_target_auxv (gdb_stdout, target_stack);
if (ents < 0)
error (_("No auxiliary vector found, or failed reading it."));
diff --git a/gdb/auxv.h b/gdb/auxv.h
index 916f6748251..d99d2549704 100644
--- a/gdb/auxv.h
+++ b/gdb/auxv.h
@@ -35,8 +35,7 @@ extern int default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
Return 0 if *READPTR is already at the end of the buffer.
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
-extern int target_auxv_parse (struct target_ops *ops,
- gdb_byte **readptr, gdb_byte *endptr,
+extern int target_auxv_parse (gdb_byte **readptr, gdb_byte *endptr,
CORE_ADDR *typep, CORE_ADDR *valp);
/* Extract the auxiliary vector entry with a_type matching MATCH.
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index f6f43a0a233..349c0c0e4e2 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1559,7 +1559,7 @@ avr_io_reg_read_command (char *args, int from_tty)
int i, j, k, step;
/* Find out how many io registers the target has. */
- bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
+ bufsiz = target_read_alloc (target_stack, TARGET_OBJECT_AVR,
"avr.io_reg", &buf);
bufstr = (const char *) buf;
@@ -1596,7 +1596,7 @@ avr_io_reg_read_command (char *args, int from_tty)
j = nreg - i; /* last block is less than 8 registers */
snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
- bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
+ bufsiz = target_read_alloc (target_stack, TARGET_OBJECT_AVR,
query, &buf);
p = (const char *) buf;
diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c
index 25eeb74e3fc..dea6ecea6a0 100644
--- a/gdb/bfd-target.c
+++ b/gdb/bfd-target.c
@@ -25,34 +25,55 @@
/* The object that is stored in the target_ops->to_data field has this
type. */
-struct target_bfd_data
+class target_bfd : public target_ops
{
+private:
/* The BFD we're wrapping. */
- struct bfd *bfd;
+ struct bfd *m_bfd;
/* The section table build from the ALLOC sections in BFD. Note
that we can't rely on extracting the BFD from a random section in
the table, since the table can be legitimately empty. */
- struct target_section_table table;
+ struct target_section_table m_table;
+
+public:
+ explicit target_bfd (struct bfd *bfd);
+ ~target_bfd () OVERRIDE;
+
+ const char *shortname () OVERRIDE
+ { return "bfd"; }
+
+ const char *longname () OVERRIDE
+ { return _("BFD backed target"); }
+
+ const char *doc () OVERRIDE
+ { return _("You should never see this"); }
+
+ enum target_xfer_status
+ xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ struct target_section_table *get_section_table () OVERRIDE;
};
-static enum target_xfer_status
-target_bfd_xfer_partial (struct target_ops *ops,
- enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+enum target_xfer_status
+target_bfd::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
case TARGET_OBJECT_MEMORY:
{
- struct target_bfd_data *data = (struct target_bfd_data *) ops->to_data;
return section_table_xfer_memory_partial (readbuf, writebuf,
offset, len, xfered_len,
- data->table.sections,
- data->table.sections_end,
+ m_table.sections,
+ m_table.sections_end,
NULL);
}
default:
@@ -60,44 +81,36 @@ target_bfd_xfer_partial (struct target_ops *ops,
}
}
-static struct target_section_table *
-target_bfd_get_section_table (struct target_ops *ops)
+struct target_section_table *
+target_bfd::get_section_table ()
{
- struct target_bfd_data *data = (struct target_bfd_data *) ops->to_data;
- return &data->table;
+ return &this->m_table;
}
-static void
-target_bfd_xclose (struct target_ops *t)
+target_bfd::target_bfd (struct bfd *abfd)
{
- struct target_bfd_data *data = (struct target_bfd_data *) t->to_data;
+ m_bfd = abfd;
+ gdb_bfd_ref (abfd);
+ m_table.sections = NULL;
+ m_table.sections_end = NULL;
+ build_section_table (abfd, &m_table.sections, &m_table.sections_end);
+}
- gdb_bfd_unref (data->bfd);
- xfree (data->table.sections);
- xfree (data);
- xfree (t);
+target_bfd::~target_bfd ()
+{
+ gdb_bfd_unref (m_bfd);
+ xfree (m_table.sections);
}
struct target_ops *
target_bfd_reopen (struct bfd *abfd)
{
- struct target_ops *t;
- struct target_bfd_data *data;
+ return new target_bfd (abfd);
+}
- data = XCNEW (struct target_bfd_data);
- data->bfd = abfd;
- gdb_bfd_ref (abfd);
- build_section_table (abfd, &data->table.sections, &data->table.sections_end);
-
- t = XCNEW (struct target_ops);
- t->to_shortname = "bfd";
- t->to_longname = _("BFD backed target");
- t->to_doc = _("You should never see this");
- t->to_get_section_table = target_bfd_get_section_table;
- t->to_xfer_partial = target_bfd_xfer_partial;
- t->to_xclose = target_bfd_xclose;
- t->to_data = data;
- t->to_magic = OPS_MAGIC;
-
- return t;
+void
+target_bfd_close (struct target_ops *ops)
+{
+ target_close (ops);
+ delete ops;
}
diff --git a/gdb/bfd-target.h b/gdb/bfd-target.h
index 08cd3366903..c4c0eab3ca1 100644
--- a/gdb/bfd-target.h
+++ b/gdb/bfd-target.h
@@ -28,4 +28,7 @@ struct target_ops;
released when the target is closed. */
struct target_ops *target_bfd_reopen (struct bfd *bfd);
+/* Close and destroy a target created by target_bfd_reopen. */
+void target_bfd_close (struct target_ops *ops);
+
#endif
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6bb6bbfbef9..8d0af87dccf 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3753,8 +3753,7 @@ create_exception_master_breakpoint (void)
}
addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym);
- addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
- &current_target);
+ addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, target_stack);
b = create_internal_breakpoint (gdbarch, addr, bp_exception_master,
&internal_breakpoint_ops);
initialize_explicit_location (&explicit_loc);
@@ -5054,7 +5053,7 @@ watchpoints_triggered (struct target_waitstatus *ws)
return 0;
}
- if (!target_stopped_data_address (&current_target, &addr))
+ if (!target_stopped_data_address (target_stack, &addr))
{
/* We were stopped by a watchpoint, but we don't know where.
Mark all watchpoints as unknown. */
@@ -5094,7 +5093,7 @@ watchpoints_triggered (struct target_waitstatus *ws)
}
}
/* Exact match not required. Within range is sufficient. */
- else if (target_watchpoint_addr_within_range (&current_target,
+ else if (target_watchpoint_addr_within_range (target_stack,
addr, loc->address,
loc->length))
{
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 4ce0a6c39bc..3d20301a134 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -33,8 +33,40 @@
#include "bsd-uthread.h"
-/* HACK: Save the bsd_uthreads ops returned by bsd_uthread_target. */
-static struct target_ops *bsd_uthread_ops_hack;
+struct bsd_uthread_target FINAL : public target_ops
+{
+ bsd_uthread_target ()
+ { to_stratum = thread_stratum; }
+
+ const char *shortname () OVERRIDE
+ { return "bsd-uthreads"; }
+
+ const char *longname () OVERRIDE
+ { return _("BSD user-level threads"); }
+
+ const char *doc () OVERRIDE
+ { return _("BSD user-level threads"); }
+
+ void close () OVERRIDE;
+
+ void mourn_inferior () OVERRIDE;
+
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ void update_thread_list () OVERRIDE;
+
+ char *extra_thread_info (struct thread_info *) OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+};
+
+static bsd_uthread_target bsd_uthread_ops;
/* Architecture-specific operations. */
@@ -200,15 +232,15 @@ bsd_uthread_activate (struct objfile *objfile)
bsd_uthread_thread_ctx_offset =
bsd_uthread_lookup_offset ("_thread_ctx_offset", objfile);
- push_target (bsd_uthread_ops_hack);
+ push_target (&bsd_uthread_ops);
bsd_uthread_active = 1;
return 1;
}
/* Cleanup due to deactivation. */
-static void
-bsd_uthread_close (struct target_ops *self)
+void
+bsd_uthread_target::close ()
{
bsd_uthread_active = 0;
bsd_uthread_thread_run_addr = 0;
@@ -228,7 +260,7 @@ bsd_uthread_deactivate (void)
if (!bsd_uthread_active)
return;
- unpush_target (bsd_uthread_ops_hack);
+ unpush_target (&bsd_uthread_ops);
}
static void
@@ -275,27 +307,26 @@ bsd_uthread_solib_unloaded (struct so_list *so)
bsd_uthread_deactivate ();
}
-static void
-bsd_uthread_mourn_inferior (struct target_ops *ops)
+void
+bsd_uthread_target::mourn_inferior ()
{
- struct target_ops *beneath = find_target_beneath (ops);
- beneath->to_mourn_inferior (beneath);
+ struct target_ops *beneath = find_target_beneath (this);
+ beneath->mourn_inferior ();
bsd_uthread_deactivate ();
}
-static void
-bsd_uthread_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+bsd_uthread_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
CORE_ADDR addr = ptid_get_tid (inferior_ptid);
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
CORE_ADDR active_addr;
/* Always fetch the appropriate registers from the layer beneath. */
- beneath->to_fetch_registers (beneath, regcache, regnum);
+ beneath->fetch_registers (regcache, regnum);
/* FIXME: That might have gotten us more than we asked for. Make
sure we overwrite all relevant registers with values from the
@@ -311,14 +342,13 @@ bsd_uthread_fetch_registers (struct target_ops *ops,
}
}
-static void
-bsd_uthread_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+bsd_uthread_target::store_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct bsd_uthread_ops *uthread_ops
= (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
CORE_ADDR addr = ptid_get_tid (inferior_ptid);
CORE_ADDR active_addr;
@@ -333,20 +363,20 @@ bsd_uthread_store_registers (struct target_ops *ops,
{
/* Updating the thread that is currently running; pass the
request to the layer beneath. */
- beneath->to_store_registers (beneath, regcache, regnum);
+ beneath->store_registers (regcache, regnum);
}
}
-static ptid_t
-bsd_uthread_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *status, int options)
+ptid_t
+bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
+ int options)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR addr;
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
/* Pass the request to the layer beneath. */
- ptid = beneath->to_wait (beneath, ptid, status, options);
+ ptid = beneath->wait (ptid, status, options);
/* If the process is no longer alive, there's no point in figuring
out the thread ID. It will fail anyway. */
@@ -387,20 +417,19 @@ bsd_uthread_wait (struct target_ops *ops,
return ptid;
}
-static void
-bsd_uthread_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal sig)
+void
+bsd_uthread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
{
/* Pass the request to the layer beneath. */
- struct target_ops *beneath = find_target_beneath (ops);
- beneath->to_resume (beneath, ptid, step, sig);
+ struct target_ops *beneath = find_target_beneath (this);
+ beneath->resume (ptid, step, sig);
}
-static int
-bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+bsd_uthread_target::thread_alive (ptid_t ptid)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
CORE_ADDR addr = ptid_get_tid (inferior_ptid);
if (addr != 0)
@@ -415,11 +444,11 @@ bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid)
return 0;
}
- return beneath->to_thread_alive (beneath, ptid);
+ return beneath->thread_alive (ptid);
}
-static void
-bsd_uthread_update_thread_list (struct target_ops *ops)
+void
+bsd_uthread_target::update_thread_list ()
{
pid_t pid = ptid_get_pid (inferior_ptid);
int offset = bsd_uthread_thread_next_offset;
@@ -475,9 +504,8 @@ static char *bsd_uthread_state[] =
/* Return a string describing th state of the thread specified by
INFO. */
-static char *
-bsd_uthread_extra_thread_info (struct target_ops *self,
- struct thread_info *info)
+char *
+bsd_uthread_target::extra_thread_info (struct thread_info *info)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
CORE_ADDR addr = ptid_get_tid (info->ptid);
@@ -495,8 +523,8 @@ bsd_uthread_extra_thread_info (struct target_ops *self,
return NULL;
}
-static char *
-bsd_uthread_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+bsd_uthread_target::pid_to_str (ptid_t ptid)
{
if (ptid_get_tid (ptid) != 0)
{
@@ -510,39 +538,12 @@ bsd_uthread_pid_to_str (struct target_ops *ops, ptid_t ptid)
return normal_pid_to_str (ptid);
}
-static struct target_ops *
-bsd_uthread_target (void)
-{
- struct target_ops *t = XCNEW (struct target_ops);
-
- t->to_shortname = "bsd-uthreads";
- t->to_longname = "BSD user-level threads";
- t->to_doc = "BSD user-level threads";
- t->to_close = bsd_uthread_close;
- t->to_mourn_inferior = bsd_uthread_mourn_inferior;
- t->to_fetch_registers = bsd_uthread_fetch_registers;
- t->to_store_registers = bsd_uthread_store_registers;
- t->to_wait = bsd_uthread_wait;
- t->to_resume = bsd_uthread_resume;
- t->to_thread_alive = bsd_uthread_thread_alive;
- t->to_update_thread_list = bsd_uthread_update_thread_list;
- t->to_extra_thread_info = bsd_uthread_extra_thread_info;
- t->to_pid_to_str = bsd_uthread_pid_to_str;
- t->to_stratum = thread_stratum;
- t->to_magic = OPS_MAGIC;
- bsd_uthread_ops_hack = t;
-
- return t;
-}
-
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_bsd_uthread;
void
_initialize_bsd_uthread (void)
{
- complete_target_initialization (bsd_uthread_target ());
-
bsd_uthread_data = gdbarch_data_register_pre_init (bsd_uthread_init);
observer_attach_inferior_created (bsd_uthread_inferior_created);
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 2c941170453..fcd79b79832 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -85,4 +85,12 @@
# define EXTERN_C_POP
#endif
+#if __cplusplus >= 201103L
+# define FINAL final
+# define OVERRIDE override
+#else
+# define FINAL
+# define OVERRIDE
+#endif
+
#endif /* COMMON_DEFS_H */
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 64de931b167..810b1bab72e 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -57,9 +57,6 @@ static int exec_file_hook_count = 0; /* Size of array. */
bfd *core_bfd = NULL;
-/* corelow.c target. It is never NULL after GDB initialization. */
-
-struct target_ops *core_target;
/* Backward compatability with old way of specifying core files. */
@@ -69,12 +66,12 @@ core_file_command (char *filename, int from_tty)
{
dont_repeat (); /* Either way, seems bogus. */
- gdb_assert (core_target != NULL);
+ gdb_assert (the_core_target != NULL);
if (!filename)
- (core_target->to_detach) (core_target, filename, from_tty);
+ the_core_target->detach (filename, from_tty);
else
- (core_target->to_open) (filename, from_tty);
+ the_core_target->open (filename, from_tty);
}
@@ -250,8 +247,7 @@ read_memory_object (enum target_object object, CORE_ADDR memaddr,
enum target_xfer_status status;
ULONGEST xfered_len;
- status = target_xfer_partial (current_target.beneath,
- object, NULL,
+ status = target_xfer_partial (target_stack, object, NULL,
myaddr + xfered, NULL,
memaddr + xfered, len - xfered,
&xfered_len);
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 376b7c9fd90..c57406ee5b0 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -50,6 +50,58 @@
#define O_LARGEFILE 0
#endif
+class core_target : public target_ops
+{
+public:
+ core_target ();
+
+ const char *shortname () OVERRIDE
+ { return "core"; }
+
+ const char *longname () OVERRIDE
+ { return _("Local core dump file"); }
+
+ const char *doc () OVERRIDE
+ {
+ return _("\
+Use a core file as a target. Specify the filename of the core file.");
+ }
+
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
+ void detach (const char *, int) OVERRIDE;
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+ void files_info () OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+ const struct target_desc *read_description () OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ const char *thread_name (struct thread_info *) OVERRIDE;
+
+ int has_memory () OVERRIDE;
+ int has_stack () OVERRIDE;
+ int has_registers () OVERRIDE;
+ int info_proc (const char *, enum info_proc_what) OVERRIDE;
+};
+
+struct target_ops *the_core_target;
+
+/* Fill in core_ops with its defined operations and properties. */
+
+core_target::core_target ()
+{
+ this->to_stratum = process_stratum;
+}
+
/* List of all available core_fns. On gdb startup, each core file
register reader calls deprecated_add_core_fns() to register
information on each core format it is prepared to read. */
@@ -74,24 +126,16 @@ static struct gdbarch *core_gdbarch = NULL;
unix child targets. */
static struct target_section_table *core_data;
-static void core_files_info (struct target_ops *);
-
static struct core_fns *sniff_core_bfd (bfd *);
static int gdb_check_format (bfd *);
-static void core_close (struct target_ops *self);
-
static void core_close_cleanup (void *ignore);
static void add_to_thread_list (bfd *, asection *, void *);
-static void init_core_ops (void);
-
void _initialize_corelow (void);
-static struct target_ops core_ops;
-
/* An arbitrary identifier for the core inferior. */
#define CORELOW_PID 1
@@ -187,7 +231,7 @@ gdb_check_format (bfd *abfd)
stack spaces as empty. */
static void
-core_close (struct target_ops *self)
+core_close ()
{
if (core_bfd)
{
@@ -218,7 +262,13 @@ core_close (struct target_ops *self)
static void
core_close_cleanup (void *ignore)
{
- core_close (NULL);
+ core_close ();
+}
+
+void
+core_target::close ()
+{
+ core_close ();
}
/* Look for sections whose names start with `.reg/' so that we can
@@ -268,8 +318,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
/* This routine opens and sets up the core file bfd. */
-static void
-core_open (const char *arg, int from_tty)
+void
+core_target::open (const char *arg, int from_tty)
{
const char *p;
int siggy;
@@ -332,7 +382,7 @@ core_open (const char *arg, int from_tty)
new. */
do_cleanups (old_chain);
- unpush_target (&core_ops);
+ unpush_target (this);
core_bfd = temp_bfd;
old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/);
@@ -359,7 +409,7 @@ core_open (const char *arg, int from_tty)
if (!exec_bfd)
set_gdbarch_from_file (core_bfd);
- push_target (&core_ops);
+ push_target (this);
discard_cleanups (old_chain);
/* Do this before acknowledging the inferior, so if
@@ -404,7 +454,7 @@ core_open (const char *arg, int from_tty)
switch_to_thread (thread->ptid);
}
- post_create_inferior (&core_ops, from_tty);
+ post_create_inferior (this, from_tty);
/* Now go through the target stack looking for threads since there
may be a thread_stratum target loaded on top of target core by
@@ -476,12 +526,12 @@ core_open (const char *arg, int from_tty)
}
}
-static void
-core_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+core_target::detach (const char *args, int from_tty)
{
if (args)
error (_("Too many arguments"));
- unpush_target (ops);
+ unpush_target (this);
reinit_frame_cache ();
if (from_tty)
printf_filtered (_("No core file now.\n"));
@@ -604,9 +654,8 @@ get_core_registers_cb (const char *sect_name, int size,
/* We just get all the registers, so we don't use regno. */
-static void
-get_core_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+core_target::fetch_registers (struct regcache *regcache, int regno)
{
int i;
struct gdbarch *gdbarch;
@@ -638,8 +687,8 @@ get_core_registers (struct target_ops *ops,
regcache_raw_supply (regcache, i, NULL);
}
-static void
-core_files_info (struct target_ops *t)
+void
+core_target::files_info ()
{
print_section_info (core_data, core_bfd);
}
@@ -703,11 +752,10 @@ get_core_siginfo (bfd *abfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
return len;
}
-static enum target_xfer_status
-core_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+core_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
switch (object)
{
@@ -901,35 +949,13 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
return TARGET_XFER_E_IO;
default:
- return ops->beneath->to_xfer_partial (ops->beneath, object,
- annex, readbuf,
- writebuf, offset, len,
- xfered_len);
+ return this->beneath->xfer_partial (object, annex, readbuf,
+ writebuf, offset, len,
+ xfered_len);
}
}
-/* If mourn is being called in all the right places, this could be say
- `gdb internal error' (since generic_mourn calls
- breakpoint_init_inferior). */
-
-static int
-ignore (struct target_ops *ops, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
-{
- return 0;
-}
-
-/* Implement the to_remove_breakpoint method. */
-
-static int
-core_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt,
- enum remove_bp_reason reason)
-{
- return 0;
-}
-
/* Okay, let's be honest: threads gleaned from a core file aren't
exactly lively, are they? On the other hand, if we don't claim
@@ -937,8 +963,8 @@ core_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
to appear in an "info thread" command, which is quite a useful
behaviour.
*/
-static int
-core_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+core_target::thread_alive (ptid_t ptid)
{
return 1;
}
@@ -948,24 +974,23 @@ core_thread_alive (struct target_ops *ops, ptid_t ptid)
wrapper could be avoided if targets got a chance to specialize
core_ops. */
-static const struct target_desc *
-core_read_description (struct target_ops *target)
+const struct target_desc *
+core_target::read_description ()
{
if (core_gdbarch && gdbarch_core_read_description_p (core_gdbarch))
{
const struct target_desc *result;
- result = gdbarch_core_read_description (core_gdbarch,
- target, core_bfd);
+ result = gdbarch_core_read_description (core_gdbarch, this, core_bfd);
if (result != NULL)
return result;
}
- return target->beneath->to_read_description (target->beneath);
+ return this->beneath->read_description ();
}
-static char *
-core_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+core_target::pid_to_str (ptid_t ptid)
{
static char buf[64];
struct inferior *inf;
@@ -996,8 +1021,8 @@ core_pid_to_str (struct target_ops *ops, ptid_t ptid)
return buf;
}
-static const char *
-core_thread_name (struct target_ops *self, struct thread_info *thr)
+const char *
+core_target::thread_name (struct thread_info *thr)
{
if (core_gdbarch
&& gdbarch_core_thread_name_p (core_gdbarch))
@@ -1005,29 +1030,28 @@ core_thread_name (struct target_ops *self, struct thread_info *thr)
return NULL;
}
-static int
-core_has_memory (struct target_ops *ops)
+int
+core_target::has_memory ()
{
return (core_bfd != NULL);
}
-static int
-core_has_stack (struct target_ops *ops)
+int
+core_target::has_stack ()
{
return (core_bfd != NULL);
}
-static int
-core_has_registers (struct target_ops *ops)
+int
+core_target::has_registers ()
{
return (core_bfd != NULL);
}
/* Implement the to_info_proc method. */
-static void
-core_info_proc (struct target_ops *ops, const char *args,
- enum info_proc_what request)
+int
+core_target::info_proc (const char *args, enum info_proc_what request)
{
struct gdbarch *gdbarch = get_current_arch ();
@@ -1035,47 +1059,18 @@ core_info_proc (struct target_ops *ops, const char *args,
method on gdbarch, not 'info_proc'. */
if (gdbarch_core_info_proc_p (gdbarch))
gdbarch_core_info_proc (gdbarch, args, request);
-}
-/* Fill in core_ops with its defined operations and properties. */
-
-static void
-init_core_ops (void)
-{
- core_ops.to_shortname = "core";
- core_ops.to_longname = "Local core dump file";
- core_ops.to_doc =
- "Use a core file as a target. Specify the filename of the core file.";
- core_ops.to_open = core_open;
- core_ops.to_close = core_close;
- core_ops.to_detach = core_detach;
- core_ops.to_fetch_registers = get_core_registers;
- core_ops.to_xfer_partial = core_xfer_partial;
- core_ops.to_files_info = core_files_info;
- core_ops.to_insert_breakpoint = ignore;
- core_ops.to_remove_breakpoint = core_remove_breakpoint;
- core_ops.to_thread_alive = core_thread_alive;
- core_ops.to_read_description = core_read_description;
- core_ops.to_pid_to_str = core_pid_to_str;
- core_ops.to_thread_name = core_thread_name;
- core_ops.to_stratum = process_stratum;
- core_ops.to_has_memory = core_has_memory;
- core_ops.to_has_stack = core_has_stack;
- core_ops.to_has_registers = core_has_registers;
- core_ops.to_info_proc = core_info_proc;
- core_ops.to_magic = OPS_MAGIC;
-
- if (core_target)
- internal_error (__FILE__, __LINE__,
- _("init_core_ops: core target already exists (\"%s\")."),
- core_target->to_longname);
- core_target = &core_ops;
+ return 1;
}
void
_initialize_corelow (void)
{
- init_core_ops ();
+ if (the_core_target != NULL)
+ internal_error (__FILE__, __LINE__,
+ _("init_core_ops: core target already exists (\"%s\")."),
+ the_core_target->longname ());
+ the_core_target = new class core_target ();
- add_target_with_completer (&core_ops, filename_completer);
+ add_target_with_completer (the_core_target, filename_completer);
}
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 0e13cc1374b..3f998d955bf 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -32,6 +32,38 @@
#include <ctype.h>
+class ctf_target : public tracefile_target
+{
+public:
+ const char *shortname () OVERRIDE
+ { return "ctf"; }
+
+ const char *longname () OVERRIDE
+ { return _("CTF file"); }
+
+ const char *doc () OVERRIDE
+ {
+ return _("\
+Use a CTF directory as a target.\n\
+Specify the filename of the CTF directory.");
+ }
+
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+ void files_info () OVERRIDE;
+ int trace_find (enum trace_find_type type, int num,
+ CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) OVERRIDE;
+ int get_trace_state_variable_value (int tsv, LONGEST *val) OVERRIDE;
+ struct traceframe_info *traceframe_info () OVERRIDE;
+};
+
/* GDB saves trace buffers and other information (such as trace
status) got from the remote target into Common Trace Format (CTF).
The following types of information are expected to save in CTF:
@@ -845,8 +877,6 @@ static struct bt_iter_pos *start_pos;
/* The name of CTF directory. */
static char *trace_dirname;
-static struct target_ops ctf_ops;
-
/* Destroy ctf iterator and context. */
static void
@@ -1095,8 +1125,8 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
definitions from the first packet. Set the start position at the
second packet which contains events on trace blocks. */
-static void
-ctf_open (const char *dirname, int from_tty)
+void
+ctf_target::open (const char *dirname, int from_tty)
{
struct bt_ctf_event *event;
uint32_t event_id;
@@ -1148,7 +1178,7 @@ ctf_open (const char *dirname, int from_tty)
gdb_assert (start_pos->type == BT_SEEK_RESTORE);
trace_dirname = xstrdup (dirname);
- push_target (&ctf_ops);
+ push_target (this);
inferior_appeared (current_inferior (), CTF_PID);
inferior_ptid = pid_to_ptid (CTF_PID);
@@ -1157,14 +1187,14 @@ ctf_open (const char *dirname, int from_tty)
merge_uploaded_trace_state_variables (&uploaded_tsvs);
merge_uploaded_tracepoints (&uploaded_tps);
- post_create_inferior (&ctf_ops, from_tty);
+ post_create_inferior (this, from_tty);
}
/* This is the implementation of target_ops method to_close. Destroy
CTF iterator and context. */
-static void
-ctf_close (struct target_ops *self)
+void
+ctf_target::close ()
{
int pid;
@@ -1182,8 +1212,8 @@ ctf_close (struct target_ops *self)
/* This is the implementation of target_ops method to_files_info.
Print the directory name of CTF trace data. */
-static void
-ctf_files_info (struct target_ops *t)
+void
+ctf_target::files_info ()
{
printf_filtered ("\t`%s'\n", trace_dirname);
}
@@ -1193,9 +1223,8 @@ ctf_files_info (struct target_ops *t)
extract contents from events, and set REGCACHE with the contents.
If no matched events are found, mark registers unavailable. */
-static void
-ctf_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+ctf_target::fetch_registers (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct bt_ctf_event *event = NULL;
@@ -1279,11 +1308,11 @@ ctf_fetch_registers (struct target_ops *ops,
OFFSET is within the range, read the contents from events to
READBUF. */
-static enum target_xfer_status
-ctf_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+ctf_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
/* We're only doing regular memory for now. */
if (object != TARGET_OBJECT_MEMORY)
@@ -1423,9 +1452,8 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
trace variable is found, set the value of it to *VAL and return
true, otherwise return false. */
-static int
-ctf_get_trace_state_variable_value (struct target_ops *self,
- int tsvnum, LONGEST *val)
+int
+ctf_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
{
struct bt_iter_pos *pos;
int found = 0;
@@ -1541,9 +1569,9 @@ ctf_get_traceframe_address (void)
Iterate the events whose name is "frame", extract the tracepoint
number in it. Return traceframe number when matched. */
-static int
-ctf_trace_find (struct target_ops *self, enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
+int
+ctf_target::trace_find (enum trace_find_type type, int num,
+ CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
{
int ret = -1;
int tfnum = 0;
@@ -1646,8 +1674,8 @@ ctf_trace_find (struct target_ops *self, enum trace_find_type type, int num,
frame, extract memory range information, and return them in
traceframe_info. */
-static struct traceframe_info *
-ctf_traceframe_info (struct target_ops *self)
+struct traceframe_info *
+ctf_target::traceframe_info ()
{
struct traceframe_info *info = XCNEW (struct traceframe_info);
const char *name;
@@ -1713,27 +1741,6 @@ ctf_traceframe_info (struct target_ops *self)
return info;
}
-static void
-init_ctf_ops (void)
-{
- memset (&ctf_ops, 0, sizeof (ctf_ops));
-
- init_tracefile_ops (&ctf_ops);
- ctf_ops.to_shortname = "ctf";
- ctf_ops.to_longname = "CTF file";
- ctf_ops.to_doc = "Use a CTF directory as a target.\n\
-Specify the filename of the CTF directory.";
- ctf_ops.to_open = ctf_open;
- ctf_ops.to_close = ctf_close;
- ctf_ops.to_fetch_registers = ctf_fetch_registers;
- ctf_ops.to_xfer_partial = ctf_xfer_partial;
- ctf_ops.to_files_info = ctf_files_info;
- ctf_ops.to_trace_find = ctf_trace_find;
- ctf_ops.to_get_trace_state_variable_value
- = ctf_get_trace_state_variable_value;
- ctf_ops.to_traceframe_info = ctf_traceframe_info;
-}
-
#endif
/* -Wmissing-prototypes */
@@ -1746,8 +1753,6 @@ void
_initialize_ctf (void)
{
#if HAVE_LIBBABELTRACE
- init_ctf_ops ();
-
- add_target_with_completer (&ctf_ops, filename_completer);
+ add_target_with_completer (new ctf_target (), filename_completer);
#endif
}
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 590c2ad04f1..2eae7005128 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -83,34 +83,15 @@
#define PTRACE(CMD, PID, ADDR, SIG) \
darwin_ptrace(#CMD, CMD, (PID), (ADDR), (SIG))
-static void darwin_interrupt (struct target_ops *self, ptid_t);
-
-static void darwin_resume_to (struct target_ops *ops, ptid_t ptid, int step,
- enum gdb_signal signal);
static void darwin_resume (ptid_t ptid, int step,
enum gdb_signal signal);
-static ptid_t darwin_wait_to (struct target_ops *ops, ptid_t ptid,
- struct target_waitstatus *status, int options);
static ptid_t darwin_wait (ptid_t ptid, struct target_waitstatus *status);
-static void darwin_mourn_inferior (struct target_ops *ops);
-
-static void darwin_kill_inferior (struct target_ops *ops);
-
static void darwin_ptrace_me (void);
static void darwin_ptrace_him (int pid);
-static void darwin_create_inferior (struct target_ops *ops, char *exec_file,
- char *allargs, char **env, int from_tty);
-
-static void darwin_files_info (struct target_ops *ops);
-
-static char *darwin_pid_to_str (struct target_ops *ops, ptid_t tpid);
-
-static int darwin_thread_alive (struct target_ops *ops, ptid_t tpid);
-
static void darwin_encode_reply (mig_reply_error_t *reply,
mach_msg_header_t *hdr, integer_t code);
@@ -885,9 +866,8 @@ darwin_resume (ptid_t ptid, int step, enum gdb_signal signal)
}
}
-static void
-darwin_resume_to (struct target_ops *ops, ptid_t ptid, int step,
- enum gdb_signal signal)
+void
+darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
return darwin_resume (ptid, step, signal);
}
@@ -1187,25 +1167,25 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status)
return res;
}
-static ptid_t
-darwin_wait_to (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *status, int options)
+ptid_t
+darwin_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
+ int options)
{
return darwin_wait (ptid, status);
}
-static void
-darwin_interrupt (struct target_ops *self, ptid_t t)
+void
+darwin_nat_target::interrupt (ptid_t t)
{
struct inferior *inf = current_inferior ();
/* FIXME: handle in no_ptrace mode. */
gdb_assert (!inf->priv->no_ptrace);
- kill (inf->pid, SIGINT);
+ ::kill (inf->pid, SIGINT);
}
-static void
-darwin_mourn_inferior (struct target_ops *ops)
+void
+darwin_nat_target::mourn_inferior ()
{
struct inferior *inf = current_inferior ();
kern_return_t kret;
@@ -1266,7 +1246,7 @@ darwin_mourn_inferior (struct target_ops *ops)
xfree (inf->priv);
inf->priv = NULL;
- inf_child_mourn_inferior (ops);
+ inf_child_target::mourn_inferior ();
}
static void
@@ -1349,8 +1329,8 @@ darwin_restore_exception_ports (darwin_inferior *inf)
return KERN_SUCCESS;
}
-static void
-darwin_kill_inferior (struct target_ops *ops)
+void
+darwin_nat_target::kill ()
{
struct inferior *inf = current_inferior ();
struct target_waitstatus wstatus;
@@ -1369,7 +1349,7 @@ darwin_kill_inferior (struct target_ops *ops)
darwin_reply_to_all_pending_messages (inf);
- res = kill (inf->pid, 9);
+ res = ::kill (inf->pid, 9);
if (res == 0)
{
@@ -1627,9 +1607,9 @@ darwin_execvp (const char *file, char * const argv[], char * const env[])
posix_spawnp (NULL, argv[0], NULL, &attr, argv, env);
}
-static void
-darwin_create_inferior (struct target_ops *ops, char *exec_file,
- char *allargs, char **env, int from_tty)
+void
+darwin_nat_target::create_inferior (char *exec_file,
+ char *allargs, char **env, int from_tty)
{
/* Do the hard work. */
fork_inferior (exec_file, allargs, env, darwin_ptrace_me, darwin_ptrace_him,
@@ -1669,8 +1649,8 @@ darwin_setup_fake_stop_event (struct inferior *inf)
/* Attach to process PID, then initialize for debugging it
and wait for the trace-trap that results from attaching. */
-static void
-darwin_attach (struct target_ops *ops, const char *args, int from_tty)
+void
+darwin_nat_target::attach (const char *args, int from_tty)
{
pid_t pid;
pid_t pid2;
@@ -1698,7 +1678,7 @@ darwin_attach (struct target_ops *ops, const char *args, int from_tty)
gdb_flush (gdb_stdout);
}
- if (pid == 0 || kill (pid, 0) < 0)
+ if (pid == 0 || ::kill (pid, 0) < 0)
error (_("Can't attach to process %d: %s (%d)"),
pid, safe_strerror (errno), errno);
@@ -1730,8 +1710,9 @@ darwin_attach (struct target_ops *ops, const char *args, int from_tty)
to work, it may be necessary for the process to have been
previously attached. It *might* work if the program was
started via fork. */
-static void
-darwin_detach (struct target_ops *ops, const char *args, int from_tty)
+
+void
+darwin_nat_target::detach (const char *args, int from_tty)
{
pid_t pid = ptid_get_pid (inferior_ptid);
struct inferior *inf = current_inferior ();
@@ -1764,16 +1745,11 @@ darwin_detach (struct target_ops *ops, const char *args, int from_tty)
if (inf->priv->no_ptrace)
darwin_resume_inferior (inf);
- darwin_mourn_inferior (ops);
-}
-
-static void
-darwin_files_info (struct target_ops *ops)
-{
+ mourn_inferior ();
}
-static char *
-darwin_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+darwin_nat_target::pid_to_str (ptid_t ptid)
{
static char buf[80];
long tid = ptid_get_tid (ptid);
@@ -1788,8 +1764,8 @@ darwin_pid_to_str (struct target_ops *ops, ptid_t ptid)
return normal_pid_to_str (ptid);
}
-static int
-darwin_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+darwin_nat_target::thread_alive (ptid_t ptid)
{
return 1;
}
@@ -1986,11 +1962,11 @@ darwin_read_dyld_info (task_t task, CORE_ADDR addr, gdb_byte *rdaddr,
-static enum target_xfer_status
-darwin_xfer_partial (struct target_ops *ops,
- enum target_object object, const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+darwin_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
struct inferior *inf = current_inferior ();
@@ -2055,8 +2031,8 @@ set_enable_mach_exceptions (char *args, int from_tty,
}
}
-static char *
-darwin_pid_to_exec_file (struct target_ops *self, int pid)
+char *
+darwin_nat_target::pid_to_exec_file (int pid)
{
static char path[PATH_MAX];
int res;
@@ -2068,8 +2044,8 @@ darwin_pid_to_exec_file (struct target_ops *self, int pid)
return NULL;
}
-static ptid_t
-darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
+ptid_t
+darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
{
int i;
darwin_thread_t *t;
@@ -2135,17 +2111,17 @@ darwin_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
return null_ptid;
}
-static int
-darwin_supports_multi_process (struct target_ops *self)
+int
+darwin_nat_target::supports_multi_process ()
{
return 1;
}
/* -Wmissing-prototypes */
-extern initialize_file_ftype _initialize_darwin_inferior;
+extern initialize_file_ftype _initialize_darwin_nat;
void
-_initialize_darwin_inferior (void)
+_initialize_darwin_nat (void)
{
kern_return_t kret;
@@ -2160,30 +2136,6 @@ _initialize_darwin_inferior (void)
MACH_CHECK_ERROR (kret);
}
- darwin_ops = inf_child_target ();
-
- darwin_ops->to_create_inferior = darwin_create_inferior;
- darwin_ops->to_attach = darwin_attach;
- darwin_ops->to_attach_no_wait = 0;
- darwin_ops->to_detach = darwin_detach;
- darwin_ops->to_files_info = darwin_files_info;
- darwin_ops->to_wait = darwin_wait_to;
- darwin_ops->to_mourn_inferior = darwin_mourn_inferior;
- darwin_ops->to_kill = darwin_kill_inferior;
- darwin_ops->to_interrupt = darwin_interrupt;
- darwin_ops->to_resume = darwin_resume_to;
- darwin_ops->to_thread_alive = darwin_thread_alive;
- darwin_ops->to_pid_to_str = darwin_pid_to_str;
- darwin_ops->to_pid_to_exec_file = darwin_pid_to_exec_file;
- darwin_ops->to_load = NULL;
- darwin_ops->to_xfer_partial = darwin_xfer_partial;
- darwin_ops->to_supports_multi_process = darwin_supports_multi_process;
- darwin_ops->to_get_ada_task_ptid = darwin_get_ada_task_ptid;
-
- darwin_complete_target (darwin_ops);
-
- add_target (darwin_ops);
-
inferior_debug (2, _("GDB task: 0x%lx, pid: %d\n"),
(unsigned long) mach_task_self (), getpid ());
diff --git a/gdb/darwin-nat.h b/gdb/darwin-nat.h
index 7a174764f89..beaf4aa0019 100644
--- a/gdb/darwin-nat.h
+++ b/gdb/darwin-nat.h
@@ -17,8 +17,47 @@
#ifndef __DARWIN_NAT_H__
#define __DARWIN_NAT_H__
+#include "inf-child.h"
#include <mach/mach.h>
+/* This needs to be overridden by the platform specific nat code. */
+
+class darwin_nat_target : public inf_child_target
+{
+ void create_inferior (char *, char *, char **, int) OVERRIDE;
+
+ void attach (const char *, int) OVERRIDE;
+
+ void detach (const char *, int) OVERRIDE;
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+
+ void mourn_inferior () OVERRIDE;
+
+ void kill () OVERRIDE;
+
+ void interrupt (ptid_t) OVERRIDE;
+
+ void resume (ptid_t, int , enum gdb_signal) OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ char *pid_to_exec_file (int pid) OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ int supports_multi_process () OVERRIDE;
+
+ ptid_t get_ada_task_ptid (long lwp, long thread) OVERRIDE;
+};
+
/* Describe the mach exception handling state for a task. This state is saved
before being changed and restored when a process is detached.
For more information on these fields see task_get_exception_ports manual
@@ -149,11 +188,6 @@ extern void mach_check_error (kern_return_t ret, const char *file,
void darwin_set_sstep (thread_t thread, int enable);
-/* This one is called in darwin-nat.c, but needs to be provided by the
- platform specific nat code. It allows each platform to add platform specific
- stuff to the darwin_ops. */
-extern void darwin_complete_target (struct target_ops *target);
-
void darwin_check_osabi (darwin_inferior *inf, thread_t thread);
#endif /* __DARWIN_NAT_H__ */
diff --git a/gdb/elfread.c b/gdb/elfread.c
index e90466b00cb..b8d68b0b521 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -816,8 +816,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
if (target_read_memory (pointer_address, buf, ptr_size) != 0)
continue;
addr = extract_typed_address (buf, ptr_type);
- addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
- &current_target);
+ addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, target_stack);
addr = gdbarch_addr_bits_remove (gdbarch, addr);
if (addr_p)
@@ -880,8 +879,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
address_val = call_function_by_hand (function, 0, NULL);
address = value_as_address (address_val);
- address = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
- &current_target);
+ address = gdbarch_convert_from_func_ptr_addr (gdbarch, address, target_stack);
address = gdbarch_addr_bits_remove (gdbarch, address);
if (name_at_pc)
@@ -990,7 +988,7 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b)
resolved_address = value_as_address (value);
resolved_pc = gdbarch_convert_from_func_ptr_addr (gdbarch,
resolved_address,
- &current_target);
+ target_stack);
resolved_pc = gdbarch_addr_bits_remove (gdbarch, resolved_pc);
gdb_assert (current_program_space == b->pspace || b->pspace == NULL);
diff --git a/gdb/eval.c b/gdb/eval.c
index 00a107c270c..9528113d74d 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1206,7 +1206,7 @@ evaluate_subexp_standard (struct type *expect_type,
/* The address might point to a function descriptor;
resolve it to the actual code address instead. */
addr = gdbarch_convert_from_func_ptr_addr (exp->gdbarch, addr,
- &current_target);
+ target_stack);
/* Is it a high_level symbol? */
sym = find_pc_function (addr);
diff --git a/gdb/exec.c b/gdb/exec.c
index 00c31d37da6..ed48866dfe5 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -52,15 +52,52 @@ static void file_command (char *, int);
static void set_section_command (char *, int);
-static void exec_files_info (struct target_ops *);
-
-static void init_exec_ops (void);
-
void _initialize_exec (void);
/* The target vector for executable files. */
-static struct target_ops exec_ops;
+struct exec_target : public target_ops
+{
+ exec_target ();
+
+ const char *shortname () OVERRIDE
+ { return "exec"; }
+
+ const char *longname () OVERRIDE
+ { return _("Local exec file"); }
+
+ const char *doc () OVERRIDE
+ {
+ return _("\
+Use an executable file as a target.\n\
+Specify the filename of the executable file.");
+ }
+
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+ struct target_section_table *get_section_table () OVERRIDE;
+ void files_info () OVERRIDE;
+
+ int has_memory () OVERRIDE;
+ char *make_corefile_notes (bfd *, int *) OVERRIDE;
+ int find_memory_regions (find_memory_region_ftype func, void *data) OVERRIDE;
+};
+
+static exec_target *the_exec_target;
+
+/* Fill in the exec file target vector. Very few entries need to be
+ defined. */
+
+exec_target::exec_target ()
+{
+ to_stratum = file_stratum;
+}
/* Whether to open exec and core files read-only or read-write. */
@@ -74,8 +111,8 @@ show_write_files (struct ui_file *file, int from_tty,
}
-static void
-exec_open (const char *args, int from_tty)
+void
+exec_target::open (const char *args, int from_tty)
{
target_preopen (from_tty);
exec_file_attach (args, from_tty);
@@ -108,8 +145,8 @@ exec_close (void)
/* This is the target_close implementation. Clears all target
sections and closes all executable bfds from all program spaces. */
-static void
-exec_close_1 (struct target_ops *self)
+void
+exec_target::close ()
{
struct program_space *ss;
struct cleanup *old_chain;
@@ -125,16 +162,6 @@ exec_close_1 (struct target_ops *self)
do_cleanups (old_chain);
}
-void
-exec_file_clear (int from_tty)
-{
- /* Remove exec file. */
- exec_close ();
-
- if (from_tty)
- printf_unfiltered (_("No executable file now.\n"));
-}
-
/* Returns non-zero if exceptions E1 and E2 are equal. Returns zero
otherwise. */
@@ -581,8 +608,8 @@ add_target_sections (void *owner,
/* If these are the first file sections we can provide memory
from, push the file_stratum target. */
- if (!target_is_pushed (&exec_ops))
- push_target (&exec_ops);
+ if (!target_is_pushed (the_exec_target))
+ push_target (the_exec_target);
}
}
@@ -670,7 +697,7 @@ remove_target_sections (void *owner)
!= pspace->target_sections.sections_end)
return;
- unpush_target (&exec_ops);
+ unpush_target (the_exec_target);
}
}
}
@@ -776,7 +803,7 @@ section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
mem_range_s *r;
int i;
- table = target_get_section_table (&exec_ops);
+ table = target_get_section_table (the_exec_target);
available_memory = section_table_available_memory (available_memory,
offset, len,
table->sections,
@@ -897,19 +924,19 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
return TARGET_XFER_EOF; /* We can't help. */
}
-static struct target_section_table *
-exec_get_section_table (struct target_ops *ops)
+struct target_section_table *
+exec_target::get_section_table ()
{
return current_target_sections;
}
-static enum target_xfer_status
-exec_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+exec_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
- struct target_section_table *table = target_get_section_table (ops);
+ struct target_section_table *table = get_section_table ();
if (object == TARGET_OBJECT_MEMORY)
return section_table_xfer_memory_partial (readbuf, writebuf,
@@ -991,8 +1018,8 @@ print_section_info (struct target_section_table *t, bfd *abfd)
}
}
-static void
-exec_files_info (struct target_ops *t)
+void
+exec_target::files_info ()
{
if (exec_bfd)
print_section_info (current_target_sections, exec_bfd);
@@ -1032,7 +1059,7 @@ set_section_command (char *args, int from_tty)
p->addr += offset;
p->endaddr += offset;
if (from_tty)
- exec_files_info (&exec_ops);
+ the_exec_target->files_info ();
return;
}
}
@@ -1064,29 +1091,8 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
}
}
-/* If mourn is being called in all the right places, this could be say
- `gdb internal error' (since generic_mourn calls
- breakpoint_init_inferior). */
-
-static int
-ignore (struct target_ops *ops, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
-{
- return 0;
-}
-
-/* Implement the to_remove_breakpoint method. */
-
-static int
-exec_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt,
- enum remove_bp_reason reason)
-{
- return 0;
-}
-
-static int
-exec_has_memory (struct target_ops *ops)
+int
+exec_target::has_memory ()
{
/* We can provide memory if we have any file/target sections to read
from. */
@@ -1094,34 +1100,16 @@ exec_has_memory (struct target_ops *ops)
!= current_target_sections->sections_end);
}
-static char *
-exec_make_note_section (struct target_ops *self, bfd *obfd, int *note_size)
+char *
+exec_target::make_corefile_notes (bfd *obfd, int *note_size)
{
error (_("Can't create a corefile"));
}
-/* Fill in the exec file target vector. Very few entries need to be
- defined. */
-
-static void
-init_exec_ops (void)
+int
+exec_target::find_memory_regions (find_memory_region_ftype func, void *data)
{
- exec_ops.to_shortname = "exec";
- exec_ops.to_longname = "Local exec file";
- exec_ops.to_doc = "Use an executable file as a target.\n\
-Specify the filename of the executable file.";
- exec_ops.to_open = exec_open;
- exec_ops.to_close = exec_close_1;
- exec_ops.to_xfer_partial = exec_xfer_partial;
- exec_ops.to_get_section_table = exec_get_section_table;
- exec_ops.to_files_info = exec_files_info;
- exec_ops.to_insert_breakpoint = ignore;
- exec_ops.to_remove_breakpoint = exec_remove_breakpoint;
- exec_ops.to_stratum = file_stratum;
- exec_ops.to_has_memory = exec_has_memory;
- exec_ops.to_make_corefile_notes = exec_make_note_section;
- exec_ops.to_find_memory_regions = objfile_find_memory_regions;
- exec_ops.to_magic = OPS_MAGIC;
+ return objfile_find_memory_regions (this, func, data);
}
void
@@ -1129,8 +1117,6 @@ _initialize_exec (void)
{
struct cmd_list_element *c;
- init_exec_ops ();
-
if (!dbx_commands)
{
c = add_cmd ("file", class_files, file_command, _("\
@@ -1164,5 +1150,6 @@ Show writing into executable and core files."), NULL,
show_write_files,
&setlist, &showlist);
- add_target_with_completer (&exec_ops, filename_completer);
+ the_exec_target = new exec_target ();
+ add_target_with_completer (the_exec_target, filename_completer);
}
diff --git a/gdb/frame.c b/gdb/frame.c
index c25ce4c41c3..ec169387db9 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2133,7 +2133,7 @@ inside_main_func (struct frame_info *this_frame)
returned. */
maddr = gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame),
BMSYMBOL_VALUE_ADDRESS (msymbol),
- &current_target);
+ target_stack);
return maddr == get_frame_func (this_frame);
}
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 8b101bcabef..571f8d3f8c0 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -141,7 +141,7 @@ extern void specify_exec_file_hook (void (*hook) (const char *filename));
extern bfd *core_bfd;
-extern struct target_ops *core_target;
+extern struct target_ops *the_core_target;
/* Whether to open exec and core files read-only or read-write. */
@@ -158,8 +158,6 @@ extern void exec_file_attach (const char *filename, int from_tty);
extern void exec_file_locate_attach (int pid, int from_tty);
-extern void exec_file_clear (int from_tty);
-
extern void validate_files (void);
/* The current default bfd target. */
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 5bf36a276dc..92049ad1ffa 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1262,7 +1262,7 @@ gnuv3_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc)
of the real function from the function descriptor before passing on
the address to other layers of GDB. */
func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, method_stop_pc,
- &current_target);
+ target_stack);
if (func_addr != 0)
method_stop_pc = func_addr;
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index 63f91ff6a0c..b82d506bc28 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -43,12 +43,21 @@
#include "amd64-darwin-tdep.h"
#endif
+struct i386_darwin_nat_target FINAL : public x86_nat_target<darwin_nat_target>
+{
+ /* Add our register access methods. */
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+};
+
+static struct i386_darwin_nat_target darwin_target;
+
/* Read register values from the inferior process.
If REGNO is -1, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
-static void
-i386_darwin_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+
+void
+i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
thread_t current_thread = ptid_get_tid (inferior_ptid);
int fetched = 0;
@@ -163,9 +172,9 @@ i386_darwin_fetch_inferior_registers (struct target_ops *ops,
If REGNO is -1, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
-static void
-i386_darwin_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+i386_darwin_nat_target::store_registers (struct regcache *regcache,
+ int regno)
{
thread_t current_thread = ptid_get_tid (inferior_ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -627,8 +636,11 @@ darwin_set_sstep (thread_t thread, int enable)
}
}
+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_i386_darwin_nat;
+
void
-darwin_complete_target (struct target_ops *target)
+_initialize_i386_darwin_nat (void)
{
#ifdef BFD64
amd64_native_gregset64_reg_offset = amd64_darwin_thread_state_reg_offset;
@@ -637,8 +649,6 @@ darwin_complete_target (struct target_ops *target)
amd64_native_gregset32_num_regs = i386_darwin_thread_state_num_regs;
#endif
- x86_use_watchpoints (target);
-
x86_dr_low.set_control = i386_darwin_dr_set_control;
x86_dr_low.set_addr = i386_darwin_dr_set_addr;
x86_dr_low.get_addr = i386_darwin_dr_get_addr;
@@ -652,6 +662,5 @@ darwin_complete_target (struct target_ops *target)
x86_set_debug_register_length (4);
#endif
- target->to_fetch_registers = i386_darwin_fetch_inferior_registers;
- target->to_store_registers = i386_darwin_store_inferior_registers;
+ add_target (&darwin_target);
}
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 70d954fdc00..a6fcf180312 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -33,10 +33,19 @@
#include "i386-linux-tdep.h"
#include "x86-xstate.h"
-#include "linux-nat.h"
#include "x86-linux-nat.h"
#include "nat/linux-ptrace.h"
+struct i386_linux_nat_target FINAL : public x86_linux_nat_target
+{
+ /* Add our register access methods. */
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+
+ /* Override the default ptrace resume method. */
+ void low_resume (ptid_t ptid, int step, enum gdb_signal sig) OVERRIDE;
+};
+
/* The register sets used in GNU/Linux ELF core-dumps are identical to
the register sets in `struct user' that is used for a.out
core-dumps, and is also used by `ptrace'. The corresponding types
@@ -451,9 +460,8 @@ store_fpxregs (const struct regcache *regcache, int tid, int regno)
this for all registers (including the floating point and SSE
registers). */
-static void
-i386_linux_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+i386_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
int tid;
@@ -486,7 +494,7 @@ i386_linux_fetch_inferior_registers (struct target_ops *ops,
/* The call above might reset `have_ptrace_getregs'. */
if (!have_ptrace_getregs)
{
- i386_linux_fetch_inferior_registers (ops, regcache, regno);
+ fetch_registers (regcache, regno);
return;
}
@@ -532,9 +540,8 @@ i386_linux_fetch_inferior_registers (struct target_ops *ops,
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-static void
-i386_linux_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+i386_linux_nat_target::store_registers (struct regcache *regcache, int regno)
{
int tid;
@@ -646,9 +653,8 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 };
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
-static void
-i386_linux_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal signal)
+void
+i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal)
{
int pid = ptid_get_lwp (ptid);
int request;
@@ -718,19 +724,12 @@ i386_linux_resume (struct target_ops *ops,
/* -Wmissing-prototypes */
extern initialize_file_ftype _initialize_i386_linux_nat;
+
void
_initialize_i386_linux_nat (void)
{
- /* Create a generic x86 GNU/Linux target. */
- struct target_ops *t = x86_linux_create_target ();
-
- /* Override the default ptrace resume method. */
- t->to_resume = i386_linux_resume;
-
- /* Add our register access methods. */
- t->to_fetch_registers = i386_linux_fetch_inferior_registers;
- t->to_store_registers = i386_linux_store_inferior_registers;
+ linux_target = new i386_linux_nat_target ();
/* Add the target. */
- x86_linux_add_target (t);
+ x86_linux_add_target (linux_target);
}
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 5a144090548..e9acc1dc45a 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -2678,7 +2678,7 @@ getunwind_table (gdb_byte **buf_p)
we should find a way to override the corefile layer's
xfer_partial method. */
- x = target_read_alloc (&current_target, TARGET_OBJECT_UNWIND_TABLE,
+ x = target_read_alloc (target_stack, TARGET_OBJECT_UNWIND_TABLE,
NULL, buf_p);
return x;
diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c
index b3891633bdf..8b2aa824848 100644
--- a/gdb/ia64-vms-tdep.c
+++ b/gdb/ia64-vms-tdep.c
@@ -42,7 +42,7 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
CORE_ADDR table_addr;
unsigned int info_len;
- res = target_read (&current_target, TARGET_OBJECT_OPENVMS_UIB,
+ res = target_read (target_stack, TARGET_OBJECT_OPENVMS_UIB,
annex + 2, buf, 0, sizeof (buf));
if (res != sizeof (buf))
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 7909b0c2a42..8298738584d 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -67,35 +67,11 @@ store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
}
}
-/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
- for all registers. */
+inf_child_target::~inf_child_target ()
+{}
-static void
-inf_child_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
-{
- if (regnum == -1)
- {
- for (regnum = 0;
- regnum < gdbarch_num_regs (get_regcache_arch (regcache));
- regnum++)
- regcache_raw_supply (regcache, regnum, NULL);
- }
- else
- regcache_raw_supply (regcache, regnum, NULL);
-}
-
-/* Store register REGNUM back into the inferior. If REGNUM is -1, do
- this for all registers (including the floating point registers). */
-
-static void
-inf_child_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
-{
-}
-
-static void
-inf_child_post_attach (struct target_ops *self, int pid)
+void
+inf_child_target::post_attach (int pid)
{
/* This target doesn't require a meaningful "post attach" operation
by a debugger. */
@@ -107,10 +83,45 @@ inf_child_post_attach (struct target_ops *self, int pid)
makes sure that registers contains all the registers from the
program being debugged. */
-static void
-inf_child_prepare_to_store (struct target_ops *self,
- struct regcache *regcache)
+void
+inf_child_target::prepare_to_store (struct regcache *regcache)
+{
+}
+
+bool
+inf_child_target::supports_terminal_ours ()
+{
+ return true;
+}
+
+void
+inf_child_target::terminal_init ()
+{
+ child_terminal_init (this);
+}
+
+void
+inf_child_target::terminal_inferior ()
+{
+ child_terminal_inferior (this);
+}
+
+void
+inf_child_target::terminal_ours_for_output ()
+{
+ child_terminal_ours_for_output (this);
+}
+
+void
+inf_child_target::terminal_ours ()
+{
+ child_terminal_ours (this);
+}
+
+void
+inf_child_target::terminal_info (const char *args, int from_tty)
{
+ child_terminal_info (this, args, from_tty);
}
/* True if the user did "target native". In that case, we won't
@@ -131,16 +142,16 @@ inf_child_open_target (struct target_ops *target, const char *arg,
printf_filtered ("Done. Use the \"run\" command to start a process.\n");
}
-static void
-inf_child_open (const char *arg, int from_tty)
+void
+inf_child_target::open (const char *arg, int from_tty)
{
- inf_child_open_target (inf_child_ops, arg, from_tty);
+ inf_child_open_target (this, arg, from_tty);
}
/* Implement the to_disconnect target_ops method. */
-static void
-inf_child_disconnect (struct target_ops *target, const char *args, int from_tty)
+void
+inf_child_target::disconnect (const char *args, int from_tty)
{
if (args != NULL)
error (_("Argument given to \"disconnect\"."));
@@ -152,65 +163,98 @@ inf_child_disconnect (struct target_ops *target, const char *args, int from_tty)
/* Implement the to_close target_ops method. */
-static void
-inf_child_close (struct target_ops *target)
+void
+inf_child_target::close ()
{
/* In case we were forcibly closed. */
inf_child_explicitly_opened = 0;
}
void
-inf_child_mourn_inferior (struct target_ops *ops)
+inf_child_target::mourn_inferior ()
{
generic_mourn_inferior ();
- inf_child_maybe_unpush_target (ops);
+ maybe_unpush_target ();
}
/* See inf-child.h. */
void
-inf_child_maybe_unpush_target (struct target_ops *ops)
+inf_child_target::maybe_unpush_target ()
{
if (!inf_child_explicitly_opened && !have_inferiors ())
- unpush_target (ops);
+ unpush_target (this);
}
-static void
-inf_child_post_startup_inferior (struct target_ops *self, ptid_t ptid)
+void
+inf_child_target::post_startup_inferior (ptid_t ptid)
{
/* This target doesn't require a meaningful "post startup inferior"
operation by a debugger. */
}
-static int
-inf_child_follow_fork (struct target_ops *ops, int follow_child,
- int detach_fork)
+int
+inf_child_target::can_run ()
{
- /* This target doesn't support following fork or vfork events. */
- return 0;
+ return 1;
}
-static int
-inf_child_can_run (struct target_ops *self)
+bool
+inf_child_target::can_create_inferior ()
{
- return 1;
+ return true;
}
-static char *
-inf_child_pid_to_exec_file (struct target_ops *self, int pid)
+bool
+inf_child_target::can_attach ()
+{
+ return true;
+}
+
+char *
+inf_child_target::pid_to_exec_file (int pid)
{
/* This target doesn't support translation of a process ID to the
filename of the executable file. */
return NULL;
}
+int
+inf_child_target::has_all_memory ()
+{
+ return default_child_has_all_memory ();
+}
+
+int
+inf_child_target::has_memory ()
+{
+ return default_child_has_memory ();
+}
+
+int
+inf_child_target::has_stack ()
+{
+ return default_child_has_stack ();
+}
+
+int
+inf_child_target::has_registers ()
+{
+ return default_child_has_registers ();
+}
+
+int
+inf_child_target::has_execution (ptid_t ptid)
+{
+ return default_child_has_execution (ptid);
+}
+
/* Implementation of to_fileio_open. */
-static int
-inf_child_fileio_open (struct target_ops *self,
- struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
- int *target_errno)
+int
+inf_child_target::fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno)
{
int nat_flags;
mode_t nat_mode;
@@ -232,10 +276,9 @@ inf_child_fileio_open (struct target_ops *self,
/* Implementation of to_fileio_pwrite. */
-static int
-inf_child_fileio_pwrite (struct target_ops *self,
- int fd, const gdb_byte *write_buf, int len,
- ULONGEST offset, int *target_errno)
+int
+inf_child_target::fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, int *target_errno)
{
int ret;
@@ -260,10 +303,9 @@ inf_child_fileio_pwrite (struct target_ops *self,
/* Implementation of to_fileio_pread. */
-static int
-inf_child_fileio_pread (struct target_ops *self,
- int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, int *target_errno)
+int
+inf_child_target::fileio_pread (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *target_errno)
{
int ret;
@@ -288,9 +330,8 @@ inf_child_fileio_pread (struct target_ops *self,
/* Implementation of to_fileio_fstat. */
-static int
-inf_child_fileio_fstat (struct target_ops *self, int fd,
- struct stat *sb, int *target_errno)
+int
+inf_child_target::fileio_fstat (int fd, struct stat *sb, int *target_errno)
{
int ret;
@@ -303,12 +344,12 @@ inf_child_fileio_fstat (struct target_ops *self, int fd,
/* Implementation of to_fileio_close. */
-static int
-inf_child_fileio_close (struct target_ops *self, int fd, int *target_errno)
+int
+inf_child_target::fileio_close (int fd, int *target_errno)
{
int ret;
- ret = close (fd);
+ ret = ::close (fd);
if (ret == -1)
*target_errno = host_to_fileio_error (errno);
@@ -317,10 +358,9 @@ inf_child_fileio_close (struct target_ops *self, int fd, int *target_errno)
/* Implementation of to_fileio_unlink. */
-static int
-inf_child_fileio_unlink (struct target_ops *self,
- struct inferior *inf, const char *filename,
- int *target_errno)
+int
+inf_child_target::fileio_unlink (struct inferior *inf, const char *filename,
+ int *target_errno)
{
int ret;
@@ -333,10 +373,9 @@ inf_child_fileio_unlink (struct target_ops *self,
/* Implementation of to_fileio_readlink. */
-static char *
-inf_child_fileio_readlink (struct target_ops *self,
- struct inferior *inf, const char *filename,
- int *target_errno)
+char *
+inf_child_target::fileio_readlink (struct inferior *inf, const char *filename,
+ int *target_errno)
{
/* We support readlink only on systems that also provide a compile-time
maximum path length (PATH_MAX), at least for now. */
@@ -362,83 +401,25 @@ inf_child_fileio_readlink (struct target_ops *self,
#endif
}
-static int
-inf_child_use_agent (struct target_ops *self, int use)
+int
+inf_child_target::use_agent (int use)
{
if (agent_loaded_p ())
{
- use_agent = use;
+ ::use_agent = use;
return 1;
}
else
return 0;
}
-static int
-inf_child_can_use_agent (struct target_ops *self)
+int
+inf_child_target::can_use_agent ()
{
return agent_loaded_p ();
}
-/* Default implementation of the to_can_async_p and
- to_supports_non_stop methods. */
-
-static int
-return_zero (struct target_ops *ignore)
-{
- return 0;
-}
-
-struct target_ops *
-inf_child_target (void)
-{
- struct target_ops *t = XCNEW (struct target_ops);
-
- t->to_shortname = "native";
- t->to_longname = "Native process";
- t->to_doc = "Native process (started by the \"run\" command).";
- t->to_open = inf_child_open;
- t->to_close = inf_child_close;
- t->to_disconnect = inf_child_disconnect;
- t->to_post_attach = inf_child_post_attach;
- t->to_fetch_registers = inf_child_fetch_inferior_registers;
- t->to_store_registers = inf_child_store_inferior_registers;
- t->to_prepare_to_store = inf_child_prepare_to_store;
- t->to_insert_breakpoint = memory_insert_breakpoint;
- t->to_remove_breakpoint = memory_remove_breakpoint;
- t->to_terminal_init = child_terminal_init;
- t->to_terminal_inferior = child_terminal_inferior;
- t->to_terminal_ours_for_output = child_terminal_ours_for_output;
- t->to_terminal_ours = child_terminal_ours;
- t->to_terminal_info = child_terminal_info;
- t->to_post_startup_inferior = inf_child_post_startup_inferior;
- t->to_follow_fork = inf_child_follow_fork;
- t->to_can_run = inf_child_can_run;
- /* We must default these because they must be implemented by any
- target that can run. */
- t->to_can_async_p = return_zero;
- t->to_supports_non_stop = return_zero;
- t->to_pid_to_exec_file = inf_child_pid_to_exec_file;
- t->to_stratum = process_stratum;
- t->to_has_all_memory = default_child_has_all_memory;
- t->to_has_memory = default_child_has_memory;
- t->to_has_stack = default_child_has_stack;
- t->to_has_registers = default_child_has_registers;
- t->to_has_execution = default_child_has_execution;
- t->to_fileio_open = inf_child_fileio_open;
- t->to_fileio_pwrite = inf_child_fileio_pwrite;
- t->to_fileio_pread = inf_child_fileio_pread;
- t->to_fileio_fstat = inf_child_fileio_fstat;
- t->to_fileio_close = inf_child_fileio_close;
- t->to_fileio_unlink = inf_child_fileio_unlink;
- t->to_fileio_readlink = inf_child_fileio_readlink;
- t->to_magic = OPS_MAGIC;
- t->to_use_agent = inf_child_use_agent;
- t->to_can_use_agent = inf_child_can_use_agent;
-
- /* Store a pointer so we can push the most-derived target from
- inf_child_open. */
- inf_child_ops = t;
-
- return t;
+inf_child_target::inf_child_target ()
+{
+ this->to_stratum = process_stratum;
}
diff --git a/gdb/inf-child.h b/gdb/inf-child.h
index 2c5deecb138..4991e983281 100644
--- a/gdb/inf-child.h
+++ b/gdb/inf-child.h
@@ -20,33 +20,100 @@
#ifndef INF_CHILD_H
#define INF_CHILD_H
-/* Create a prototype child target. The client can override it with
- local methods. */
+/* A prototype child target. The client can override it with local
+ methods. */
-extern struct target_ops *inf_child_target (void);
+struct inf_child_target
+ : public memory_breakpoint_target<target_ops>
+{
+ inf_child_target ();
+ ~inf_child_target () OVERRIDE = 0;
-/* Functions for helping to write a native target. */
+ const char *shortname () OVERRIDE
+ { return "native"; }
-/* This is for native targets which use a unix/POSIX-style waitstatus. */
-extern void store_waitstatus (struct target_waitstatus *, int);
+ const char *longname () OVERRIDE
+ { return _("Native process"); }
+
+ const char *doc () OVERRIDE
+ { return _("Native process (started by the \"run\" command)."); }
+
+ void open (const char *arg, int from_tty) OVERRIDE;
+ void close () OVERRIDE;
+
+ void disconnect (const char *, int) OVERRIDE;
+
+ void fetch_registers (struct regcache *, int) OVERRIDE = 0;
+ void store_registers (struct regcache *, int) OVERRIDE = 0;
+
+ void prepare_to_store (struct regcache *) OVERRIDE;
+
+ bool supports_terminal_ours () OVERRIDE;
+ void terminal_init () OVERRIDE;
+ void terminal_inferior () OVERRIDE;
+ void terminal_ours_for_output () OVERRIDE;
+ void terminal_ours () OVERRIDE;
+ void terminal_info (const char *, int) OVERRIDE;
+
+ void post_startup_inferior (ptid_t) OVERRIDE;
-/* This is to be called by the native target's open routine to push
- the target, in case it need to override to_open. */
+ void mourn_inferior () OVERRIDE;
-extern void inf_child_open_target (struct target_ops *target,
- const char *arg, int from_tty);
+ int can_run () OVERRIDE;
-/* To be called by the native target's to_mourn_inferior routine. */
+ bool can_create_inferior () OVERRIDE;
+ void create_inferior (char *, char *, char **, int) OVERRIDE = 0;
-extern void inf_child_mourn_inferior (struct target_ops *ops);
+ bool can_attach () OVERRIDE;
+ void attach (const char *, int) OVERRIDE = 0;
-/* Unpush the target if it wasn't explicitly open with "target native"
- and there are no live inferiors left. Note: if calling this as a
- result of a mourn or detach, the current inferior shall already
- have its PID cleared, so it isn't counted as live. That's usually
- done by calling either generic_mourn_inferior or
- detach_inferior. */
+ void post_attach (int);
-extern void inf_child_maybe_unpush_target (struct target_ops *ops);
+ /* We must default these because they must be implemented by any
+ target that can run. */
+ int can_async_p () OVERRIDE { return 0; }
+ int supports_non_stop () OVERRIDE { return 0; }
+
+ char *pid_to_exec_file (int pid) OVERRIDE;
+
+ int has_all_memory () OVERRIDE;
+ int has_memory () OVERRIDE;
+ int has_stack () OVERRIDE;
+ int has_registers () OVERRIDE;
+ int has_execution (ptid_t) OVERRIDE;
+
+ int fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno) OVERRIDE;
+ int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, int *target_errno) OVERRIDE;
+ int fileio_pread (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *target_errno) OVERRIDE;
+ int fileio_fstat (int fd, struct stat *sb, int *target_errno) OVERRIDE;
+ int fileio_close (int fd, int *target_errno) OVERRIDE;
+ int fileio_unlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno) OVERRIDE;
+ char *fileio_readlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno) OVERRIDE;
+ int use_agent (int use) OVERRIDE;
+
+ int can_use_agent () OVERRIDE;
+
+ protected:
+ /* Unpush the target if it wasn't explicitly open with "target native"
+ and there are no live inferiors left. Note: if calling this as a
+ result of a mourn or detach, the current inferior shall already
+ have its PID cleared, so it isn't counted as live. That's usually
+ done by calling either generic_mourn_inferior or
+ detach_inferior. */
+ void maybe_unpush_target ();
+};
+
+/* Functions for helping to write a native target. */
+
+/* This is for native targets which use a unix/POSIX-style waitstatus. */
+extern void store_waitstatus (struct target_waitstatus *, int);
#endif
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 0896cff8cba..f2d4ae0a0af 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -34,14 +34,16 @@
+inf_ptrace_target::~inf_ptrace_target ()
+{}
+
#ifdef PT_GET_PROCESS_STATE
/* Target hook for follow_fork. On entry and at return inferior_ptid is
the ptid of the followed inferior. */
-static int
-inf_ptrace_follow_fork (struct target_ops *ops, int follow_child,
- int detach_fork)
+int
+inf_ptrace_target::follow_fork (int follow_child, int detach_fork)
{
if (!follow_child)
{
@@ -58,14 +60,14 @@ inf_ptrace_follow_fork (struct target_ops *ops, int follow_child,
return 0;
}
-static int
-inf_ptrace_insert_fork_catchpoint (struct target_ops *self, int pid)
+int
+inf_ptrace_target::insert_fork_catchpoint (int pid)
{
return 0;
}
-static int
-inf_ptrace_remove_fork_catchpoint (struct target_ops *self, int pid)
+int
+inf_ptrace_target::remove_fork_catchpoint (int pid)
{
return 0;
}
@@ -87,23 +89,22 @@ inf_ptrace_me (void)
ENV is the environment vector to pass. If FROM_TTY is non-zero, be
chatty about it. */
-static void
-inf_ptrace_create_inferior (struct target_ops *ops,
- char *exec_file, char *allargs, char **env,
- int from_tty)
+void
+inf_ptrace_target::create_inferior (char *exec_file, char *allargs, char **env,
+ int from_tty)
{
int pid;
/* Do not change either targets above or the same target if already present.
The reason is the target stack is shared across multiple inferiors. */
- int ops_already_pushed = target_is_pushed (ops);
+ int ops_already_pushed = target_is_pushed (this);
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
if (! ops_already_pushed)
{
/* Clear possible core file with its process_stratum. */
- push_target (ops);
- make_cleanup_unpush_target (ops);
+ push_target (this);
+ make_cleanup_unpush_target (this);
}
pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
@@ -120,8 +121,8 @@ inf_ptrace_create_inferior (struct target_ops *ops,
#ifdef PT_GET_PROCESS_STATE
-static void
-inf_ptrace_post_startup_inferior (struct target_ops *self, ptid_t pid)
+void
+inf_ptrace_target::post_startup_inferior (ptid_t pid)
{
ptrace_event_t pe;
@@ -137,8 +138,8 @@ inf_ptrace_post_startup_inferior (struct target_ops *self, ptid_t pid)
/* Clean up a rotting corpse of an inferior after it died. */
-static void
-inf_ptrace_mourn_inferior (struct target_ops *ops)
+void
+inf_ptrace_target::mourn_inferior ()
{
int status;
@@ -148,14 +149,14 @@ inf_ptrace_mourn_inferior (struct target_ops *ops)
only report its exit status to its original parent. */
waitpid (ptid_get_pid (inferior_ptid), &status, 0);
- inf_child_mourn_inferior (ops);
+ inf_child_target::mourn_inferior ();
}
/* Attach to the process specified by ARGS. If FROM_TTY is non-zero,
be chatty about it. */
-static void
-inf_ptrace_attach (struct target_ops *ops, const char *args, int from_tty)
+void
+inf_ptrace_target::attach (const char *args, int from_tty)
{
char *exec_file;
pid_t pid;
@@ -163,7 +164,7 @@ inf_ptrace_attach (struct target_ops *ops, const char *args, int from_tty)
/* Do not change either targets above or the same target if already present.
The reason is the target stack is shared across multiple inferiors. */
- int ops_already_pushed = target_is_pushed (ops);
+ int ops_already_pushed = target_is_pushed (this);
struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
pid = parse_pid_to_attach (args);
@@ -175,8 +176,8 @@ inf_ptrace_attach (struct target_ops *ops, const char *args, int from_tty)
{
/* target_pid_to_str already uses the target. Also clear possible core
file with its process_stratum. */
- push_target (ops);
- make_cleanup_unpush_target (ops);
+ push_target (this);
+ make_cleanup_unpush_target (this);
}
if (from_tty)
@@ -216,8 +217,8 @@ inf_ptrace_attach (struct target_ops *ops, const char *args, int from_tty)
#ifdef PT_GET_PROCESS_STATE
-static void
-inf_ptrace_post_attach (struct target_ops *self, int pid)
+void
+inf_ptrace_target::post_attach (int pid)
{
ptrace_event_t pe;
@@ -234,8 +235,8 @@ inf_ptrace_post_attach (struct target_ops *self, int pid)
/* Detach from the inferior, optionally passing it the signal
specified by ARGS. If FROM_TTY is non-zero, be chatty about it. */
-static void
-inf_ptrace_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+inf_ptrace_target::detach (const char *args, int from_tty)
{
pid_t pid = ptid_get_pid (inferior_ptid);
int sig = 0;
@@ -257,26 +258,26 @@ inf_ptrace_detach (struct target_ops *ops, const char *args, int from_tty)
error (_("This system does not support detaching from a process"));
#endif
- inf_ptrace_detach_success (ops);
+ detach_success ();
}
/* See inf-ptrace.h. */
void
-inf_ptrace_detach_success (struct target_ops *ops)
+inf_ptrace_target::detach_success ()
{
pid_t pid = ptid_get_pid (inferior_ptid);
inferior_ptid = null_ptid;
detach_inferior (pid);
- inf_child_maybe_unpush_target (ops);
+ maybe_unpush_target ();
}
/* Kill the inferior. */
-static void
-inf_ptrace_kill (struct target_ops *ops)
+void
+inf_ptrace_target::kill ()
{
pid_t pid = ptid_get_pid (inferior_ptid);
int status;
@@ -292,15 +293,15 @@ inf_ptrace_kill (struct target_ops *ops)
/* Interrupt the inferior. */
-static void
-inf_ptrace_interrupt (struct target_ops *self, ptid_t ptid)
+void
+inf_ptrace_target::interrupt (ptid_t ptid)
{
/* Send a SIGINT to the process group. This acts just like the user
typed a ^C on the controlling terminal. Note that using a
negative process number in kill() is a System V-ism. The proper
BSD interface is killpg(). However, all modern BSDs support the
System V interface too. */
- kill (-inferior_process_group (), SIGINT);
+ ::kill (-inferior_process_group (), SIGINT);
}
/* Return which PID to pass to ptrace in order to observe/control the
@@ -323,9 +324,8 @@ get_ptrace_pid (ptid_t ptid)
STEP is nonzero, single-step it. If SIGNAL is nonzero, give it
that signal. */
-static void
-inf_ptrace_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal signal)
+void
+inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
pid_t pid;
int request;
@@ -365,9 +365,9 @@ inf_ptrace_resume (struct target_ops *ops,
process ID of the child, or MINUS_ONE_PTID in case of error; store
the status in *OURSTATUS. */
-static ptid_t
-inf_ptrace_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *ourstatus, int options)
+ptid_t
+inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
+ int options)
{
pid_t pid;
int status, save_errno;
@@ -447,11 +447,11 @@ inf_ptrace_wait (struct target_ops *ops,
/* Implement the to_xfer_partial target_ops method. */
-static enum target_xfer_status
-inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+inf_ptrace_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
pid_t pid = ptid_get_pid (inferior_ptid);
@@ -603,17 +603,17 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
/* Return non-zero if the thread specified by PTID is alive. */
-static int
-inf_ptrace_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+inf_ptrace_target::thread_alive (ptid_t ptid)
{
/* ??? Is kill the right way to do this? */
- return (kill (ptid_get_pid (ptid), 0) != -1);
+ return (::kill (ptid_get_pid (ptid), 0) != -1);
}
/* Print status information about what we're accessing. */
-static void
-inf_ptrace_files_info (struct target_ops *ignore)
+void
+inf_ptrace_target::files_info ()
{
struct inferior *inf = current_inferior ();
@@ -622,8 +622,8 @@ inf_ptrace_files_info (struct target_ops *ignore)
target_pid_to_str (inferior_ptid));
}
-static char *
-inf_ptrace_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+inf_ptrace_target::pid_to_str (ptid_t ptid)
{
return normal_pid_to_str (ptid);
}
@@ -635,9 +635,9 @@ inf_ptrace_pid_to_str (struct target_ops *ops, ptid_t ptid)
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
-static int
-inf_ptrace_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
- gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+int
+inf_ptrace_target::auxv_parse (gdb_byte **readptr, gdb_byte *endptr,
+ CORE_ADDR *typep, CORE_ADDR *valp)
{
struct type *int_type = builtin_type (target_gdbarch ())->builtin_int;
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
@@ -662,179 +662,4 @@ inf_ptrace_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
}
#endif
-
-/* Create a prototype ptrace target. The client can override it with
- local methods. */
-
-struct target_ops *
-inf_ptrace_target (void)
-{
- struct target_ops *t = inf_child_target ();
-
- t->to_attach = inf_ptrace_attach;
- t->to_detach = inf_ptrace_detach;
- t->to_resume = inf_ptrace_resume;
- t->to_wait = inf_ptrace_wait;
- t->to_files_info = inf_ptrace_files_info;
- t->to_kill = inf_ptrace_kill;
- t->to_create_inferior = inf_ptrace_create_inferior;
-#ifdef PT_GET_PROCESS_STATE
- t->to_follow_fork = inf_ptrace_follow_fork;
- t->to_insert_fork_catchpoint = inf_ptrace_insert_fork_catchpoint;
- t->to_remove_fork_catchpoint = inf_ptrace_remove_fork_catchpoint;
- t->to_post_startup_inferior = inf_ptrace_post_startup_inferior;
- t->to_post_attach = inf_ptrace_post_attach;
-#endif
- t->to_mourn_inferior = inf_ptrace_mourn_inferior;
- t->to_thread_alive = inf_ptrace_thread_alive;
- t->to_pid_to_str = inf_ptrace_pid_to_str;
- t->to_interrupt = inf_ptrace_interrupt;
- t->to_xfer_partial = inf_ptrace_xfer_partial;
-#if defined (PT_IO) && defined (PIOD_READ_AUXV)
- t->to_auxv_parse = inf_ptrace_auxv_parse;
-#endif
-
- return t;
-}
-
-/* Pointer to a function that returns the offset within the user area
- where a particular register is stored. */
-static CORE_ADDR (*inf_ptrace_register_u_offset)(struct gdbarch *, int, int);
-
-/* Fetch register REGNUM from the inferior. */
-
-static void
-inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
-{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- CORE_ADDR addr;
- size_t size;
- PTRACE_TYPE_RET *buf;
- int pid, i;
-
- /* This isn't really an address, but ptrace thinks of it as one. */
- addr = inf_ptrace_register_u_offset (gdbarch, regnum, 0);
- if (addr == (CORE_ADDR)-1
- || gdbarch_cannot_fetch_register (gdbarch, regnum))
- {
- regcache_raw_supply (regcache, regnum, NULL);
- return;
- }
-
- /* Cater for systems like GNU/Linux, that implement threads as
- separate processes. */
- pid = ptid_get_lwp (inferior_ptid);
- if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
-
- size = register_size (gdbarch, regnum);
- gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
- buf = (PTRACE_TYPE_RET *) alloca (size);
-
- /* Read the register contents from the inferior a chunk at a time. */
- for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
- {
- errno = 0;
- buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, 0);
- if (errno != 0)
- error (_("Couldn't read register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regnum),
- regnum, safe_strerror (errno));
-
- addr += sizeof (PTRACE_TYPE_RET);
- }
- regcache_raw_supply (regcache, regnum, buf);
-}
-
-/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
- for all registers. */
-
-static void
-inf_ptrace_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
-{
- if (regnum == -1)
- for (regnum = 0;
- regnum < gdbarch_num_regs (get_regcache_arch (regcache));
- regnum++)
- inf_ptrace_fetch_register (regcache, regnum);
- else
- inf_ptrace_fetch_register (regcache, regnum);
-}
-
-/* Store register REGNUM into the inferior. */
-
-static void
-inf_ptrace_store_register (const struct regcache *regcache, int regnum)
-{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- CORE_ADDR addr;
- size_t size;
- PTRACE_TYPE_RET *buf;
- int pid, i;
-
- /* This isn't really an address, but ptrace thinks of it as one. */
- addr = inf_ptrace_register_u_offset (gdbarch, regnum, 1);
- if (addr == (CORE_ADDR)-1
- || gdbarch_cannot_store_register (gdbarch, regnum))
- return;
-
- /* Cater for systems like GNU/Linux, that implement threads as
- separate processes. */
- pid = ptid_get_lwp (inferior_ptid);
- if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
-
- size = register_size (gdbarch, regnum);
- gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
- buf = (PTRACE_TYPE_RET *) alloca (size);
-
- /* Write the register contents into the inferior a chunk at a time. */
- regcache_raw_collect (regcache, regnum, buf);
- for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
- {
- errno = 0;
- ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, buf[i]);
- if (errno != 0)
- error (_("Couldn't write register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regnum),
- regnum, safe_strerror (errno));
-
- addr += sizeof (PTRACE_TYPE_RET);
- }
-}
-
-/* Store register REGNUM back into the inferior. If REGNUM is -1, do
- this for all registers. */
-
-static void
-inf_ptrace_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
-{
- if (regnum == -1)
- for (regnum = 0;
- regnum < gdbarch_num_regs (get_regcache_arch (regcache));
- regnum++)
- inf_ptrace_store_register (regcache, regnum);
- else
- inf_ptrace_store_register (regcache, regnum);
-}
-
-/* Create a "traditional" ptrace target. REGISTER_U_OFFSET should be
- a function returning the offset within the user area where a
- particular register is stored. */
-
-struct target_ops *
-inf_ptrace_trad_target (CORE_ADDR (*register_u_offset)
- (struct gdbarch *, int, int))
-{
- struct target_ops *t = inf_ptrace_target();
-
- gdb_assert (register_u_offset);
- inf_ptrace_register_u_offset = register_u_offset;
- t->to_fetch_registers = inf_ptrace_fetch_registers;
- t->to_store_registers = inf_ptrace_store_registers;
-
- return t;
-}
diff --git a/gdb/inf-ptrace.h b/gdb/inf-ptrace.h
index f1fc11193ef..a9bfa04250c 100644
--- a/gdb/inf-ptrace.h
+++ b/gdb/inf-ptrace.h
@@ -20,26 +20,68 @@
#ifndef INF_PTRACE_H
#define INF_PTRACE_H
-/* Create a prototype ptrace target. The client can override it with
- local methods. */
+#include "inf-child.h"
-extern struct target_ops *inf_ptrace_target (void);
+/* An abstract prototype ptrace target. The client can override it
+ with local methods. */
-/* Create a "traditional" ptrace target. REGISTER_U_OFFSET should be
- a function returning the offset within the user area where a
- particular register is stored. */
+struct inf_ptrace_target : public inf_child_target
+{
+ ~inf_ptrace_target () OVERRIDE = 0;
-extern struct target_ops *
- inf_ptrace_trad_target (CORE_ADDR (*register_u_offset)
- (struct gdbarch *, int, int));
+ void attach (const char *, int) OVERRIDE;
+
+ void detach (const char *, int) OVERRIDE;
+
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+
+ void files_info () OVERRIDE;
+
+ void kill () OVERRIDE;
+
+ void create_inferior (char *, char *, char **, int) OVERRIDE;
+#ifdef PT_GET_PROCESS_STATE
+ int follow_fork (int, int) OVERRIDE;
+
+ int insert_fork_catchpoint (int) OVERRIDE;
+
+ int remove_fork_catchpoint (int) OVERRIDE;
+
+ void post_startup_inferior (ptid_t) OVERRIDE;
+
+ void post_attach (int) OVERRIDE;
+#endif
+
+ void mourn_inferior () OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ void interrupt (ptid_t) OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+#if defined (PT_IO) && defined (PIOD_READ_AUXV)
+ int auxv_parse (gdb_byte **readptr,
+ gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) OVERRIDE;
+#endif
+
+ protected:
+ /* Cleanup the inferior after a successful ptrace detach. */
+ void detach_success ();
+};
/* Return which PID to pass to ptrace in order to observe/control the
tracee identified by PTID. */
extern pid_t get_ptrace_pid (ptid_t);
-
-/* Cleanup the inferior after a successful ptrace detach. */
-extern void inf_ptrace_detach_success (struct target_ops *ops);
-
#endif
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 8199bdd38d3..4264d8cb1fe 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -269,7 +269,7 @@ find_function_addr (struct value *function, struct type **retval_type)
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
- &current_target);
+ target_stack);
}
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
@@ -305,7 +305,7 @@ find_function_addr (struct value *function, struct type **retval_type)
funaddr = value_as_address (value_addr (function));
nfunaddr = funaddr;
funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
- &current_target);
+ target_stack);
if (funaddr != nfunaddr)
found_descriptor = 1;
}
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 44a1fd10dae..083411fdeab 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -506,7 +506,7 @@ prepare_execution_command (struct target_ops *target, int background)
{
/* If we get a request for running in the bg but the target
doesn't support it, error out. */
- if (background && !target->to_can_async_p (target))
+ if (background && !target->can_async_p ())
error (_("Asynchronous execution not supported on this target."));
if (!background)
@@ -565,7 +565,7 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
prepare_execution_command (run_target, async_exec);
- if (non_stop && !run_target->to_supports_non_stop (run_target))
+ if (non_stop && !run_target->supports_non_stop ())
error (_("The target does not support running in non-stop mode."));
/* Done. Can now set breakpoints, change inferior args, etc. */
@@ -607,9 +607,9 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
/* We call get_inferior_args() because we might need to compute
the value now. */
- run_target->to_create_inferior (run_target, exec_file, get_inferior_args (),
- environ_vector (current_inferior ()->environment),
- from_tty);
+ run_target->create_inferior (exec_file, get_inferior_args (),
+ environ_vector (current_inferior ()->environment),
+ from_tty);
/* to_create_inferior should push the target, so after this point we
shouldn't refer to run_target again. */
run_target = NULL;
@@ -628,7 +628,7 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
/* Pass zero for FROM_TTY, because at this point the "run" command
has done its thing; now we are setting up the running program. */
- post_create_inferior (&current_target, 0);
+ post_create_inferior (target_stack, 0);
/* Start the target running. Do not use -1 continuation as it would skip
breakpoint right at the entry point. */
@@ -853,7 +853,7 @@ continue_command (char *args, int from_tty)
ensure_not_running ();
}
- prepare_execution_command (&current_target, async_exec);
+ prepare_execution_command (target_stack, async_exec);
if (from_tty)
printf_filtered (_("Continuing.\n"));
@@ -1001,7 +1001,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
count_string = strip_bg_char (count_string, &async_exec);
args_chain = make_cleanup (xfree, count_string);
- prepare_execution_command (&current_target, async_exec);
+ prepare_execution_command (target_stack, async_exec);
count = count_string ? parse_and_eval_long (count_string) : 1;
@@ -1196,7 +1196,7 @@ jump_command (char *arg, int from_tty)
arg = strip_bg_char (arg, &async_exec);
args_chain = make_cleanup (xfree, arg);
- prepare_execution_command (&current_target, async_exec);
+ prepare_execution_command (target_stack, async_exec);
if (!arg)
error_no_arg (_("starting address"));
@@ -1281,7 +1281,7 @@ signal_command (char *signum_exp, int from_tty)
signum_exp = strip_bg_char (signum_exp, &async_exec);
args_chain = make_cleanup (xfree, signum_exp);
- prepare_execution_command (&current_target, async_exec);
+ prepare_execution_command (target_stack, async_exec);
if (!signum_exp)
error_no_arg (_("signal number"));
@@ -1559,7 +1559,7 @@ until_command (char *arg, int from_tty)
arg = strip_bg_char (arg, &async_exec);
args_chain = make_cleanup (xfree, arg);
- prepare_execution_command (&current_target, async_exec);
+ prepare_execution_command (target_stack, async_exec);
if (arg)
until_break_command (arg, from_tty, 0);
@@ -1588,7 +1588,7 @@ advance_command (char *arg, int from_tty)
arg = strip_bg_char (arg, &async_exec);
args_chain = make_cleanup (xfree, arg);
- prepare_execution_command (&current_target, async_exec);
+ prepare_execution_command (target_stack, async_exec);
until_break_command (arg, from_tty, 1);
@@ -1988,7 +1988,7 @@ finish_command (char *arg, int from_tty)
arg = strip_bg_char (arg, &async_exec);
args_chain = make_cleanup (xfree, arg);
- prepare_execution_command (&current_target, async_exec);
+ prepare_execution_command (target_stack, async_exec);
if (arg)
error (_("The \"finish\" command does not take any arguments."));
@@ -2670,7 +2670,7 @@ setup_inferior (int from_tty)
/* Take any necessary post-attaching actions for this platform. */
target_post_attach (ptid_get_pid (inferior_ptid));
- post_create_inferior (&current_target, from_tty);
+ post_create_inferior (target_stack, from_tty);
}
/* What to do after the first program stops after attaching. */
@@ -2834,10 +2834,10 @@ attach_command (char *args, int from_tty)
prepare_execution_command (attach_target, async_exec);
- if (non_stop && !attach_target->to_supports_non_stop (attach_target))
+ if (non_stop && !attach_target->supports_non_stop ())
error (_("Cannot attach to this target in non-stop mode"));
- attach_target->to_attach (attach_target, args, from_tty);
+ attach_target->attach (args, from_tty);
/* to_attach should push the target, so after this point we
shouldn't refer to attach_target again. */
attach_target = NULL;
@@ -2888,7 +2888,7 @@ attach_command (char *args, int from_tty)
/* Some system don't generate traps when attaching to inferior.
E.g. Mach 3 or GNU hurd. */
- if (!target_attach_no_wait)
+ if (!target_attach_no_wait ())
{
struct attach_command_continuation_args *a;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 90841f4e55f..7ec5492de66 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3228,7 +3228,7 @@ start_remote (int from_tty)
/* Now that the inferior has stopped, do any bookkeeping like
loading shared libraries. We want to do this before normal_stop,
so that the displayed frame is up to date. */
- post_create_inferior (&current_target, from_tty);
+ post_create_inferior (target_stack, from_tty);
normal_stop ();
}
@@ -5708,7 +5708,7 @@ handle_signal_stop (struct execution_control_state *ecs)
fprintf_unfiltered (gdb_stdlog, "infrun: stopped by watchpoint\n");
- if (target_stopped_data_address (&current_target, &addr))
+ if (target_stopped_data_address (target_stack, &addr))
fprintf_unfiltered (gdb_stdlog,
"infrun: stopped data address = %s\n",
paddress (gdbarch, addr));
@@ -8819,7 +8819,7 @@ siginfo_value_read (struct value *v)
validate_registers_access ();
transferred =
- target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO,
+ target_read (target_stack, TARGET_OBJECT_SIGNAL_INFO,
NULL,
value_contents_all_raw (v),
value_offset (v),
@@ -8841,7 +8841,7 @@ siginfo_value_write (struct value *v, struct value *fromval)
vice versa. */
validate_registers_access ();
- transferred = target_write (&current_target,
+ transferred = target_write (target_stack,
TARGET_OBJECT_SIGNAL_INFO,
NULL,
value_contents_all_raw (fromval),
@@ -8920,7 +8920,7 @@ save_infcall_suspend_state (void)
siginfo_data = (gdb_byte *) xmalloc (len);
back_to = make_cleanup (xfree, siginfo_data);
- if (target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
+ if (target_read (target_stack, TARGET_OBJECT_SIGNAL_INFO, NULL,
siginfo_data, 0, len) == len)
discard_cleanups (back_to);
else
@@ -8970,7 +8970,7 @@ restore_infcall_suspend_state (struct infcall_suspend_state *inf_state)
struct type *type = gdbarch_get_siginfo_type (gdbarch);
/* Errors ignored. */
- target_write (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
+ target_write (target_stack, TARGET_OBJECT_SIGNAL_INFO, NULL,
inf_state->siginfo_data, 0, TYPE_LENGTH (type));
}
diff --git a/gdb/linespec.c b/gdb/linespec.c
index ccedec8841a..ced9f530744 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -3605,7 +3605,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
/* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */
- pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, &current_target);
+ pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, target_stack);
if (pc != sal.pc)
sal = find_pc_sect_line (pc, NULL, 0);
@@ -3622,7 +3622,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
stay correct from the last find_pc_sect_line above. */
sal.pc = MSYMBOL_VALUE_ADDRESS (objfile, msymbol);
sal.pc = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc,
- &current_target);
+ target_stack);
if (gdbarch_skip_entrypoint_p (gdbarch))
sal.pc = gdbarch_skip_entrypoint (gdbarch, sal.pc);
}
@@ -3714,7 +3714,7 @@ add_minsym (struct minimal_symbol *minsym, void *d)
NULL, 0);
sal.section = MSYMBOL_OBJ_SECTION (info->objfile, minsym);
pc
- = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, &current_target);
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, sal.pc, target_stack);
if (pc != sal.pc)
sal = find_pc_sect_line (pc, NULL, 0);
@@ -3738,7 +3738,7 @@ add_minsym (struct minimal_symbol *minsym, void *d)
struct gdbarch *gdbarch = get_objfile_arch (info->objfile);
CORE_ADDR addr = gdbarch_convert_from_func_ptr_addr
(gdbarch, BMSYMBOL_VALUE_ADDRESS (mo),
- &current_target);
+ target_stack);
if (addr == BMSYMBOL_VALUE_ADDRESS (mo))
return;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 5d5efa0af45..d907f7a9ac1 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -186,14 +186,11 @@ leader. */
#define O_LARGEFILE 0
#endif
+struct linux_nat_target *linux_target;
+
/* Does the current host support PTRACE_GETREGSET? */
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
-/* The single-threaded native GNU/Linux target_ops. We save a pointer for
- the use of the multi-threaded target. */
-static struct target_ops *linux_ops;
-static struct target_ops linux_ops_saved;
-
/* The method to call, if any, when a new thread is attached. */
static void (*linux_nat_new_thread) (struct lwp_info *);
@@ -214,10 +211,6 @@ static int (*linux_nat_siginfo_fixup) (siginfo_t *,
gdb_byte *,
int);
-/* The saved to_xfer_partial method, inherited from inf-ptrace.c.
- Called by our to_xfer_partial. */
-static target_xfer_partial_ftype *super_xfer_partial;
-
/* The saved to_close method, inherited from inf-ptrace.c.
Called by our to_close. */
static void (*super_close) (struct target_ops *);
@@ -420,14 +413,17 @@ linux_init_ptrace (pid_t pid, int attached)
linux_ptrace_init_warnings ();
}
-static void
-linux_child_post_attach (struct target_ops *self, int pid)
+linux_nat_target::~linux_nat_target ()
+{}
+
+void
+linux_nat_target::post_attach (int pid)
{
linux_init_ptrace (pid, 1);
}
-static void
-linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid)
+void
+linux_nat_target::post_startup_inferior (ptid_t ptid)
{
linux_init_ptrace (ptid_get_pid (ptid), 0);
}
@@ -461,9 +457,8 @@ delete_lwp_cleanup (void *lp_voidp)
ptid of the followed inferior. At return, inferior_ptid will be
unchanged. */
-static int
-linux_child_follow_fork (struct target_ops *ops, int follow_child,
- int detach_fork)
+int
+linux_nat_target::follow_fork (int follow_child, int detach_fork)
{
if (!follow_child)
{
@@ -625,46 +620,45 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child,
}
-static int
-linux_child_insert_fork_catchpoint (struct target_ops *self, int pid)
+int
+linux_nat_target::insert_fork_catchpoint (int pid)
{
return !linux_supports_tracefork ();
}
-static int
-linux_child_remove_fork_catchpoint (struct target_ops *self, int pid)
+int
+linux_nat_target::remove_fork_catchpoint (int pid)
{
return 0;
}
-static int
-linux_child_insert_vfork_catchpoint (struct target_ops *self, int pid)
+int
+linux_nat_target::insert_vfork_catchpoint (int pid)
{
return !linux_supports_tracefork ();
}
-static int
-linux_child_remove_vfork_catchpoint (struct target_ops *self, int pid)
+int
+linux_nat_target::remove_vfork_catchpoint (int pid)
{
return 0;
}
-static int
-linux_child_insert_exec_catchpoint (struct target_ops *self, int pid)
+int
+linux_nat_target::insert_exec_catchpoint (int pid)
{
return !linux_supports_tracefork ();
}
-static int
-linux_child_remove_exec_catchpoint (struct target_ops *self, int pid)
+int
+linux_nat_target::remove_exec_catchpoint (int pid)
{
return 0;
}
-static int
-linux_child_set_syscall_catchpoint (struct target_ops *self,
- int pid, int needed, int any_count,
- int table_size, int *table)
+int
+linux_nat_target::set_syscall_catchpoint (int pid, int needed, int any_count,
+ int table_size, int *table)
{
if (!linux_supports_tracesysgood ())
return 1;
@@ -798,9 +792,8 @@ restore_child_signals_mask (sigset_t *prev_mask)
static sigset_t pass_mask;
/* Update signals to pass to the inferior. */
-static void
-linux_nat_pass_signals (struct target_ops *self,
- int numsigs, unsigned char *pass_signals)
+void
+linux_nat_target::pass_signals (int numsigs, unsigned char *pass_signals)
{
int signo;
@@ -818,7 +811,6 @@ linux_nat_pass_signals (struct target_ops *self,
/* Prototypes for local functions. */
static int stop_wait_callback (struct lwp_info *lp, void *data);
-static char *linux_child_pid_to_exec_file (struct target_ops *self, int pid);
static int resume_stopped_resumed_lwps (struct lwp_info *lp, void *data);
static int check_ptrace_stopped_lwp_gone (struct lwp_info *lp);
@@ -1095,10 +1087,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int first, int *signalled)
return status;
}
-static void
-linux_nat_create_inferior (struct target_ops *ops,
- char *exec_file, char *allargs, char **env,
- int from_tty)
+void
+linux_nat_target::create_inferior (char *exec_file, char *allargs, char **env,
+ int from_tty)
{
struct cleanup *restore_personality
= maybe_disable_address_space_randomization (disable_randomization);
@@ -1107,9 +1098,9 @@ linux_nat_create_inferior (struct target_ops *ops,
we have to mask the async mode. */
/* Make sure we report all signals during startup. */
- linux_nat_pass_signals (ops, 0, NULL);
+ pass_signals (0, NULL);
- linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
do_cleanups (restore_personality);
}
@@ -1190,19 +1181,19 @@ attach_proc_task_lwp_callback (ptid_t ptid)
return 0;
}
-static void
-linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
+void
+linux_nat_target::attach (const char *args, int from_tty)
{
struct lwp_info *lp;
int status;
ptid_t ptid;
/* Make sure we report all signals during attach. */
- linux_nat_pass_signals (ops, 0, NULL);
+ pass_signals (0, NULL);
TRY
{
- linux_ops->to_attach (ops, args, from_tty);
+ inf_ptrace_target::attach (args, from_tty);
}
CATCH (ex, RETURN_MASK_ERROR)
{
@@ -1490,8 +1481,8 @@ detach_callback (struct lwp_info *lp, void *data)
return 0;
}
-static void
-linux_nat_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+linux_nat_target::detach (const char *args, int from_tty)
{
int pid;
struct lwp_info *main_lwp;
@@ -1539,7 +1530,7 @@ linux_nat_detach (struct target_ops *ops, const char *args, int from_tty)
detach_one_lwp (main_lwp, &signo);
- inf_ptrace_detach_success (ops);
+ detach_success ();
}
delete_lwp (main_lwp->ptid);
}
@@ -1567,7 +1558,7 @@ linux_resume_one_lwp_throw (struct lwp_info *lp, int step,
if (linux_nat_prepare_to_resume != NULL)
linux_nat_prepare_to_resume (lp);
- linux_ops->to_resume (linux_ops, lp->ptid, step, signo);
+ linux_target->low_resume (lp->ptid, step, signo);
/* Successfully resumed. Clear state that no longer makes sense,
and mark the LWP as running. Must not do this before resuming
@@ -1720,9 +1711,8 @@ resume_set_callback (struct lwp_info *lp, void *data)
return 0;
}
-static void
-linux_nat_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal signo)
+void
+linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
{
struct lwp_info *lp;
int resume_many;
@@ -2121,7 +2111,7 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
ourstatus->kind = TARGET_WAITKIND_EXECD;
ourstatus->value.execd_pathname
- = xstrdup (linux_child_pid_to_exec_file (NULL, pid));
+ = xstrdup (linux_proc_pid_to_exec_file (pid));
/* The thread that execed must have been resumed, but, when a
thread execs, it changes its tid to the tgid, and the old
@@ -2453,22 +2443,14 @@ check_stopped_by_watchpoint (struct lwp_info *lp)
{
struct cleanup *old_chain;
- if (linux_ops->to_stopped_by_watchpoint == NULL)
- return 0;
-
old_chain = save_inferior_ptid ();
inferior_ptid = lp->ptid;
- if (linux_ops->to_stopped_by_watchpoint (linux_ops))
+ if (linux_target->low_stopped_by_watchpoint ())
{
lp->stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
-
- if (linux_ops->to_stopped_data_address != NULL)
- lp->stopped_data_address_p =
- linux_ops->to_stopped_data_address (&current_target,
- &lp->stopped_data_address);
- else
- lp->stopped_data_address_p = 0;
+ lp->stopped_data_address_p
+ = linux_target->low_stopped_data_address (&lp->stopped_data_address);
}
do_cleanups (old_chain);
@@ -2478,8 +2460,8 @@ check_stopped_by_watchpoint (struct lwp_info *lp)
/* Returns true if the LWP had stopped for a watchpoint. */
-static int
-linux_nat_stopped_by_watchpoint (struct target_ops *ops)
+int
+linux_nat_target::stopped_by_watchpoint ()
{
struct lwp_info *lp = find_lwp_pid (inferior_ptid);
@@ -2488,8 +2470,8 @@ linux_nat_stopped_by_watchpoint (struct target_ops *ops)
return lp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
}
-static int
-linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
+int
+linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
{
struct lwp_info *lp = find_lwp_pid (inferior_ptid);
@@ -2839,8 +2821,8 @@ save_stop_reason (struct lwp_info *lp)
/* Returns true if the LWP had stopped for a software breakpoint. */
-static int
-linux_nat_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+linux_nat_target::stopped_by_sw_breakpoint ()
{
struct lwp_info *lp = find_lwp_pid (inferior_ptid);
@@ -2851,8 +2833,8 @@ linux_nat_stopped_by_sw_breakpoint (struct target_ops *ops)
/* Implement the supports_stopped_by_sw_breakpoint method. */
-static int
-linux_nat_supports_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+linux_nat_target::supports_stopped_by_sw_breakpoint ()
{
return USE_SIGTRAP_SIGINFO;
}
@@ -2860,8 +2842,8 @@ linux_nat_supports_stopped_by_sw_breakpoint (struct target_ops *ops)
/* Returns true if the LWP had stopped for a hardware
breakpoint/watchpoint. */
-static int
-linux_nat_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+linux_nat_target::stopped_by_hw_breakpoint ()
{
struct lwp_info *lp = find_lwp_pid (inferior_ptid);
@@ -2872,8 +2854,8 @@ linux_nat_stopped_by_hw_breakpoint (struct target_ops *ops)
/* Implement the supports_stopped_by_hw_breakpoint method. */
-static int
-linux_nat_supports_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+linux_nat_target::supports_stopped_by_hw_breakpoint ()
{
return USE_SIGTRAP_SIGINFO;
}
@@ -3284,8 +3266,7 @@ filter_exit_event (struct lwp_info *event_child,
}
static ptid_t
-linux_nat_wait_1 (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *ourstatus,
+linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
int target_options)
{
sigset_t prev_mask;
@@ -3589,10 +3570,9 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, void *data)
return 0;
}
-static ptid_t
-linux_nat_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *ourstatus,
- int target_options)
+ptid_t
+linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
+ int target_options)
{
ptid_t event_ptid;
@@ -3622,7 +3602,7 @@ linux_nat_wait (struct target_ops *ops,
if (target_is_non_stop_p ())
iterate_over_lwps (minus_one_ptid, resume_stopped_resumed_lwps, &ptid);
- event_ptid = linux_nat_wait_1 (ops, ptid, ourstatus, target_options);
+ event_ptid = linux_nat_wait_1 (ptid, ourstatus, target_options);
/* If we requested any event, and something came out, assume there
may be more. If we requested a specific lwp or process, also
@@ -3748,8 +3728,8 @@ kill_unfollowed_fork_children (struct inferior *inf)
}
}
-static void
-linux_nat_kill (struct target_ops *ops)
+void
+linux_nat_target::kill ()
{
/* If we're stopped while forking and we haven't followed yet,
kill the other task. We need to do this first because the
@@ -3779,8 +3759,8 @@ linux_nat_kill (struct target_ops *ops)
target_mourn_inferior ();
}
-static void
-linux_nat_mourn_inferior (struct target_ops *ops)
+void
+linux_nat_target::mourn_inferior ()
{
int pid = ptid_get_pid (inferior_ptid);
@@ -3788,7 +3768,7 @@ linux_nat_mourn_inferior (struct target_ops *ops)
if (! forks_exist_p ())
/* Normal case, no other forks available. */
- linux_ops->to_mourn_inferior (ops);
+ inf_ptrace_target::mourn_inferior ();
else
/* Multi-fork case. The current inferior_ptid has exited, but
there are other viable forks to debug. Delete the exiting
@@ -3822,7 +3802,7 @@ siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
}
static enum target_xfer_status
-linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
+linux_xfer_siginfo (enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
@@ -3876,17 +3856,44 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
return TARGET_XFER_OK;
}
+class restore_inferior_ptid
+{
+public:
+ restore_inferior_ptid() { m_saved_ptid = inferior_ptid; }
+ ~restore_inferior_ptid() { inferior_ptid = m_saved_ptid; }
+
+private:
+ ptid_t m_saved_ptid;
+};
+
static enum target_xfer_status
-linux_nat_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+linux_nat_xfer_osdata (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len);
+
+static enum target_xfer_status
+linux_proc_xfer_spu (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
+
+static enum target_xfer_status
+linux_proc_xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len, ULONGEST *xfered_len);
+
+enum target_xfer_status
+linux_nat_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
- struct cleanup *old_chain;
enum target_xfer_status xfer;
if (object == TARGET_OBJECT_SIGNAL_INFO)
- return linux_xfer_siginfo (ops, object, annex, readbuf, writebuf,
+ return linux_xfer_siginfo (object, annex, readbuf, writebuf,
offset, len, xfered_len);
/* The target is connected but no live inferior is selected. Pass
@@ -3895,20 +3902,51 @@ linux_nat_xfer_partial (struct target_ops *ops, enum target_object object,
if (object == TARGET_OBJECT_MEMORY && ptid_equal (inferior_ptid, null_ptid))
return TARGET_XFER_EOF;
- old_chain = save_inferior_ptid ();
+ restore_inferior_ptid guard;
if (ptid_lwp_p (inferior_ptid))
inferior_ptid = pid_to_ptid (ptid_get_lwp (inferior_ptid));
- xfer = linux_ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ if (object == TARGET_OBJECT_AUXV)
+ return memory_xfer_auxv (this, object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
+
+ if (object == TARGET_OBJECT_OSDATA)
+ return linux_nat_xfer_osdata (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
+
+ if (object == TARGET_OBJECT_SPU)
+ return linux_proc_xfer_spu (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
+
+ /* GDB calculates all addresses in the largest possible address
+ width.
+ The address width must be masked before its final use - either by
+ linux_proc_xfer_partial or inf_ptrace_target::xfer_partial.
+
+ Compare ADDR_BIT first to avoid a compiler warning on shift overflow. */
+
+ if (object == TARGET_OBJECT_MEMORY)
+ {
+ int addr_bit = gdbarch_addr_bit (target_gdbarch ());
+
+ if (addr_bit < (sizeof (ULONGEST) * HOST_CHAR_BIT))
+ offset &= ((ULONGEST) 1 << addr_bit) - 1;
+ }
+
+ xfer = linux_proc_xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
+ if (xfer != TARGET_XFER_EOF)
+ return xfer;
+
+ xfer = inf_ptrace_target::xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
- do_cleanups (old_chain);
return xfer;
}
-static int
-linux_nat_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+linux_nat_target::thread_alive (ptid_t ptid)
{
/* As long as a PTID is in lwp list, consider it alive. */
return find_lwp_pid (ptid) != NULL;
@@ -3917,8 +3955,8 @@ linux_nat_thread_alive (struct target_ops *ops, ptid_t ptid)
/* Implement the to_update_thread_list target method for this
target. */
-static void
-linux_nat_update_thread_list (struct target_ops *ops)
+void
+linux_nat_target::update_thread_list ()
{
struct lwp_info *lwp;
@@ -3939,8 +3977,8 @@ linux_nat_update_thread_list (struct target_ops *ops)
}
}
-static char *
-linux_nat_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+linux_nat_target::pid_to_str (ptid_t ptid)
{
static char buf[64];
@@ -3955,8 +3993,8 @@ linux_nat_pid_to_str (struct target_ops *ops, ptid_t ptid)
return normal_pid_to_str (ptid);
}
-static const char *
-linux_nat_thread_name (struct target_ops *self, struct thread_info *thr)
+const char *
+linux_nat_target::thread_name (struct thread_info *thr)
{
return linux_proc_tid_get_name (thr->ptid);
}
@@ -3964,8 +4002,8 @@ linux_nat_thread_name (struct target_ops *self, struct thread_info *thr)
/* Accepts an integer PID; Returns a string representing a file that
can be opened to get the symbols for the child process. */
-static char *
-linux_child_pid_to_exec_file (struct target_ops *self, int pid)
+char *
+linux_nat_target::pid_to_exec_file (int pid)
{
return linux_proc_pid_to_exec_file (pid);
}
@@ -3976,7 +4014,7 @@ linux_child_pid_to_exec_file (struct target_ops *self, int pid)
but it doesn't support writes. */
static enum target_xfer_status
-linux_proc_xfer_partial (struct target_ops *ops, enum target_object object,
+linux_proc_xfer_partial (enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, LONGEST len, ULONGEST *xfered_len)
@@ -4079,7 +4117,7 @@ spu_enumerate_spu_ids (int pid, gdb_byte *buf, ULONGEST offset, ULONGEST len)
object type, using the /proc file system. */
static enum target_xfer_status
-linux_proc_xfer_spu (struct target_ops *ops, enum target_object object,
+linux_proc_xfer_spu (enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
@@ -4224,7 +4262,7 @@ linux_proc_pending_signals (int pid, sigset_t *pending,
}
static enum target_xfer_status
-linux_nat_xfer_osdata (struct target_ops *ops, enum target_object object,
+linux_nat_xfer_osdata (enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
@@ -4238,49 +4276,6 @@ linux_nat_xfer_osdata (struct target_ops *ops, enum target_object object,
return TARGET_XFER_OK;
}
-static enum target_xfer_status
-linux_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
-{
- enum target_xfer_status xfer;
-
- if (object == TARGET_OBJECT_AUXV)
- return memory_xfer_auxv (ops, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
-
- if (object == TARGET_OBJECT_OSDATA)
- return linux_nat_xfer_osdata (ops, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
-
- if (object == TARGET_OBJECT_SPU)
- return linux_proc_xfer_spu (ops, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
-
- /* GDB calculates all the addresses in possibly larget width of the address.
- Address width needs to be masked before its final use - either by
- linux_proc_xfer_partial or inf_ptrace_xfer_partial.
-
- Compare ADDR_BIT first to avoid a compiler warning on shift overflow. */
-
- if (object == TARGET_OBJECT_MEMORY)
- {
- int addr_bit = gdbarch_addr_bit (target_gdbarch ());
-
- if (addr_bit < (sizeof (ULONGEST) * HOST_CHAR_BIT))
- offset &= ((ULONGEST) 1 << addr_bit) - 1;
- }
-
- xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
- if (xfer != TARGET_XFER_EOF)
- return xfer;
-
- return super_xfer_partial (ops, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
-}
-
static void
cleanup_target_stop (void *arg)
{
@@ -4292,9 +4287,8 @@ cleanup_target_stop (void *arg)
target_resume (*ptid, 0, GDB_SIGNAL_0);
}
-static VEC(static_tracepoint_marker_p) *
-linux_child_static_tracepoint_markers_by_strid (struct target_ops *self,
- const char *strid)
+VEC(static_tracepoint_marker_p) *
+linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
{
char s[IPA_CMD_BUF_SIZE];
struct cleanup *old_chain;
@@ -4349,65 +4343,18 @@ linux_child_static_tracepoint_markers_by_strid (struct target_ops *self,
return markers;
}
-/* Create a prototype generic GNU/Linux target. The client can override
- it with local methods. */
-
-static void
-linux_target_install_ops (struct target_ops *t)
-{
- t->to_insert_fork_catchpoint = linux_child_insert_fork_catchpoint;
- t->to_remove_fork_catchpoint = linux_child_remove_fork_catchpoint;
- t->to_insert_vfork_catchpoint = linux_child_insert_vfork_catchpoint;
- t->to_remove_vfork_catchpoint = linux_child_remove_vfork_catchpoint;
- t->to_insert_exec_catchpoint = linux_child_insert_exec_catchpoint;
- t->to_remove_exec_catchpoint = linux_child_remove_exec_catchpoint;
- t->to_set_syscall_catchpoint = linux_child_set_syscall_catchpoint;
- t->to_pid_to_exec_file = linux_child_pid_to_exec_file;
- t->to_post_startup_inferior = linux_child_post_startup_inferior;
- t->to_post_attach = linux_child_post_attach;
- t->to_follow_fork = linux_child_follow_fork;
-
- super_xfer_partial = t->to_xfer_partial;
- t->to_xfer_partial = linux_xfer_partial;
-
- t->to_static_tracepoint_markers_by_strid
- = linux_child_static_tracepoint_markers_by_strid;
-}
-
-struct target_ops *
-linux_target (void)
-{
- struct target_ops *t;
-
- t = inf_ptrace_target ();
- linux_target_install_ops (t);
-
- return t;
-}
-
-struct target_ops *
-linux_trad_target (CORE_ADDR (*register_u_offset)(struct gdbarch *, int, int))
-{
- struct target_ops *t;
-
- t = inf_ptrace_trad_target (register_u_offset);
- linux_target_install_ops (t);
-
- return t;
-}
-
/* target_is_async_p implementation. */
-static int
-linux_nat_is_async_p (struct target_ops *ops)
+int
+linux_nat_target::is_async_p ()
{
return linux_is_async_p ();
}
/* target_can_async_p implementation. */
-static int
-linux_nat_can_async_p (struct target_ops *ops)
+int
+linux_nat_target::can_async_p ()
{
/* NOTE: palves 2008-03-21: We're only async when the user requests
it explicitly with the "set target-async" command.
@@ -4415,16 +4362,16 @@ linux_nat_can_async_p (struct target_ops *ops)
return target_async_permitted;
}
-static int
-linux_nat_supports_non_stop (struct target_ops *self)
+int
+linux_nat_target::supports_non_stop ()
{
return 1;
}
/* to_always_non_stop_p implementation. */
-static int
-linux_nat_always_non_stop_p (struct target_ops *self)
+int
+linux_nat_target::always_non_stop_p ()
{
return 1;
}
@@ -4434,14 +4381,14 @@ linux_nat_always_non_stop_p (struct target_ops *self)
int linux_multi_process = 1;
-static int
-linux_nat_supports_multi_process (struct target_ops *self)
+int
+linux_nat_target::supports_multi_process ()
{
return linux_multi_process;
}
-static int
-linux_nat_supports_disable_randomization (struct target_ops *self)
+int
+linux_nat_target::supports_disable_randomization ()
{
#ifdef HAVE_PERSONALITY
return 1;
@@ -4456,10 +4403,10 @@ static int async_terminal_is_ours = 1;
This is a wrapper around child_terminal_inferior to add async support. */
-static void
-linux_nat_terminal_inferior (struct target_ops *self)
+void
+linux_nat_target::terminal_inferior ()
{
- child_terminal_inferior (self);
+ inf_ptrace_target::terminal_inferior ();
/* Calls to target_terminal_*() are meant to be idempotent. */
if (!async_terminal_is_ours)
@@ -4478,13 +4425,13 @@ linux_nat_terminal_inferior (struct target_ops *self)
We leave target_terminal_ours_for_output alone, leaving it to
child_terminal_ours_for_output. */
-static void
-linux_nat_terminal_ours (struct target_ops *self)
+void
+linux_nat_target::terminal_ours ()
{
/* GDB should never give the terminal to the inferior if the
inferior is running in the background (run&, continue&, etc.),
but claiming it sure should. */
- child_terminal_ours (self);
+ inf_ptrace_target::terminal_ours ();
if (async_terminal_is_ours)
return;
@@ -4563,8 +4510,8 @@ linux_async_pipe (int enable)
/* target_async implementation. */
-static void
-linux_nat_async (struct target_ops *ops, int enable)
+void
+linux_nat_target::async (int enable)
{
if (enable)
{
@@ -4632,23 +4579,20 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
return 0;
}
-static void
-linux_nat_stop (struct target_ops *self, ptid_t ptid)
+void
+linux_nat_target::stop (ptid_t ptid)
{
iterate_over_lwps (ptid, linux_nat_stop_lwp, NULL);
}
-static void
-linux_nat_close (struct target_ops *self)
+void
+linux_nat_target::close ()
{
/* Unregister from the event loop. */
- if (linux_nat_is_async_p (self))
- linux_nat_async (self, 0);
-
- if (linux_ops->to_close)
- linux_ops->to_close (linux_ops);
+ if (is_async_p ())
+ async (0);
- super_close (self);
+ inf_ptrace_target::close ();
}
/* When requests are passed down from the linux-nat layer to the
@@ -4658,8 +4602,8 @@ linux_nat_close (struct target_ops *self)
lwpid is a "main" process id or not (it assumes so). We reverse
look up the "main" process id from the lwp here. */
-static struct address_space *
-linux_nat_thread_address_space (struct target_ops *t, ptid_t ptid)
+struct address_space *
+linux_nat_target::thread_address_space (ptid_t ptid)
{
struct lwp_info *lwp;
struct inferior *inf;
@@ -4685,8 +4629,8 @@ linux_nat_thread_address_space (struct target_ops *t, ptid_t ptid)
/* Return the cached value of the processor core for thread PTID. */
-static int
-linux_nat_core_of_thread (struct target_ops *ops, ptid_t ptid)
+int
+linux_nat_target::core_of_thread (ptid_t ptid)
{
struct lwp_info *info = find_lwp_pid (ptid);
@@ -4697,8 +4641,8 @@ linux_nat_core_of_thread (struct target_ops *ops, ptid_t ptid)
/* Implementation of to_filesystem_is_local. */
-static int
-linux_nat_filesystem_is_local (struct target_ops *ops)
+int
+linux_nat_target::filesystem_is_local ()
{
struct inferior *inf = current_inferior ();
@@ -4727,11 +4671,10 @@ linux_nat_fileio_pid_of (struct inferior *inf)
/* Implementation of to_fileio_open. */
-static int
-linux_nat_fileio_open (struct target_ops *self,
- struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
- int *target_errno)
+int
+linux_nat_target::fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno)
{
int nat_flags;
mode_t nat_mode;
@@ -4754,10 +4697,9 @@ linux_nat_fileio_open (struct target_ops *self,
/* Implementation of to_fileio_readlink. */
-static char *
-linux_nat_fileio_readlink (struct target_ops *self,
- struct inferior *inf, const char *filename,
- int *target_errno)
+char *
+linux_nat_target::fileio_readlink (struct inferior *inf, const char *filename,
+ int *target_errno)
{
char buf[PATH_MAX];
int len;
@@ -4779,10 +4721,9 @@ linux_nat_fileio_readlink (struct target_ops *self,
/* Implementation of to_fileio_unlink. */
-static int
-linux_nat_fileio_unlink (struct target_ops *self,
- struct inferior *inf, const char *filename,
- int *target_errno)
+int
+linux_nat_target::fileio_unlink (struct inferior *inf, const char *filename,
+ int *target_errno)
{
int ret;
@@ -4796,78 +4737,19 @@ linux_nat_fileio_unlink (struct target_ops *self,
/* Implementation of the to_thread_events method. */
-static void
-linux_nat_thread_events (struct target_ops *ops, int enable)
+void
+linux_nat_target::thread_events (int enable)
{
report_thread_events = enable;
}
-void
-linux_nat_add_target (struct target_ops *t)
-{
- /* Save the provided single-threaded target. We save this in a separate
- variable because another target we've inherited from (e.g. inf-ptrace)
- may have saved a pointer to T; we want to use it for the final
- process stratum target. */
- linux_ops_saved = *t;
- linux_ops = &linux_ops_saved;
-
- /* Override some methods for multithreading. */
- t->to_create_inferior = linux_nat_create_inferior;
- t->to_attach = linux_nat_attach;
- t->to_detach = linux_nat_detach;
- t->to_resume = linux_nat_resume;
- t->to_wait = linux_nat_wait;
- t->to_pass_signals = linux_nat_pass_signals;
- t->to_xfer_partial = linux_nat_xfer_partial;
- t->to_kill = linux_nat_kill;
- t->to_mourn_inferior = linux_nat_mourn_inferior;
- t->to_thread_alive = linux_nat_thread_alive;
- t->to_update_thread_list = linux_nat_update_thread_list;
- t->to_pid_to_str = linux_nat_pid_to_str;
- t->to_thread_name = linux_nat_thread_name;
- t->to_has_thread_control = tc_schedlock;
- t->to_thread_address_space = linux_nat_thread_address_space;
- t->to_stopped_by_watchpoint = linux_nat_stopped_by_watchpoint;
- t->to_stopped_data_address = linux_nat_stopped_data_address;
- t->to_stopped_by_sw_breakpoint = linux_nat_stopped_by_sw_breakpoint;
- t->to_supports_stopped_by_sw_breakpoint = linux_nat_supports_stopped_by_sw_breakpoint;
- t->to_stopped_by_hw_breakpoint = linux_nat_stopped_by_hw_breakpoint;
- t->to_supports_stopped_by_hw_breakpoint = linux_nat_supports_stopped_by_hw_breakpoint;
- t->to_thread_events = linux_nat_thread_events;
-
- t->to_can_async_p = linux_nat_can_async_p;
- t->to_is_async_p = linux_nat_is_async_p;
- t->to_supports_non_stop = linux_nat_supports_non_stop;
- t->to_always_non_stop_p = linux_nat_always_non_stop_p;
- t->to_async = linux_nat_async;
- t->to_terminal_inferior = linux_nat_terminal_inferior;
- t->to_terminal_ours = linux_nat_terminal_ours;
-
- super_close = t->to_close;
- t->to_close = linux_nat_close;
-
- t->to_stop = linux_nat_stop;
-
- t->to_supports_multi_process = linux_nat_supports_multi_process;
-
- t->to_supports_disable_randomization
- = linux_nat_supports_disable_randomization;
-
- t->to_core_of_thread = linux_nat_core_of_thread;
-
- t->to_filesystem_is_local = linux_nat_filesystem_is_local;
- t->to_fileio_open = linux_nat_fileio_open;
- t->to_fileio_readlink = linux_nat_fileio_readlink;
- t->to_fileio_unlink = linux_nat_fileio_unlink;
-
+linux_nat_target::linux_nat_target ()
+{
/* We don't change the stratum; this target will sit at
process_stratum and thread_db will set at thread_stratum. This
is a little strange, since this is a multi-threaded-capable
target, but we want to be on the stack below thread_db, and we
also want to be used for single-threaded processes. */
-
- add_target (t);
}
/* Register a method to call whenever a new thread is attached. */
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index f6102f78e9d..0f3e1586d08 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -18,9 +18,138 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "nat/linux-nat.h"
+#include "inf-ptrace.h"
#include "target.h"
#include <signal.h>
+/* A prototype generic GNU/Linux target. A concrete instance should
+ override it with local methods. */
+
+class linux_nat_target : public inf_ptrace_target
+{
+public:
+ linux_nat_target ();
+ ~linux_nat_target () OVERRIDE = 0;
+
+ thread_control_capabilities get_thread_control_capabilities () OVERRIDE
+ { return tc_schedlock; }
+
+ void create_inferior (char *, char *, char **, int) OVERRIDE;
+
+ void attach (const char *, int) OVERRIDE;
+
+ void detach (const char *, int) OVERRIDE;
+
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+
+ void pass_signals (int, unsigned char *) OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ void kill () OVERRIDE;
+
+ void mourn_inferior () OVERRIDE;
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ void update_thread_list () OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ const char *thread_name (struct thread_info *) OVERRIDE;
+
+ struct address_space *thread_address_space (ptid_t) OVERRIDE;
+
+ int stopped_by_watchpoint () OVERRIDE;
+
+ int stopped_data_address (CORE_ADDR *) OVERRIDE;
+
+ int stopped_by_sw_breakpoint () OVERRIDE;
+ int supports_stopped_by_sw_breakpoint () OVERRIDE;
+
+ int stopped_by_hw_breakpoint () OVERRIDE;
+ int supports_stopped_by_hw_breakpoint () OVERRIDE;
+
+ void thread_events (int) OVERRIDE;
+
+ int can_async_p () OVERRIDE;
+ int is_async_p () OVERRIDE;
+
+ int supports_non_stop () OVERRIDE;
+ int always_non_stop_p () OVERRIDE;
+
+ void async (int) OVERRIDE;
+
+ void terminal_inferior () OVERRIDE;
+
+ void terminal_ours () OVERRIDE;
+
+ void close () OVERRIDE;
+
+ void stop (ptid_t) OVERRIDE;
+
+ int supports_multi_process () OVERRIDE;
+
+ int supports_disable_randomization () OVERRIDE;
+
+ int core_of_thread (ptid_t ptid) OVERRIDE;
+
+ int filesystem_is_local () OVERRIDE;
+
+ int fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno) OVERRIDE;
+
+ char *fileio_readlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno) OVERRIDE;
+
+ int fileio_unlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno) OVERRIDE;
+
+ int insert_fork_catchpoint (int) OVERRIDE;
+ int remove_fork_catchpoint (int) OVERRIDE;
+ int insert_vfork_catchpoint (int) OVERRIDE;
+ int remove_vfork_catchpoint (int) OVERRIDE;
+
+ int insert_exec_catchpoint (int) OVERRIDE;
+ int remove_exec_catchpoint (int) OVERRIDE;
+
+ int set_syscall_catchpoint (int, int, int, int, int *) OVERRIDE;
+
+ char *pid_to_exec_file (int pid) OVERRIDE;
+
+ void post_startup_inferior (ptid_t) OVERRIDE;
+
+ void post_attach (int) OVERRIDE;
+
+ int follow_fork (int, int) OVERRIDE;
+
+ VEC(static_tracepoint_marker_p) *static_tracepoint_markers_by_strid (const char *id);
+
+ /* Methods that are meant to overridden by the concrete
+ arch-specific target instance. */
+
+ virtual void low_resume (ptid_t ptid, int step, enum gdb_signal sig)
+ { inf_ptrace_target::resume (ptid, step, sig); }
+
+ virtual int low_stopped_by_watchpoint ()
+ { return 0; }
+
+ virtual int low_stopped_data_address (CORE_ADDR *addr_p)
+ { return 0; }
+};
+
+/* The final/concrete instance. */
+extern linux_nat_target *linux_target;
+
struct arch_lwp_info;
/* Structure describing an LWP. This is public only for the purposes
@@ -149,18 +278,8 @@ extern void linux_stop_and_wait_all_lwps (void);
left stopped.) */
extern void linux_unstop_all_lwps (void);
-/* Create a prototype generic GNU/Linux target. The client can
- override it with local methods. */
-struct target_ops * linux_target (void);
-
-/* Create a generic GNU/Linux target using traditional
- ptrace register access. */
-struct target_ops *
-linux_trad_target (CORE_ADDR (*register_u_offset)(struct gdbarch *, int, int));
-
-/* Register the customized GNU/Linux target. This should be used
- instead of calling add_target directly. */
-void linux_nat_add_target (struct target_ops *);
+/* XXXXX all these hooks below should be made virtual protected low_
+ methods in linux_nat_target instead. */
/* Register a method to call whenever a new thread is attached. */
void linux_nat_set_new_thread (struct target_ops *, void (*) (struct lwp_info *));
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 718dc1ab662..ec5a4959541 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -395,8 +395,8 @@ linux_is_uclinux (void)
{
CORE_ADDR dummy;
- return (target_auxv_search (&current_target, AT_NULL, &dummy) > 0
- && target_auxv_search (&current_target, AT_PAGESZ, &dummy) == 0);
+ return (target_auxv_search (target_stack, AT_NULL, &dummy) > 0
+ && target_auxv_search (target_stack, AT_PAGESZ, &dummy) == 0);
}
static int
@@ -1402,7 +1402,7 @@ linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
LONGEST i, j, size;
/* Determine list of SPU ids. */
- size = target_read_alloc (&current_target, TARGET_OBJECT_SPU,
+ size = target_read_alloc (target_stack, TARGET_OBJECT_SPU,
NULL, &spu_ids);
/* Generate corefile notes for each SPU file. */
@@ -1417,7 +1417,7 @@ linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
LONGEST spu_len;
xsnprintf (annex, sizeof annex, "%d/%s", fd, spu_files[j]);
- spu_len = target_read_alloc (&current_target, TARGET_OBJECT_SPU,
+ spu_len = target_read_alloc (target_stack, TARGET_OBJECT_SPU,
annex, &spu_data);
if (spu_len > 0)
{
@@ -1653,7 +1653,7 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
buf = (gdb_byte *) xmalloc (TYPE_LENGTH (siginfo_type));
cleanups = make_cleanup (xfree, buf);
- bytes_read = target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
+ bytes_read = target_read (target_stack, TARGET_OBJECT_SIGNAL_INFO, NULL,
buf, 0, TYPE_LENGTH (siginfo_type));
if (bytes_read == TYPE_LENGTH (siginfo_type))
{
@@ -2002,7 +2002,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
return NULL;
/* Auxillary vector. */
- auxv_len = target_read_alloc (&current_target, TARGET_OBJECT_AUXV,
+ auxv_len = target_read_alloc (target_stack, TARGET_OBJECT_AUXV,
NULL, &auxv);
if (auxv_len > 0)
{
@@ -2287,7 +2287,7 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
long pid;
char *data;
- if (target_auxv_search (&current_target, AT_SYSINFO_EHDR, &range->start) <= 0)
+ if (target_auxv_search (target_stack, AT_SYSINFO_EHDR, &range->start) <= 0)
return 0;
/* It doesn't make sense to access the host's /proc when debugging a
@@ -2480,14 +2480,14 @@ linux_displaced_step_location (struct gdbarch *gdbarch)
local-store address and is thus not usable as displaced stepping
location. The auxiliary vector gets us the PowerPC-side entry
point address instead. */
- if (target_auxv_search (&current_target, AT_ENTRY, &addr) <= 0)
+ if (target_auxv_search (target_stack, AT_ENTRY, &addr) <= 0)
throw_error (NOT_SUPPORTED_ERROR,
_("Cannot find AT_ENTRY auxiliary vector entry."));
/* Make certain that the address points at real code, and not a
function descriptor. */
addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
- &current_target);
+ target_stack);
/* Inferior calls also use the entry point as a breakpoint location.
We don't want displaced stepping to interfere with those
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 2300c810a74..a3b92872840 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -73,6 +73,36 @@
of the ptid_t prevents thread IDs changing when libpthread is
loaded or unloaded. */
+class thread_db_target : public target_ops
+{
+ public:
+ thread_db_target ();
+
+ const char *shortname () OVERRIDE
+ { return "multi-thread"; }
+ const char *longname () OVERRIDE
+ { return _("multi-threaded child process."); }
+ const char *doc () OVERRIDE
+ { return _("Threads and pthreads support."); }
+
+ void detach (const char *, int) OVERRIDE;
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+ void mourn_inferior () OVERRIDE;
+ void update_thread_list () OVERRIDE;
+ char *pid_to_str (ptid_t) OVERRIDE;
+ CORE_ADDR get_thread_local_address (ptid_t ptid,
+ CORE_ADDR load_module_addr,
+ CORE_ADDR offset) OVERRIDE;
+ char *extra_thread_info (struct thread_info *) OVERRIDE;
+ ptid_t get_ada_task_ptid (long lwp, long thread) OVERRIDE;
+};
+
+thread_db_target::thread_db_target()
+{
+ this->to_stratum = thread_stratum;
+}
+
static char *libthread_db_search_path;
/* Set to non-zero if thread_db auto-loading is enabled
@@ -116,7 +146,7 @@ show_libthread_db_debug (struct ui_file *file, int from_tty,
threads. */
/* This module's target vector. */
-static struct target_ops thread_db_ops;
+static struct target_ops *the_thread_db_target;
/* Non-zero if we have determined the signals used by the threads
library. */
@@ -629,7 +659,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
/* The thread library was detected. Activate the thread_db target
if this is the first process using it. */
if (thread_db_list->next == NULL)
- push_target (&thread_db_ops);
+ push_target (the_thread_db_target);
return 1;
}
@@ -917,7 +947,7 @@ thread_db_load (void)
return 0;
/* Don't attempt to use thread_db for remote targets. */
- if (!(target_can_run (&current_target) || core_bfd))
+ if (!(target_can_run () || core_bfd))
return 0;
if (thread_db_load_search ())
@@ -1008,7 +1038,7 @@ static void
check_pid_namespace_match (void)
{
/* Check is only relevant for local targets targets. */
- if (target_can_run (&current_target))
+ if (target_can_run ())
{
/* If the child is in a different PID namespace, its idea of its
PID will differ from our idea of its PID. When we scan the
@@ -1085,10 +1115,10 @@ record_thread (struct thread_db_info *info,
return tp;
}
-static void
-thread_db_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+thread_db_target::detach (const char *args, int from_tty)
{
- struct target_ops *target_beneath = find_target_beneath (ops);
+ struct target_ops *target_beneath = find_target_beneath (this);
struct thread_db_info *info;
info = get_thread_db_info (ptid_get_pid (inferior_ptid));
@@ -1096,25 +1126,24 @@ thread_db_detach (struct target_ops *ops, const char *args, int from_tty)
if (info)
delete_thread_db_info (ptid_get_pid (inferior_ptid));
- target_beneath->to_detach (target_beneath, args, from_tty);
+ target_beneath->detach (args, from_tty);
/* NOTE: From this point on, inferior_ptid is null_ptid. */
/* If there are no more processes using libpthread, detach the
thread_db target ops. */
if (!thread_db_list)
- unpush_target (&thread_db_ops);
+ unpush_target (this);
}
-static ptid_t
-thread_db_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *ourstatus,
- int options)
+ptid_t
+thread_db_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
+ int options)
{
struct thread_db_info *info;
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
- ptid = beneath->to_wait (beneath, ptid, ourstatus, options);
+ ptid = beneath->wait (ptid, ourstatus, options);
switch (ourstatus->kind)
{
@@ -1137,7 +1166,7 @@ thread_db_wait (struct target_ops *ops,
not unless we find otherwise. */
delete_thread_db_info (ptid_get_pid (ptid));
if (!thread_db_list)
- unpush_target (&thread_db_ops);
+ unpush_target (the_thread_db_target);
return ptid;
}
@@ -1148,18 +1177,18 @@ thread_db_wait (struct target_ops *ops,
return ptid;
}
-static void
-thread_db_mourn_inferior (struct target_ops *ops)
+void
+thread_db_target::mourn_inferior ()
{
- struct target_ops *target_beneath = find_target_beneath (ops);
+ struct target_ops *target_beneath = find_target_beneath (this);
delete_thread_db_info (ptid_get_pid (inferior_ptid));
- target_beneath->to_mourn_inferior (target_beneath);
+ target_beneath->mourn_inferior ();
/* Detach thread_db target ops. */
if (!thread_db_list)
- unpush_target (ops);
+ unpush_target (the_thread_db_target);
}
struct callback_data
@@ -1327,8 +1356,8 @@ thread_db_find_new_threads_1 (ptid_t ptid)
/* Implement the to_update_thread_list target method for this
target. */
-static void
-thread_db_update_thread_list (struct target_ops *ops)
+void
+thread_db_target::update_thread_list ()
{
struct thread_db_info *info;
struct inferior *inf;
@@ -1368,11 +1397,11 @@ thread_db_update_thread_list (struct target_ops *ops)
}
/* Give the beneath target a chance to do extra processing. */
- ops->beneath->to_update_thread_list (ops->beneath);
+ this->beneath->update_thread_list ();
}
-static char *
-thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+thread_db_target::pid_to_str (ptid_t ptid)
{
struct thread_info *thread_info = find_thread_ptid (ptid);
struct target_ops *beneath;
@@ -1389,16 +1418,15 @@ thread_db_pid_to_str (struct target_ops *ops, ptid_t ptid)
return buf;
}
- beneath = find_target_beneath (ops);
- return beneath->to_pid_to_str (beneath, ptid);
+ beneath = find_target_beneath (this);
+ return beneath->pid_to_str (ptid);
}
/* Return a string describing the state of the thread specified by
INFO. */
-static char *
-thread_db_extra_thread_info (struct target_ops *self,
- struct thread_info *info)
+char *
+thread_db_target::extra_thread_info (struct thread_info *info)
{
if (info->priv == NULL)
return NULL;
@@ -1412,11 +1440,10 @@ thread_db_extra_thread_info (struct target_ops *self,
/* Get the address of the thread local variable in load module LM which
is stored at OFFSET within the thread local storage for thread PTID. */
-static CORE_ADDR
-thread_db_get_thread_local_address (struct target_ops *ops,
- ptid_t ptid,
- CORE_ADDR lm,
- CORE_ADDR offset)
+CORE_ADDR
+thread_db_target::get_thread_local_address (ptid_t ptid,
+ CORE_ADDR lm,
+ CORE_ADDR offset)
{
struct thread_info *thread_info;
struct target_ops *beneath;
@@ -1493,24 +1520,23 @@ thread_db_get_thread_local_address (struct target_ops *ops,
: (CORE_ADDR) (uintptr_t) address);
}
- beneath = find_target_beneath (ops);
- return beneath->to_get_thread_local_address (beneath, ptid, lm, offset);
+ beneath = find_target_beneath (this);
+ return beneath->get_thread_local_address (ptid, lm, offset);
}
/* Implement the to_get_ada_task_ptid target method for this target. */
-static ptid_t
-thread_db_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
+ptid_t
+thread_db_target::get_ada_task_ptid (long lwp, long thread)
{
/* NPTL uses a 1:1 model, so the LWP id suffices. */
return ptid_build (ptid_get_pid (inferior_ptid), lwp, 0);
}
-static void
-thread_db_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal signo)
+void
+thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
{
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
struct thread_db_info *info;
if (ptid_equal (ptid, minus_one_ptid))
@@ -1524,7 +1550,7 @@ thread_db_resume (struct target_ops *ops,
if (info)
info->need_stale_parent_threads_check = 0;
- beneath->to_resume (beneath, ptid, step, signo);
+ beneath->resume (ptid, step, signo);
}
/* qsort helper function for info_auto_load_libthread_db, sort the
@@ -1670,37 +1696,14 @@ info_auto_load_libthread_db (char *args, int from_tty)
ui_out_message (uiout, 0, _("No auto-loaded libthread-db.\n"));
}
-static void
-init_thread_db_ops (void)
-{
- thread_db_ops.to_shortname = "multi-thread";
- thread_db_ops.to_longname = "multi-threaded child process.";
- thread_db_ops.to_doc = "Threads and pthreads support.";
- thread_db_ops.to_detach = thread_db_detach;
- thread_db_ops.to_wait = thread_db_wait;
- thread_db_ops.to_resume = thread_db_resume;
- thread_db_ops.to_mourn_inferior = thread_db_mourn_inferior;
- thread_db_ops.to_update_thread_list = thread_db_update_thread_list;
- thread_db_ops.to_pid_to_str = thread_db_pid_to_str;
- thread_db_ops.to_stratum = thread_stratum;
- thread_db_ops.to_has_thread_control = tc_schedlock;
- thread_db_ops.to_get_thread_local_address
- = thread_db_get_thread_local_address;
- thread_db_ops.to_extra_thread_info = thread_db_extra_thread_info;
- thread_db_ops.to_get_ada_task_ptid = thread_db_get_ada_task_ptid;
- thread_db_ops.to_magic = OPS_MAGIC;
-
- complete_target_initialization (&thread_db_ops);
-}
-
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_thread_db;
void
_initialize_thread_db (void)
{
- init_thread_db_ops ();
-
+ the_thread_db_target = new thread_db_target ();
+
/* Defer loading of libthread_db.so until inferior is running.
This allows gdb to load correct libthread_db for a given
executable -- there could be multiple versions of glibc,
diff --git a/gdb/make-target-delegates b/gdb/make-target-delegates
index 2d3b09e49fb..6bcae65f6e4 100755
--- a/gdb/make-target-delegates
+++ b/gdb/make-target-delegates
@@ -30,16 +30,24 @@ $ENDER = qr,^\s*};$,;
# Match a C symbol.
$SYMBOL = qr,[a-zA-Z_][a-zA-Z0-9_]*,;
# Match the name part of a method in struct target_ops.
-$NAME_PART = qr,\(\*(?<name>${SYMBOL}+)\)\s,;
+$NAME_PART = qr,(?<name>${SYMBOL}+)\s,;
# Match the arguments to a method.
$ARGS_PART = qr,(?<args>\(.*\)),;
# We strip the indentation so here we only need the caret.
$INTRO_PART = qr,^,;
+$POINTER_PART = qr,\s*(\*)?\s*,;
+
# Match the return type when it is "ordinary".
-$SIMPLE_RETURN_PART = qr,[^\(]+,;
+$SIMPLE_RETURN_PART = qr,((struct|class|enum|union)\s+)?${SYMBOL}+,;
# Match the return type when it is a VEC.
-$VEC_RETURN_PART = qr,VEC\s*\([^\)]+\)[^\(]*,;
+$VEC_RETURN_PART = qr,VEC\s*\([^\)]+\),;
+
+# Match a return type.
+$RETURN_PART = qr,((const|volatile)\s+)?(${SIMPLE_RETURN_PART}|${VEC_RETURN_PART})${POINTER_PART},;
+
+# Match "virtual".
+$VIRTUAL_PART = qr,virtual\s,;
# Match the TARGET_DEFAULT_* attribute for a method.
$TARGET_DEFAULT_PART = qr,TARGET_DEFAULT_(?<style>[A-Z_]+)\s*\((?<default_arg>.*)\),;
@@ -49,8 +57,7 @@ $TARGET_DEFAULT_PART = qr,TARGET_DEFAULT_(?<style>[A-Z_]+)\s*\((?<default_arg>.*
$METHOD_TRAILER = qr,\s*${TARGET_DEFAULT_PART}$,;
# Match an entire method definition.
-$METHOD = ($INTRO_PART . "(?<return_type>" . $SIMPLE_RETURN_PART
- . "|" . $VEC_RETURN_PART . ")"
+$METHOD = ($INTRO_PART . $VIRTUAL_PART . "(?<return_type>" . $RETURN_PART . ")"
. $NAME_PART . $ARGS_PART
. $METHOD_TRAILER);
@@ -90,7 +97,7 @@ sub scan_target_h() {
next if /{/;
last if m/$ENDER/;
- # Just in case somebody ever uses C99.
+ # Strip // comments.
$_ =~ s,//.*$,,;
$_ = trim ($_);
@@ -130,16 +137,24 @@ sub parse_argtypes($) {
sub dname($) {
my ($name) = @_;
- $name =~ s/to_/delegate_/;
- return $name;
+ return "target_ops::" . $name;
}
# Write function header given name, return type, and argtypes.
# Returns a list of actual argument names.
-sub write_function_header($$@) {
- my ($name, $return_type, @argtypes) = @_;
+sub write_function_header($$$@) {
+ my ($decl, $name, $return_type, @argtypes) = @_;
+
+ print $return_type;
+
+ if ($decl) {
+ if ($return_type !~ m,\*$,) {
+ print " ";
+ }
+ } else {
+ print "\n";
+ }
- print "static " . $return_type . "\n";
print $name . ' (';
my $iter;
@@ -156,12 +171,7 @@ sub write_function_header($$@) {
}
my $vname;
- if ($i == 0) {
- # Just a random nicety.
- $vname = 'self';
- } else {
- $vname .= "arg$i";
- }
+ $vname .= "arg$i";
$val .= $vname;
push @argdecls, $val;
@@ -169,25 +179,36 @@ sub write_function_header($$@) {
++$i;
}
- print join (', ', @argdecls) . ")\n";
- print "{\n";
+ print join (', ', @argdecls) . ")";
+
+ if ($decl) {
+ print " OVERRIDE;\n";
+ } else {
+ print "\n{\n";
+ }
return @actuals;
}
+# Write out a declaration.
+sub write_declaration($$@) {
+ my ($name, $return_type, @argtypes) = @_;
+
+ write_function_header (1, $name, $return_type, @argtypes);
+}
+
# Write out a delegation function.
sub write_delegator($$@) {
my ($name, $return_type, @argtypes) = @_;
- my (@names) = write_function_header (dname ($name), $return_type,
- @argtypes);
+ my (@names) = write_function_header (0, dname ($name),
+ $return_type, @argtypes);
- print " $names[0] = $names[0]->beneath;\n";
print " ";
if ($return_type ne 'void') {
print "return ";
}
- print "$names[0]->" . $name . " (";
+ print "this->beneath->" . $name . " (";
print join (', ', @names);
print ");\n";
print "}\n\n";
@@ -195,21 +216,28 @@ sub write_delegator($$@) {
sub tdname ($) {
my ($name) = @_;
- $name =~ s/to_/tdefault_/;
- return $name;
+ return "dummy_target::" . $name;
}
# Write out a default function.
sub write_tdefault($$$$@) {
my ($content, $style, $name, $return_type, @argtypes) = @_;
- if ($style eq 'FUNC') {
- return $content;
- }
+ my (@names) = write_function_header (0, tdname ($name),
+ $return_type, @argtypes);
- write_function_header (tdname ($name), $return_type, @argtypes);
-
- if ($style eq 'RETURN') {
+ if ($style eq 'FUNC') {
+ print " ";
+ if ($return_type ne 'void') {
+ print "return ";
+ }
+ print $content . " (this";
+ if (@names) {
+ print ", ";
+ }
+ print join (', ', @names);
+ print ");\n";
+ } elsif ($style eq 'RETURN') {
print " return $content;\n";
} elsif ($style eq 'NORETURN') {
print " $content;\n";
@@ -241,39 +269,37 @@ sub munge_type($) {
}
# Write out a debug method.
-sub write_debugmethod($$$$@) {
- my ($content, $style, $name, $return_type, @argtypes) = @_;
+sub write_debugmethod($$$@) {
+ my ($content, $name, $return_type, @argtypes) = @_;
- my ($debugname) = $name;
- $debugname =~ s/to_/debug_/;
+ my ($debugname) = "debug_target::" . $name;
my ($targetname) = $name;
- $targetname =~ s/to_/target_/;
- my (@names) = write_function_header ($debugname, $return_type, @argtypes);
+ my (@names) = write_function_header (0, $debugname, $return_type, @argtypes);
if ($return_type ne 'void') {
print " $return_type result;\n";
}
- print " fprintf_unfiltered (gdb_stdlog, \"-> %s->$name (...)\\n\", debug_target.to_shortname);\n";
+ print " fprintf_unfiltered (gdb_stdlog, \"-> %s->$name (...)\\n\", this->beneath->shortname ());\n";
# Delegate to the beneath target.
print " ";
if ($return_type ne 'void') {
print "result = ";
}
- print "debug_target." . $name . " (";
- my @names2 = @names;
- @names2[0] = "&debug_target";
- print join (', ', @names2);
+ print "this->beneath->" . $name . " (";
+ print join (', ', @names);
print ");\n";
# Now print the arguments.
- print " fprintf_unfiltered (gdb_stdlog, \"<- %s->$name (\", debug_target.to_shortname);\n";
+ print " fprintf_unfiltered (gdb_stdlog, \"<- %s->$name (\", this->beneath->shortname ());\n";
for my $i (0 .. $#argtypes) {
- print " fputs_unfiltered (\", \", gdb_stdlog);\n" if $i > 0;
+ if ($i > 0) {
+ print " fputs_unfiltered (\", \", gdb_stdlog);\n"
+ }
my $printer = munge_type ($argtypes[$i]);
- print " $printer ($names2[$i]);\n";
+ print " $printer ($names[$i]);\n";
}
if ($return_type ne 'void') {
print " fputs_unfiltered (\") = \", gdb_stdlog);\n";
@@ -297,61 +323,71 @@ print "/* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */\n";
print "/* vi:set ro: */\n\n";
print "/* To regenerate this file, run:*/\n";
print "/* make-target-delegates target.h > target-delegates.c */\n";
+print "\n";
@lines = scan_target_h();
-
-%tdefault_names = ();
-%debug_names = ();
@delegators = ();
+@return_types = ();
+@tdefaults = ();
+@styles = ();
+@argtypes_array = ();
+
foreach $current_line (@lines) {
next unless $current_line =~ m/$METHOD/;
- $name = $+{name};
- $current_line = $+{args};
- $return_type = trim ($+{return_type});
- $current_args = $+{args};
- $tdefault = $+{default_arg};
- $style = $+{style};
+ my $name = $+{name};
+ my $current_line = $+{args};
+ my $return_type = trim ($+{return_type});
+ my $current_args = $+{args};
+ my $tdefault = $+{default_arg};
+ my $style = $+{style};
- @argtypes = parse_argtypes ($current_args);
+ my @argtypes = parse_argtypes ($current_args);
- # The first argument must be "this" to be delegatable.
- if ($argtypes[0] =~ /\s*struct\s+target_ops\s*\*\s*/) {
- write_delegator ($name, $return_type, @argtypes);
+ push @delegators, $name;
- push @delegators, $name;
+ $return_types{$name} = $return_type;
+ $tdefaults{$name} = $tdefault;
+ $styles{$name} = $style;
+ $argtypes_array{$name} = \@argtypes;
+}
- $tdefault_names{$name} = write_tdefault ($tdefault, $style,
- $name, $return_type,
- @argtypes);
+sub print_class($) {
+ my ($name) = @_;
- $debug_names{$name} = write_debugmethod ($tdefault, $style,
- $name, $return_type,
- @argtypes);
+ print "struct " . $name . " : public target_ops\n";
+ print "{\n";
+ print " $name ();\n";
+ print "\n";
+ print " const char *shortname () OVERRIDE;\n";
+ print " const char *longname () OVERRIDE;\n";
+ print " const char *doc () OVERRIDE;\n";
+ print "\n";
+
+ for $name (@delegators) {
+ my $return_type = $return_types{$name};
+ my @argtypes = @{$argtypes_array{$name}};
+
+ print " ";
+ write_declaration ($name, $return_type, @argtypes);
}
+
+ print "};\n\n";
}
-# Now the delegation code.
-print "static void\ninstall_delegators (struct target_ops *ops)\n{\n";
+print_class ("dummy_target");
+print_class ("debug_target");
-for $iter (@delegators) {
- print " if (ops->" . $iter . " == NULL)\n";
- print " ops->" . $iter . " = " . dname ($iter) . ";\n";
-}
-print "}\n\n";
+for $name (@delegators) {
+ my $tdefault = $tdefaults{$name};
+ my $return_type = $return_types{$name};
+ my $style = $styles{$name};
+ my @argtypes = @{$argtypes_array{$name}};
-# Now the default method code.
-print "static void\ninstall_dummy_methods (struct target_ops *ops)\n{\n";
+ write_delegator ($name, $return_type, @argtypes);
-for $iter (@delegators) {
- print " ops->" . $iter . " = " . $tdefault_names{$iter} . ";\n";
-}
-print "}\n\n";
+ write_tdefault ($tdefault, $style, $name, $return_type, @argtypes);
-# The debug method code.
-print "static void\ninit_debug_target (struct target_ops *ops)\n{\n";
-for $iter (@delegators) {
- print " ops->" . $iter . " = " . $debug_names{$iter} . ";\n";
+ write_debugmethod ($tdefault, $name, $return_type, @argtypes);
}
-print "}\n";
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 1913157e19d..527e60de11f 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -268,7 +268,7 @@ proceed_thread_callback (struct thread_info *thread, void *arg)
static void
exec_continue (char **argv, int argc)
{
- prepare_execution_command (&current_target, mi_async_p ());
+ prepare_execution_command (target_stack, mi_async_p ());
if (non_stop)
{
@@ -417,7 +417,7 @@ run_one_inferior (struct inferior *inf, void *arg)
int start_p = *(int *) arg;
const char *run_cmd = start_p ? "start" : "run";
struct target_ops *run_target = find_run_target ();
- int async_p = mi_async && run_target->to_can_async_p (run_target);
+ int async_p = mi_async && run_target->can_async_p ();
if (inf->pid != 0)
{
@@ -492,7 +492,7 @@ mi_cmd_exec_run (char *command, char **argv, int argc)
{
const char *run_cmd = start_p ? "start" : "run";
struct target_ops *run_target = find_run_target ();
- int async_p = mi_async && run_target->to_can_async_p (run_target);
+ int async_p = mi_async && run_target->can_async_p ();
mi_execute_cli_command (run_cmd, async_p,
async_p ? "&" : NULL);
@@ -1500,10 +1500,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
mbuf = XCNEWVEC (gdb_byte, total_bytes);
make_cleanup (xfree, mbuf);
- /* Dispatch memory reads to the topmost target, not the flattened
- current_target. */
- nr_bytes = target_read (current_target.beneath,
- TARGET_OBJECT_MEMORY, NULL, mbuf,
+ nr_bytes = target_read (target_stack, TARGET_OBJECT_MEMORY, NULL, mbuf,
addr, total_bytes);
if (nr_bytes <= 0)
error (_("Unable to read memory."));
@@ -1634,7 +1631,7 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
addr = parse_and_eval_address (argv[0]) + offset;
length = atol (argv[1]);
- result = read_memory_robust (current_target.beneath, addr, length);
+ result = read_memory_robust (target_stack, addr, length);
cleanups = make_cleanup (free_memory_read_result_vector, &result);
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index b47840264b7..c79badc6bdc 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1416,7 +1416,7 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc)
func = gdbarch_convert_from_func_ptr_addr
(get_objfile_arch (objfile),
MSYMBOL_VALUE_ADDRESS (objfile, msymbol),
- &current_target);
+ target_stack);
/* Ignore data symbols that are not function descriptors. */
if (func != MSYMBOL_VALUE_ADDRESS (objfile, msymbol))
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index f358528b949..d176d573d7d 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -203,7 +203,7 @@ procfs_open_1 (struct target_ops *ops, const char *arg, int from_tty)
}
do_cleanups (cleanups);
- inf_child_open_target (ops, arg, from_tty);
+ inf_child_target::open (arg, from_tty);
printf_filtered ("Debugging using %s\n", nto_procfs_path);
}
diff --git a/gdb/parse.c b/gdb/parse.c
index 2b00708f1b8..dcd280b3f68 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -486,7 +486,7 @@ write_exp_msymbol (struct parser_state *ps,
/* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */
- pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, &current_target);
+ pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, target_stack);
if (pc != addr)
{
struct bound_minimal_symbol ifunc_msym = lookup_minimal_symbol_by_pc (pc);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 84c14a1ae9e..5b6f840d5b7 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1304,7 +1304,7 @@ ppc_linux_get_hwcap (void)
{
CORE_ADDR field;
- if (target_auxv_search (&current_target, AT_HWCAP, &field))
+ if (target_auxv_search (target_stack, AT_HWCAP, &field))
return (unsigned long) field;
return 0;
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index cde4f2ef301..8e61e5297c5 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1194,7 +1194,7 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
/* Look up cached address of thread-local variable. */
if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
{
- struct target_ops *target = &current_target;
+ struct target_ops *target = target_stack;
TRY
{
@@ -1205,9 +1205,9 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
Instead, we have cached the lm_addr value, and use that to
directly call the target's to_get_thread_local_address. */
spe_context_cache_address
- = target->to_get_thread_local_address (target, inferior_ptid,
- spe_context_lm_addr,
- spe_context_offset);
+ = target->get_thread_local_address (inferior_ptid,
+ spe_context_lm_addr,
+ spe_context_offset);
spe_context_cache_ptid = inferior_ptid;
}
@@ -1358,7 +1358,7 @@ ppu2spu_sniffer (const struct frame_unwind *self,
return 0;
xsnprintf (annex, sizeof annex, "%d/regs", data.id);
- if (target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ if (target_read (target_stack, TARGET_OBJECT_SPU, annex,
data.gprs, 0, sizeof data.gprs)
== sizeof data.gprs)
{
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 67b424f5e56..a2ea65d2225 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -4622,7 +4622,7 @@ procfs_inferior_created (struct target_ops *ops, int from_tty)
the inferior ourselves, there is nothing to do when the inferior
was created by attaching to an already running process, or when
debugging a core file. */
- if (current_inferior ()->attach_flag || !target_can_run (&current_target))
+ if (current_inferior ()->attach_flag || !target_can_run ())
return;
proc_trace_syscalls_1 (find_procinfo_or_die (ptid_get_pid (inferior_ptid),
@@ -5460,7 +5460,7 @@ procfs_make_note_section (struct target_ops *self, bfd *obfd, int *note_size)
&thread_args);
note_data = thread_args.note_data;
- auxv_len = target_read_alloc (&current_target, TARGET_OBJECT_AUXV,
+ auxv_len = target_read_alloc (target_stack, TARGET_OBJECT_AUXV,
NULL, &auxv);
if (auxv_len > 0)
{
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 3e0687de983..b6f7421a739 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -34,9 +34,6 @@
/* If non-null, ravenscar task support is enabled. */
static int ravenscar_task_support = 1;
-/* This module's target-specific operations. */
-static struct target_ops ravenscar_ops;
-
/* Some base target uses a special value for the null PID (exempli gratia
remote). */
static ptid_t base_magic_null_ptid;
@@ -52,20 +49,51 @@ static const char first_task_name[] = "system__tasking__debug__first_task";
static const char ravenscar_runtime_initializer[] =
"system__bb__threads__initialize";
-static void ravenscar_update_thread_list (struct target_ops *ops);
+struct ravenscar_thread_target : public target_ops
+{
+ ravenscar_thread_target ()
+ { to_stratum = thread_stratum; }
+
+ const char *shortname () OVERRIDE
+ { return "ravenscar"; }
+
+ const char *longname () OVERRIDE
+ { return _("Ravenscar tasks."); }
+
+ const char *doc () OVERRIDE
+ { return _("Ravenscar tasks support."); }
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+
+ void prepare_to_store (struct regcache *) OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ void update_thread_list () OVERRIDE;
+
+ char *extra_thread_info (struct thread_info *) OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ ptid_t get_ada_task_ptid (long lwp, long thread) OVERRIDE;
+
+ void mourn_inferior () OVERRIDE;
+
+ int has_all_memory () OVERRIDE { return default_child_has_all_memory (); }
+ int has_memory () OVERRIDE { return default_child_has_memory (); }
+ int has_stack () OVERRIDE { return default_child_has_stack (); }
+ int has_registers () OVERRIDE { return default_child_has_registers (); }
+ int has_execution (ptid_t ptid) OVERRIDE{ return default_child_has_execution (ptid); }
+};
+
+/* This module's target-specific operations. */
+static ravenscar_thread_target ravenscar_ops;
+
static ptid_t ravenscar_running_thread (void);
-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_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 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);
static void ravenscar_update_inferior_ptid (void);
static int has_ravenscar_runtime (void);
static int ravenscar_runtime_initialized (void);
@@ -172,25 +200,24 @@ get_running_thread_id (void)
return extract_typed_address (buf, builtin_type_void_data_ptr);
}
-static void
-ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
- enum gdb_signal siggnal)
+void
+ravenscar_thread_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
{
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
inferior_ptid = base_ptid;
- beneath->to_resume (beneath, base_ptid, step, siggnal);
+ beneath->resume (base_ptid, step, siggnal);
}
-static ptid_t
-ravenscar_wait (struct target_ops *ops, ptid_t ptid,
- struct target_waitstatus *status,
- int options)
+ptid_t
+ravenscar_thread_target::wait (ptid_t ptid,
+ struct target_waitstatus *status,
+ int options)
{
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
inferior_ptid = base_ptid;
- beneath->to_wait (beneath, base_ptid, status, 0);
+ beneath->wait (base_ptid, status, 0);
/* Find any new threads that might have been created, and update
inferior_ptid to the active thread.
@@ -201,7 +228,7 @@ ravenscar_wait (struct target_ops *ops, ptid_t ptid,
if (status->kind != TARGET_WAITKIND_EXITED
&& status->kind != TARGET_WAITKIND_SIGNALLED)
{
- ravenscar_update_thread_list (ops);
+ this->update_thread_list ();
ravenscar_update_inferior_ptid ();
}
return inferior_ptid;
@@ -217,8 +244,8 @@ ravenscar_add_thread (struct ada_task_info *task)
add_thread (task->ptid);
}
-static void
-ravenscar_update_thread_list (struct target_ops *ops)
+void
+ravenscar_thread_target::update_thread_list ()
{
ada_build_task_list ();
@@ -241,21 +268,21 @@ ravenscar_running_thread (void)
return ptid_build (ptid_get_pid (base_ptid), 0, tid);
}
-static char *
-ravenscar_extra_thread_info (struct target_ops *self, struct thread_info *tp)
+char *
+ravenscar_thread_target::extra_thread_info (struct thread_info *tp)
{
return "Ravenscar task";
}
-static int
-ravenscar_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+ravenscar_thread_target::thread_alive (ptid_t ptid)
{
/* Ravenscar tasks are non-terminating. */
return 1;
}
-static char *
-ravenscar_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+ravenscar_thread_target::pid_to_str (ptid_t ptid)
{
static char buf[30];
@@ -263,16 +290,15 @@ ravenscar_pid_to_str (struct target_ops *ops, ptid_t ptid)
return buf;
}
-static void
-ravenscar_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum)
{
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
if (!ravenscar_runtime_initialized ()
|| ptid_equal (inferior_ptid, base_magic_null_ptid)
|| ptid_equal (inferior_ptid, ravenscar_running_thread ()))
- beneath->to_fetch_registers (beneath, regcache, regnum);
+ beneath->fetch_registers (regcache, regnum);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -283,16 +309,16 @@ ravenscar_fetch_registers (struct target_ops *ops,
}
}
-static void
-ravenscar_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+ravenscar_thread_target::store_registers (struct regcache *regcache,
+ int regnum)
{
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
if (!ravenscar_runtime_initialized ()
|| ptid_equal (inferior_ptid, base_magic_null_ptid)
|| ptid_equal (inferior_ptid, ravenscar_running_thread ()))
- beneath->to_store_registers (beneath, regcache, regnum);
+ beneath->store_registers (regcache, regnum);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -303,16 +329,15 @@ ravenscar_store_registers (struct target_ops *ops,
}
}
-static void
-ravenscar_prepare_to_store (struct target_ops *self,
- struct regcache *regcache)
+void
+ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
{
- struct target_ops *beneath = find_target_beneath (self);
+ struct target_ops *beneath = find_target_beneath (this);
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);
+ beneath->prepare_to_store (regcache);
else
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -323,13 +348,13 @@ ravenscar_prepare_to_store (struct target_ops *self,
}
}
-static void
-ravenscar_mourn_inferior (struct target_ops *ops)
+void
+ravenscar_thread_target::mourn_inferior ()
{
- struct target_ops *beneath = find_target_beneath (ops);
+ struct target_ops *beneath = find_target_beneath (this);
base_ptid = null_ptid;
- beneath->to_mourn_inferior (beneath);
+ beneath->mourn_inferior ();
unpush_target (&ravenscar_ops);
}
@@ -349,38 +374,12 @@ ravenscar_inferior_created (struct target_ops *target, int from_tty)
push_target (&ravenscar_ops);
}
-static ptid_t
-ravenscar_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
+ptid_t
+ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
{
return ptid_build (ptid_get_pid (base_ptid), 0, thread);
}
-static void
-init_ravenscar_thread_ops (void)
-{
- ravenscar_ops.to_shortname = "ravenscar";
- ravenscar_ops.to_longname = "Ravenscar tasks.";
- ravenscar_ops.to_doc = "Ravenscar tasks support.";
- ravenscar_ops.to_resume = ravenscar_resume;
- ravenscar_ops.to_wait = ravenscar_wait;
- ravenscar_ops.to_fetch_registers = ravenscar_fetch_registers;
- ravenscar_ops.to_store_registers = ravenscar_store_registers;
- ravenscar_ops.to_prepare_to_store = ravenscar_prepare_to_store;
- ravenscar_ops.to_thread_alive = ravenscar_thread_alive;
- ravenscar_ops.to_update_thread_list = ravenscar_update_thread_list;
- ravenscar_ops.to_pid_to_str = ravenscar_pid_to_str;
- ravenscar_ops.to_extra_thread_info = ravenscar_extra_thread_info;
- ravenscar_ops.to_get_ada_task_ptid = ravenscar_get_ada_task_ptid;
- ravenscar_ops.to_mourn_inferior = ravenscar_mourn_inferior;
- ravenscar_ops.to_has_all_memory = default_child_has_all_memory;
- ravenscar_ops.to_has_memory = default_child_has_memory;
- ravenscar_ops.to_has_stack = default_child_has_stack;
- ravenscar_ops.to_has_registers = default_child_has_registers;
- ravenscar_ops.to_has_execution = default_child_has_execution;
- ravenscar_ops.to_stratum = thread_stratum;
- ravenscar_ops.to_magic = OPS_MAGIC;
-}
-
/* Command-list for the "set/show ravenscar" prefix command. */
static struct cmd_list_element *set_ravenscar_list;
static struct cmd_list_element *show_ravenscar_list;
@@ -427,15 +426,12 @@ extern void _initialize_ravenscar (void);
void
_initialize_ravenscar (void)
{
- init_ravenscar_thread_ops ();
base_ptid = null_ptid;
/* Notice when the inferior is created in order to push the
ravenscar ops if needed. */
observer_attach_inferior_created (ravenscar_inferior_created);
- complete_target_initialization (&ravenscar_ops);
-
add_prefix_cmd ("ravenscar", no_class, set_ravenscar_command,
_("Prefix command for changing Ravenscar-specific settings"),
&set_ravenscar_list, "set ravenscar ", 0, &setlist);
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index d50d5d8b850..ec3f677d442 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -41,7 +41,102 @@
#include "vec.h"
/* The target_ops of record-btrace. */
-static struct target_ops record_btrace_ops;
+
+class record_btrace_target : public target_ops
+{
+public:
+ record_btrace_target ();
+
+ const char *shortname () OVERRIDE
+ { return "record-btrace"; }
+
+ const char *longname () OVERRIDE
+ { return _("Branch tracing target"); }
+
+ const char *doc () OVERRIDE
+ { return _("Collect control-flow trace and provide the execution history."); }
+
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
+ void async (int) OVERRIDE;
+
+ void detach (const char *args, int from_tty) OVERRIDE
+ { record_detach (this, args, from_tty); }
+
+ void disconnect (const char *, int) OVERRIDE;
+
+ void mourn_inferior () OVERRIDE
+ { record_mourn_inferior (this); }
+
+ void kill () OVERRIDE
+ { record_kill (this); }
+
+ void stop_recording () OVERRIDE;
+ void info_record () OVERRIDE;
+
+ void insn_history (int size, int flags) OVERRIDE;
+ void insn_history_from (ULONGEST from, int size, int flags) OVERRIDE;
+ void insn_history_range (ULONGEST begin, ULONGEST end, int flags) OVERRIDE;
+ void call_history (int size, int flags) OVERRIDE;
+ void call_history_from (ULONGEST begin, int size, int flags) OVERRIDE;
+ void call_history_range (ULONGEST begin, ULONGEST end, int flags) OVERRIDE;
+
+ int record_is_replaying (ptid_t ptid) OVERRIDE;
+ int record_will_replay (ptid_t ptid, int dir) OVERRIDE;
+ void record_stop_replaying () OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ int insert_breakpoint (struct gdbarch *,
+ struct bp_target_info *) OVERRIDE;
+ int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
+ enum remove_bp_reason) OVERRIDE;
+
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+
+ void store_registers (struct regcache *, int) OVERRIDE;
+ void prepare_to_store (struct regcache *) OVERRIDE;
+
+ const struct frame_unwind *get_unwinder () OVERRIDE;
+
+ const struct frame_unwind *get_tailcall_unwinder () OVERRIDE;
+
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+
+ void stop (ptid_t) OVERRIDE;
+ void update_thread_list () OVERRIDE;
+ int thread_alive (ptid_t ptid) OVERRIDE;
+ void goto_record_begin () OVERRIDE;
+ void goto_record_end () OVERRIDE;
+ void goto_record (ULONGEST insn) OVERRIDE;
+
+ int can_execute_reverse () OVERRIDE;
+
+ int stopped_by_sw_breakpoint () OVERRIDE;
+ int supports_stopped_by_sw_breakpoint () OVERRIDE;
+
+ int stopped_by_hw_breakpoint () OVERRIDE;
+ int supports_stopped_by_hw_breakpoint () OVERRIDE;
+
+ enum exec_direction_kind execution_direction () OVERRIDE;
+ void prepare_to_generate_core () OVERRIDE;
+ void done_generating_core () OVERRIDE;
+};
+
+static record_btrace_target *the_record_btrace_target;
+
+/* Initialize the record-btrace target ops. */
+
+record_btrace_target::record_btrace_target ()
+{
+ to_stratum = record_stratum;
+}
/* A new thread observer enabling branch tracing for the new thread. */
static struct observer *record_btrace_thread_observer;
@@ -209,7 +304,7 @@ record_btrace_push_target (void)
record_btrace_auto_enable ();
- push_target (&record_btrace_ops);
+ push_target (the_record_btrace_target);
record_btrace_async_inferior_event_handler
= create_async_event_handler (record_btrace_handle_async_inferior_event,
@@ -222,8 +317,8 @@ record_btrace_push_target (void)
/* The to_open method of target record-btrace. */
-static void
-record_btrace_open (const char *args, int from_tty)
+void
+record_btrace_target::open (const char *args, int from_tty)
{
struct cleanup *disable_chain;
struct thread_info *tp;
@@ -253,8 +348,8 @@ record_btrace_open (const char *args, int from_tty)
/* The to_stop_recording method of target record-btrace. */
-static void
-record_btrace_stop_recording (struct target_ops *self)
+void
+record_btrace_target::stop_recording ()
{
struct thread_info *tp;
@@ -269,23 +364,23 @@ record_btrace_stop_recording (struct target_ops *self)
/* The to_disconnect method of target record-btrace. */
-static void
-record_btrace_disconnect (struct target_ops *self, const char *args,
- int from_tty)
+void
+record_btrace_target::disconnect (const char *args,
+ int from_tty)
{
- struct target_ops *beneath = self->beneath;
+ struct target_ops *beneath = this->beneath;
/* Do not stop recording, just clean up GDB side. */
- unpush_target (self);
+ unpush_target (this);
/* Forward disconnect. */
- beneath->to_disconnect (beneath, args, from_tty);
+ beneath->disconnect (args, from_tty);
}
/* The to_close method of target record-btrace. */
-static void
-record_btrace_close (struct target_ops *self)
+void
+record_btrace_target::close ()
{
struct thread_info *tp;
@@ -304,15 +399,15 @@ record_btrace_close (struct target_ops *self)
/* The to_async method of target record-btrace. */
-static void
-record_btrace_async (struct target_ops *ops, int enable)
+void
+record_btrace_target::async (int enable)
{
if (enable)
mark_async_event_handler (record_btrace_async_inferior_event_handler);
else
clear_async_event_handler (record_btrace_async_inferior_event_handler);
- ops->beneath->to_async (ops->beneath, enable);
+ this->beneath->async (enable);
}
/* Adjusts the size and returns a human readable size suffix. */
@@ -402,8 +497,8 @@ record_btrace_print_conf (const struct btrace_config *conf)
/* The to_info_record method of target record-btrace. */
-static void
-record_btrace_info (struct target_ops *self)
+void
+record_btrace_target::info_record ()
{
struct btrace_thread_info *btinfo;
const struct btrace_config *conf;
@@ -418,7 +513,7 @@ record_btrace_info (struct target_ops *self)
btinfo = &tp->btrace;
- conf = btrace_conf (btinfo);
+ conf = ::btrace_conf (btinfo);
if (conf != NULL)
record_btrace_print_conf (conf);
@@ -781,8 +876,8 @@ btrace_insn_history (struct ui_out *uiout,
/* The to_insn_history method of target record-btrace. */
-static void
-record_btrace_insn_history (struct target_ops *self, int size, int flags)
+void
+record_btrace_target::insn_history (int size, int flags)
{
struct btrace_thread_info *btinfo;
struct btrace_insn_history *history;
@@ -867,9 +962,8 @@ record_btrace_insn_history (struct target_ops *self, int size, int flags)
/* The to_insn_history_range method of target record-btrace. */
-static void
-record_btrace_insn_history_range (struct target_ops *self,
- ULONGEST from, ULONGEST to, int flags)
+void
+record_btrace_target::insn_history_range (ULONGEST from, ULONGEST to, int flags)
{
struct btrace_thread_info *btinfo;
struct btrace_insn_history *history;
@@ -920,9 +1014,8 @@ record_btrace_insn_history_range (struct target_ops *self,
/* The to_insn_history_from method of target record-btrace. */
-static void
-record_btrace_insn_history_from (struct target_ops *self,
- ULONGEST from, int size, int flags)
+void
+record_btrace_target::insn_history_from (ULONGEST from, int size, int flags)
{
ULONGEST begin, end, context;
@@ -949,7 +1042,7 @@ record_btrace_insn_history_from (struct target_ops *self,
end = ULONGEST_MAX;
}
- record_btrace_insn_history_range (self, begin, end, flags);
+ insn_history_range (begin, end, flags);
}
/* Print the instruction number range for a function call history line. */
@@ -1141,8 +1234,8 @@ btrace_call_history (struct ui_out *uiout,
/* The to_call_history method of target record-btrace. */
-static void
-record_btrace_call_history (struct target_ops *self, int size, int int_flags)
+void
+record_btrace_target::call_history (int size, int int_flags)
{
struct btrace_thread_info *btinfo;
struct btrace_call_history *history;
@@ -1231,10 +1324,9 @@ record_btrace_call_history (struct target_ops *self, int size, int int_flags)
/* The to_call_history_range method of target record-btrace. */
-static void
-record_btrace_call_history_range (struct target_ops *self,
- ULONGEST from, ULONGEST to,
- int int_flags)
+void
+record_btrace_target::call_history_range (ULONGEST from, ULONGEST to,
+ int int_flags)
{
struct btrace_thread_info *btinfo;
struct btrace_call_history *history;
@@ -1286,10 +1378,9 @@ record_btrace_call_history_range (struct target_ops *self,
/* The to_call_history_from method of target record-btrace. */
-static void
-record_btrace_call_history_from (struct target_ops *self,
- ULONGEST from, int size,
- int int_flags)
+void
+record_btrace_target::call_history_from (ULONGEST from, int size,
+ int int_flags)
{
ULONGEST begin, end, context;
record_print_flags flags = (enum record_print_flag) int_flags;
@@ -1317,13 +1408,13 @@ record_btrace_call_history_from (struct target_ops *self,
end = ULONGEST_MAX;
}
- record_btrace_call_history_range (self, begin, end, flags);
+ call_history_range ( begin, end, flags);
}
/* The to_record_is_replaying method of target record-btrace. */
-static int
-record_btrace_is_replaying (struct target_ops *self, ptid_t ptid)
+int
+record_btrace_target::record_is_replaying (ptid_t ptid)
{
struct thread_info *tp;
@@ -1336,26 +1427,24 @@ record_btrace_is_replaying (struct target_ops *self, ptid_t ptid)
/* The to_record_will_replay method of target record-btrace. */
-static int
-record_btrace_will_replay (struct target_ops *self, ptid_t ptid, int dir)
+int
+record_btrace_target::record_will_replay (ptid_t ptid, int dir)
{
- return dir == EXEC_REVERSE || record_btrace_is_replaying (self, ptid);
+ return dir == EXEC_REVERSE || record_is_replaying (ptid);
}
/* The to_xfer_partial method of target record-btrace. */
-static enum target_xfer_status
-record_btrace_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+record_btrace_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
- struct target_ops *t;
-
/* Filter out requests that don't make sense during replay. */
if (replay_memory_access == replay_memory_access_read_only
&& !record_btrace_generating_corefile
- && record_btrace_is_replaying (ops, inferior_ptid))
+ && record_is_replaying (inferior_ptid))
{
switch (object)
{
@@ -1371,7 +1460,7 @@ record_btrace_xfer_partial (struct target_ops *ops, enum target_object object,
}
/* We allow reading readonly memory. */
- section = target_section_by_addr (ops, offset);
+ section = target_section_by_addr (this, offset);
if (section != NULL)
{
/* Check if the section we found is readonly. */
@@ -1392,17 +1481,15 @@ record_btrace_xfer_partial (struct target_ops *ops, enum target_object object,
}
/* Forward the request. */
- ops = ops->beneath;
- return ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return this->beneath->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
/* The to_insert_breakpoint method of target record-btrace. */
-static int
-record_btrace_insert_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
+int
+record_btrace_target::insert_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
const char *old;
int ret;
@@ -1415,7 +1502,7 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
ret = 0;
TRY
{
- ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+ ret = this->beneath->insert_breakpoint (gdbarch, bp_tgt);
}
CATCH (except, RETURN_MASK_ALL)
{
@@ -1430,11 +1517,10 @@ record_btrace_insert_breakpoint (struct target_ops *ops,
/* The to_remove_breakpoint method of target record-btrace. */
-static int
-record_btrace_remove_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt,
- enum remove_bp_reason reason)
+int
+record_btrace_target::remove_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt,
+ enum remove_bp_reason reason)
{
const char *old;
int ret;
@@ -1447,8 +1533,7 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
ret = 0;
TRY
{
- ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch, bp_tgt,
- reason);
+ ret = this->beneath->remove_breakpoint (gdbarch, bp_tgt, reason);
}
CATCH (except, RETURN_MASK_ALL)
{
@@ -1463,9 +1548,8 @@ record_btrace_remove_breakpoint (struct target_ops *ops,
/* The to_fetch_registers method of target record-btrace. */
-static void
-record_btrace_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+record_btrace_target::fetch_registers (struct regcache *regcache, int regno)
{
struct btrace_insn_iterator *replay;
struct thread_info *tp;
@@ -1495,45 +1579,35 @@ record_btrace_fetch_registers (struct target_ops *ops,
regcache_raw_supply (regcache, regno, &insn->pc);
}
else
- {
- struct target_ops *t = ops->beneath;
-
- t->to_fetch_registers (t, regcache, regno);
- }
+ this->beneath->fetch_registers (regcache, regno);
}
/* The to_store_registers method of target record-btrace. */
-static void
-record_btrace_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+record_btrace_target::store_registers (struct regcache *regcache, int regno)
{
struct target_ops *t;
if (!record_btrace_generating_corefile
- && record_btrace_is_replaying (ops, inferior_ptid))
+ && record_is_replaying (inferior_ptid))
error (_("Cannot write registers while replaying."));
gdb_assert (may_write_registers != 0);
- t = ops->beneath;
- t->to_store_registers (t, regcache, regno);
+ this->beneath->store_registers (regcache, regno);
}
/* The to_prepare_to_store method of target record-btrace. */
-static void
-record_btrace_prepare_to_store (struct target_ops *ops,
- struct regcache *regcache)
+void
+record_btrace_target::prepare_to_store (struct regcache *regcache)
{
- struct target_ops *t;
-
if (!record_btrace_generating_corefile
- && record_btrace_is_replaying (ops, inferior_ptid))
+ && record_is_replaying (inferior_ptid))
return;
- t = ops->beneath;
- t->to_prepare_to_store (t, regcache);
+ this->beneath->prepare_to_store (regcache);
}
/* The branch trace frame cache. */
@@ -1845,16 +1919,16 @@ const struct frame_unwind record_btrace_tailcall_frame_unwind =
/* Implement the to_get_unwinder method. */
-static const struct frame_unwind *
-record_btrace_to_get_unwinder (struct target_ops *self)
+const struct frame_unwind *
+record_btrace_target::get_unwinder ()
{
return &record_btrace_frame_unwind;
}
/* Implement the to_get_tailcall_unwinder method. */
-static const struct frame_unwind *
-record_btrace_to_get_tailcall_unwinder (struct target_ops *self)
+const struct frame_unwind *
+record_btrace_target::get_tailcall_unwinder ()
{
return &record_btrace_tailcall_frame_unwind;
}
@@ -2075,38 +2149,36 @@ record_btrace_stop_replaying_at_end (struct thread_info *tp)
/* The to_resume method of target record-btrace. */
-static void
-record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step,
- enum gdb_signal signal)
+void
+record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
struct thread_info *tp;
enum btrace_thread_flag flag, cflag;
DEBUG ("resume %s: %s%s", target_pid_to_str (ptid),
- execution_direction == EXEC_REVERSE ? "reverse-" : "",
+ ::execution_direction == EXEC_REVERSE ? "reverse-" : "",
step ? "step" : "cont");
/* Store the execution direction of the last resume.
If there is more than one to_resume call, we have to rely on infrun
to not change the execution direction in-between. */
- record_btrace_resume_exec_dir = execution_direction;
+ record_btrace_resume_exec_dir = ::execution_direction;
/* As long as we're not replaying, just forward the request.
For non-stop targets this means that no thread is replaying. In order to
make progress, we may need to explicitly move replaying threads to the end
of their execution history. */
- if ((execution_direction != EXEC_REVERSE)
- && !record_btrace_is_replaying (ops, minus_one_ptid))
+ if ((::execution_direction != EXEC_REVERSE)
+ && !record_is_replaying (minus_one_ptid))
{
- ops = ops->beneath;
- ops->to_resume (ops, ptid, step, signal);
+ this->beneath->resume (ptid, step, signal);
return;
}
/* Compute the btrace thread flag for the requested move. */
- if (execution_direction == EXEC_REVERSE)
+ if (::execution_direction == EXEC_REVERSE)
{
flag = step == 0 ? BTHR_RCONT : BTHR_RSTEP;
cflag = BTHR_RCONT;
@@ -2469,9 +2541,9 @@ record_btrace_maybe_mark_async_event (const VEC (tp_t) *moving,
/* The to_wait method of target record-btrace. */
-static ptid_t
-record_btrace_wait (struct target_ops *ops, ptid_t ptid,
- struct target_waitstatus *status, int options)
+ptid_t
+record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
+ int options)
{
VEC (tp_t) *moving, *no_history;
struct thread_info *tp, *eventing;
@@ -2480,11 +2552,10 @@ 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 ((execution_direction != EXEC_REVERSE)
- && !record_btrace_is_replaying (ops, minus_one_ptid))
+ if ((::execution_direction != EXEC_REVERSE)
+ && !record_is_replaying (minus_one_ptid))
{
- ops = ops->beneath;
- return ops->to_wait (ops, ptid, status, options);
+ return this->beneath->wait (ptid, status, options);
}
moving = NULL;
@@ -2604,17 +2675,16 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid,
/* The to_stop method of target record-btrace. */
-static void
-record_btrace_stop (struct target_ops *ops, ptid_t ptid)
+void
+record_btrace_target::stop (ptid_t ptid)
{
DEBUG ("stop %s", target_pid_to_str (ptid));
/* As long as we're not replaying, just forward the request. */
- if ((execution_direction != EXEC_REVERSE)
- && !record_btrace_is_replaying (ops, minus_one_ptid))
+ if ((::execution_direction != EXEC_REVERSE)
+ && !record_is_replaying (minus_one_ptid))
{
- ops = ops->beneath;
- ops->to_stop (ops, ptid);
+ this->beneath->stop (ptid);
}
else
{
@@ -2631,92 +2701,90 @@ record_btrace_stop (struct target_ops *ops, ptid_t ptid)
/* The to_can_execute_reverse method of target record-btrace. */
-static int
-record_btrace_can_execute_reverse (struct target_ops *self)
+int
+record_btrace_target::can_execute_reverse ()
{
return 1;
}
/* The to_stopped_by_sw_breakpoint method of target record-btrace. */
-static int
-record_btrace_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+record_btrace_target::stopped_by_sw_breakpoint ()
{
- if (record_btrace_is_replaying (ops, minus_one_ptid))
+ if (record_is_replaying (minus_one_ptid))
{
struct thread_info *tp = inferior_thread ();
return tp->btrace.stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT;
}
- return ops->beneath->to_stopped_by_sw_breakpoint (ops->beneath);
+ return this->beneath->stopped_by_sw_breakpoint ();
}
/* The to_supports_stopped_by_sw_breakpoint method of target
record-btrace. */
-static int
-record_btrace_supports_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+record_btrace_target::supports_stopped_by_sw_breakpoint ()
{
- if (record_btrace_is_replaying (ops, minus_one_ptid))
+ if (record_is_replaying (minus_one_ptid))
return 1;
- return ops->beneath->to_supports_stopped_by_sw_breakpoint (ops->beneath);
+ return this->beneath->supports_stopped_by_sw_breakpoint ();
}
/* The to_stopped_by_sw_breakpoint method of target record-btrace. */
-static int
-record_btrace_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+record_btrace_target::stopped_by_hw_breakpoint ()
{
- if (record_btrace_is_replaying (ops, minus_one_ptid))
+ if (record_is_replaying (minus_one_ptid))
{
struct thread_info *tp = inferior_thread ();
return tp->btrace.stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT;
}
- return ops->beneath->to_stopped_by_hw_breakpoint (ops->beneath);
+ return this->beneath->stopped_by_hw_breakpoint ();
}
/* The to_supports_stopped_by_hw_breakpoint method of target
record-btrace. */
-static int
-record_btrace_supports_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+record_btrace_target::supports_stopped_by_hw_breakpoint ()
{
- if (record_btrace_is_replaying (ops, minus_one_ptid))
+ if (record_is_replaying (minus_one_ptid))
return 1;
- return ops->beneath->to_supports_stopped_by_hw_breakpoint (ops->beneath);
+ return this->beneath->supports_stopped_by_hw_breakpoint ();
}
/* The to_update_thread_list method of target record-btrace. */
-static void
-record_btrace_update_thread_list (struct target_ops *ops)
+void
+record_btrace_target::update_thread_list ()
{
/* We don't add or remove threads during replay. */
- if (record_btrace_is_replaying (ops, minus_one_ptid))
+ if (record_is_replaying (minus_one_ptid))
return;
/* Forward the request. */
- ops = ops->beneath;
- ops->to_update_thread_list (ops);
+ this->beneath->update_thread_list ();
}
/* The to_thread_alive method of target record-btrace. */
-static int
-record_btrace_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+record_btrace_target::thread_alive (ptid_t ptid)
{
/* We don't add or remove threads during replay. */
- if (record_btrace_is_replaying (ops, minus_one_ptid))
+ if (record_is_replaying (minus_one_ptid))
return find_thread_ptid (ptid) != NULL;
/* Forward the request. */
- ops = ops->beneath;
- return ops->to_thread_alive (ops, ptid);
+ return this->beneath->thread_alive (ptid);
}
/* Set the replay branch trace instruction iterator. If IT is NULL, replay
@@ -2752,8 +2820,8 @@ record_btrace_set_replay (struct thread_info *tp,
/* The to_goto_record_begin method of target record-btrace. */
-static void
-record_btrace_goto_begin (struct target_ops *self)
+void
+record_btrace_target::goto_record_begin ()
{
struct thread_info *tp;
struct btrace_insn_iterator begin;
@@ -2766,8 +2834,8 @@ record_btrace_goto_begin (struct target_ops *self)
/* The to_goto_record_end method of target record-btrace. */
-static void
-record_btrace_goto_end (struct target_ops *ops)
+void
+record_btrace_target::goto_record_end ()
{
struct thread_info *tp;
@@ -2778,8 +2846,8 @@ record_btrace_goto_end (struct target_ops *ops)
/* The to_goto_record method of target record-btrace. */
-static void
-record_btrace_goto (struct target_ops *self, ULONGEST insn)
+void
+record_btrace_target::goto_record (ULONGEST insn)
{
struct thread_info *tp;
struct btrace_insn_iterator it;
@@ -2803,8 +2871,8 @@ record_btrace_goto (struct target_ops *self, ULONGEST insn)
/* The to_record_stop_replaying method of target record-btrace. */
-static void
-record_btrace_stop_replaying_all (struct target_ops *self)
+void
+record_btrace_target::record_stop_replaying ()
{
struct thread_info *tp;
@@ -2814,87 +2882,28 @@ record_btrace_stop_replaying_all (struct target_ops *self)
/* The to_execution_direction target method. */
-static enum exec_direction_kind
-record_btrace_execution_direction (struct target_ops *self)
+enum exec_direction_kind
+record_btrace_target::execution_direction ()
{
return record_btrace_resume_exec_dir;
}
/* The to_prepare_to_generate_core target method. */
-static void
-record_btrace_prepare_to_generate_core (struct target_ops *self)
+void
+record_btrace_target::prepare_to_generate_core ()
{
record_btrace_generating_corefile = 1;
}
/* The to_done_generating_core target method. */
-static void
-record_btrace_done_generating_core (struct target_ops *self)
+void
+record_btrace_target::done_generating_core ()
{
record_btrace_generating_corefile = 0;
}
-/* Initialize the record-btrace target ops. */
-
-static void
-init_record_btrace_ops (void)
-{
- struct target_ops *ops;
-
- ops = &record_btrace_ops;
- ops->to_shortname = "record-btrace";
- ops->to_longname = "Branch tracing target";
- ops->to_doc = "Collect control-flow trace and provide the execution history.";
- ops->to_open = record_btrace_open;
- ops->to_close = record_btrace_close;
- ops->to_async = record_btrace_async;
- ops->to_detach = record_detach;
- ops->to_disconnect = record_btrace_disconnect;
- ops->to_mourn_inferior = record_mourn_inferior;
- ops->to_kill = record_kill;
- ops->to_stop_recording = record_btrace_stop_recording;
- ops->to_info_record = record_btrace_info;
- ops->to_insn_history = record_btrace_insn_history;
- ops->to_insn_history_from = record_btrace_insn_history_from;
- ops->to_insn_history_range = record_btrace_insn_history_range;
- ops->to_call_history = record_btrace_call_history;
- ops->to_call_history_from = record_btrace_call_history_from;
- ops->to_call_history_range = record_btrace_call_history_range;
- ops->to_record_is_replaying = record_btrace_is_replaying;
- ops->to_record_will_replay = record_btrace_will_replay;
- ops->to_record_stop_replaying = record_btrace_stop_replaying_all;
- ops->to_xfer_partial = record_btrace_xfer_partial;
- ops->to_remove_breakpoint = record_btrace_remove_breakpoint;
- ops->to_insert_breakpoint = record_btrace_insert_breakpoint;
- ops->to_fetch_registers = record_btrace_fetch_registers;
- ops->to_store_registers = record_btrace_store_registers;
- ops->to_prepare_to_store = record_btrace_prepare_to_store;
- ops->to_get_unwinder = &record_btrace_to_get_unwinder;
- ops->to_get_tailcall_unwinder = &record_btrace_to_get_tailcall_unwinder;
- ops->to_resume = record_btrace_resume;
- ops->to_wait = record_btrace_wait;
- ops->to_stop = record_btrace_stop;
- ops->to_update_thread_list = record_btrace_update_thread_list;
- ops->to_thread_alive = record_btrace_thread_alive;
- ops->to_goto_record_begin = record_btrace_goto_begin;
- ops->to_goto_record_end = record_btrace_goto_end;
- ops->to_goto_record = record_btrace_goto;
- ops->to_can_execute_reverse = record_btrace_can_execute_reverse;
- ops->to_stopped_by_sw_breakpoint = record_btrace_stopped_by_sw_breakpoint;
- ops->to_supports_stopped_by_sw_breakpoint
- = record_btrace_supports_stopped_by_sw_breakpoint;
- ops->to_stopped_by_hw_breakpoint = record_btrace_stopped_by_hw_breakpoint;
- ops->to_supports_stopped_by_hw_breakpoint
- = record_btrace_supports_stopped_by_hw_breakpoint;
- ops->to_execution_direction = record_btrace_execution_direction;
- ops->to_prepare_to_generate_core = record_btrace_prepare_to_generate_core;
- ops->to_done_generating_core = record_btrace_done_generating_core;
- ops->to_stratum = record_stratum;
- ops->to_magic = OPS_MAGIC;
-}
-
/* Start recording in BTS format. */
static void
@@ -3152,8 +3161,8 @@ to see the actual buffer size."), NULL, show_record_pt_buffer_size_value,
&set_record_btrace_pt_cmdlist,
&show_record_btrace_pt_cmdlist);
- init_record_btrace_ops ();
- add_target (&record_btrace_ops);
+ the_record_btrace_target = new record_btrace_target ();
+ add_target (the_record_btrace_target);
bfcache = htab_create_alloc (50, bfcache_hash, bfcache_eq, NULL,
xcalloc, xfree);
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 37773159a68..cabd2ba78ae 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -61,7 +61,7 @@
#define DEFAULT_RECORD_FULL_INSN_MAX_NUM 200000
#define RECORD_FULL_IS_REPLAY \
- (record_full_list->next || execution_direction == EXEC_REVERSE)
+ (record_full_list->next || ::execution_direction == EXEC_REVERSE)
#define RECORD_FULL_FILE_MAGIC netorder32(0x20091016)
@@ -205,8 +205,139 @@ static unsigned int record_full_insn_num = 0;
static ULONGEST record_full_insn_count;
/* The target_ops of process record. */
-static struct target_ops record_full_ops;
-static struct target_ops record_full_core_ops;
+
+class record_full_base_target : public target_ops
+{
+public:
+ record_full_base_target ();
+
+ const char *shortname () OVERRIDE = 0;
+
+ const char *longname () OVERRIDE
+ { return _("Process record and replay target"); }
+
+ const char *doc () OVERRIDE
+ { return _("Log program while executing and replay execution from log."); }
+
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
+ void async (int) OVERRIDE;
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+ int stopped_by_watchpoint () OVERRIDE;
+ int stopped_data_address (CORE_ADDR *) OVERRIDE;
+
+ int stopped_by_sw_breakpoint () OVERRIDE;
+ int supports_stopped_by_sw_breakpoint () OVERRIDE;
+
+ int stopped_by_hw_breakpoint () OVERRIDE;
+ int supports_stopped_by_hw_breakpoint () OVERRIDE;
+
+ int can_execute_reverse () OVERRIDE;
+
+ /* Add bookmark target methods. */
+ gdb_byte *get_bookmark (const char *, int) OVERRIDE;
+ void goto_bookmark (const gdb_byte *, int) OVERRIDE;
+ enum exec_direction_kind execution_direction () OVERRIDE;
+ void info_record () OVERRIDE;
+ void save_record (const char *filename) OVERRIDE;
+ void delete_record () OVERRIDE;
+ int record_is_replaying (ptid_t ptid) OVERRIDE;
+ int record_will_replay (ptid_t ptid, int dir) OVERRIDE;
+ void record_stop_replaying () OVERRIDE;
+ void goto_record_begin () OVERRIDE;
+ void goto_record_end () OVERRIDE;
+ void goto_record (ULONGEST insn) OVERRIDE;
+};
+
+class record_full_target : public record_full_base_target
+{
+public:
+ const char *shortname () OVERRIDE
+ { return "record-full"; }
+
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+ void disconnect (const char *, int) OVERRIDE;
+ void detach (const char *, int) OVERRIDE;
+ void mourn_inferior () OVERRIDE;
+ void kill () OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+ int insert_breakpoint (struct gdbarch *,
+ struct bp_target_info *) OVERRIDE;
+ int remove_breakpoint (struct gdbarch *,
+ struct bp_target_info *,
+ enum remove_bp_reason) OVERRIDE;
+};
+
+class record_full_core_target : public record_full_base_target
+{
+public:
+ const char *shortname () OVERRIDE
+ { return "record-core"; }
+
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+ void disconnect (const char *, int) OVERRIDE;
+ void kill () OVERRIDE;
+ void fetch_registers (struct regcache *regcache, int regno) OVERRIDE;
+ void prepare_to_store (struct regcache *regcache) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+ int insert_breakpoint (struct gdbarch *,
+ struct bp_target_info *) OVERRIDE;
+ int remove_breakpoint (struct gdbarch *,
+ struct bp_target_info *,
+ enum remove_bp_reason) OVERRIDE;
+
+ int has_execution (ptid_t) OVERRIDE;
+};
+
+static record_full_target *the_record_full_target;
+static record_full_core_target *the_record_full_core_target;
+
+record_full_base_target::record_full_base_target ()
+{
+ to_stratum = record_stratum;
+}
+
+void
+record_full_target::detach (const char *args, int from_tty)
+{
+ record_detach (this, args, from_tty);
+}
+
+void
+record_full_target::disconnect (const char *args, int from_tty)
+{
+ record_disconnect (this, args, from_tty);
+}
+
+void
+record_full_core_target::disconnect (const char *args, int from_tty)
+{
+ record_disconnect (this, args, from_tty);
+}
+
+void
+record_full_target::mourn_inferior ()
+{
+ record_mourn_inferior (this);
+}
+
+void
+record_full_target::kill ()
+{
+ record_kill (this);
+}
/* See record-full.h. */
@@ -216,8 +347,8 @@ record_full_is_used (void)
struct target_ops *t;
t = find_record_target ();
- return (t == &record_full_ops
- || t == &record_full_core_ops);
+ return (t == the_record_full_target
+ || t == the_record_full_core_target);
}
@@ -230,8 +361,6 @@ 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 (struct target_ops *self,
- const char *recfilename);
/* Alloc and free functions for record_full_reg, record_full_mem, and
record_full_end entries. */
@@ -811,7 +940,7 @@ record_full_core_open_1 (const char *name, int from_tty)
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
}
- push_target (&record_full_core_ops);
+ push_target (the_record_full_core_target);
record_full_restore ();
}
@@ -834,15 +963,15 @@ record_full_open_1 (const char *name, int from_tty)
error (_("Process record: the current architecture doesn't support "
"record function."));
- push_target (&record_full_ops);
+ push_target (the_record_full_target);
}
static void record_full_init_record_breakpoints (void);
/* "to_open" target method. Open the process record target. */
-static void
-record_full_open (const char *name, int from_tty)
+void
+record_full_base_target::open (const char *name, int from_tty)
{
struct target_ops *t;
@@ -874,8 +1003,8 @@ record_full_open (const char *name, int from_tty)
/* "to_close" target method. Close the process record target. */
-static void
-record_full_close (struct target_ops *self)
+void
+record_full_base_target::close ()
{
struct record_full_core_buf_entry *entry;
@@ -909,15 +1038,15 @@ record_full_close (struct target_ops *self)
/* "to_async" target method. */
-static void
-record_full_async (struct target_ops *ops, int enable)
+void
+record_full_base_target::async (int enable)
{
if (enable)
mark_async_event_handler (record_full_async_inferior_event_token);
else
clear_async_event_handler (record_full_async_inferior_event_token);
- ops->beneath->to_async (ops->beneath, enable);
+ beneath->async (enable);
}
static int record_full_resume_step = 0;
@@ -945,13 +1074,12 @@ static enum exec_direction_kind record_full_execution_dir = EXEC_FORWARD;
/* "to_resume" target method. Resume the process record target. */
-static void
-record_full_resume (struct target_ops *ops, ptid_t ptid, int step,
- enum gdb_signal signal)
+void
+record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
record_full_resume_step = step;
record_full_resumed = 1;
- record_full_execution_dir = execution_direction;
+ record_full_execution_dir = ::execution_direction;
if (!RECORD_FULL_IS_REPLAY)
{
@@ -993,7 +1121,7 @@ record_full_resume (struct target_ops *ops, ptid_t ptid, int step,
/* Make sure the target beneath reports all signals. */
target_pass_signals (0, NULL);
- ops->beneath->to_resume (ops->beneath, ptid, step, signal);
+ this->beneath->resume (ptid, step, signal);
}
/* We are about to start executing the inferior (or simulate it),
@@ -1075,12 +1203,12 @@ record_full_wait_1 (struct target_ops *ops,
record_full_stop_reason = TARGET_STOPPED_BY_NO_REASON;
- if (!RECORD_FULL_IS_REPLAY && ops != &record_full_core_ops)
+ if (!RECORD_FULL_IS_REPLAY && ops != the_record_full_core_target)
{
if (record_full_resume_step)
{
/* This is a single step. */
- return ops->beneath->to_wait (ops->beneath, ptid, status, options);
+ return ops->beneath->wait (ptid, status, options);
}
else
{
@@ -1093,7 +1221,7 @@ record_full_wait_1 (struct target_ops *ops,
{
struct thread_info *tp;
- ret = ops->beneath->to_wait (ops->beneath, ptid, status, options);
+ ret = ops->beneath->wait (ptid, status, options);
if (status->kind == TARGET_WAITKIND_IGNORE)
{
if (record_debug)
@@ -1170,8 +1298,7 @@ record_full_wait_1 (struct target_ops *ops,
"Process record: record_full_wait "
"issuing one more step in the "
"target beneath\n");
- ops->beneath->to_resume (ops->beneath, ptid, step,
- GDB_SIGNAL_0);
+ ops->beneath->resume (ptid, step, GDB_SIGNAL_0);
continue;
}
}
@@ -1336,14 +1463,13 @@ replay_out:
return inferior_ptid;
}
-static ptid_t
-record_full_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *status,
- int options)
+ptid_t
+record_full_base_target::wait (ptid_t ptid, struct target_waitstatus *status,
+ int options)
{
ptid_t return_ptid;
- return_ptid = record_full_wait_1 (ops, ptid, status, options);
+ return_ptid = record_full_wait_1 (this, ptid, status, options);
if (status->kind != TARGET_WAITKIND_IGNORE)
{
/* We're reporting a stop. Make sure any spurious
@@ -1354,28 +1480,28 @@ record_full_wait (struct target_ops *ops,
return return_ptid;
}
-static int
-record_full_stopped_by_watchpoint (struct target_ops *ops)
+int
+record_full_base_target::stopped_by_watchpoint ()
{
if (RECORD_FULL_IS_REPLAY)
return record_full_stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
else
- return ops->beneath->to_stopped_by_watchpoint (ops->beneath);
+ return beneath->stopped_by_watchpoint ();
}
-static int
-record_full_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
+int
+record_full_base_target::stopped_data_address (CORE_ADDR *addr_p)
{
if (RECORD_FULL_IS_REPLAY)
return 0;
else
- return ops->beneath->to_stopped_data_address (ops->beneath, addr_p);
+ return this->beneath->stopped_data_address (addr_p);
}
/* The to_stopped_by_sw_breakpoint method of target record-full. */
-static int
-record_full_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+record_full_base_target::stopped_by_sw_breakpoint ()
{
return record_full_stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT;
}
@@ -1383,16 +1509,16 @@ record_full_stopped_by_sw_breakpoint (struct target_ops *ops)
/* The to_supports_stopped_by_sw_breakpoint method of target
record-full. */
-static int
-record_full_supports_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+record_full_base_target::supports_stopped_by_sw_breakpoint ()
{
return 1;
}
/* The to_stopped_by_hw_breakpoint method of target record-full. */
-static int
-record_full_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+record_full_base_target::stopped_by_hw_breakpoint ()
{
return record_full_stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT;
}
@@ -1400,8 +1526,8 @@ record_full_stopped_by_hw_breakpoint (struct target_ops *ops)
/* The to_supports_stopped_by_sw_breakpoint method of target
record-full. */
-static int
-record_full_supports_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+record_full_base_target::supports_stopped_by_hw_breakpoint ()
{
return 1;
}
@@ -1455,10 +1581,8 @@ record_full_registers_change (struct regcache *regcache, int regnum)
/* "to_store_registers" method for process record target. */
-static void
-record_full_store_registers (struct target_ops *ops,
- struct regcache *regcache,
- int regno)
+void
+record_full_target::store_registers (struct regcache *regcache, int regno)
{
if (!record_full_gdb_operation_disable)
{
@@ -1506,7 +1630,7 @@ record_full_store_registers (struct target_ops *ops,
record_full_registers_change (regcache, regno);
}
- ops->beneath->to_store_registers (ops->beneath, regcache, regno);
+ this->beneath->store_registers (regcache, regno);
}
/* "to_xfer_partial" method. Behavior is conditional on
@@ -1514,11 +1638,11 @@ record_full_store_registers (struct target_ops *ops,
In replay mode, we cannot write memory unles we are willing to
invalidate the record/replay log from this point forward. */
-static enum target_xfer_status
-record_full_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+record_full_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
if (!record_full_gdb_operation_disable
&& (object == TARGET_OBJECT_MEMORY
@@ -1571,9 +1695,8 @@ record_full_xfer_partial (struct target_ops *ops, enum target_object object,
record_full_insn_num++;
}
- return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
- readbuf, writebuf, offset,
- len, xfered_len);
+ return this->beneath->xfer_partial (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
}
/* This structure represents a breakpoint inserted while the record
@@ -1635,10 +1758,9 @@ record_full_init_record_breakpoints (void)
insert or remove breakpoints in the real target when replaying, nor
when recording. */
-static int
-record_full_insert_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
+int
+record_full_target::insert_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
struct record_full_breakpoint *bp;
int in_target_beneath = 0;
@@ -1655,7 +1777,7 @@ record_full_insert_breakpoint (struct target_ops *ops,
int ret;
old_cleanups = record_full_gdb_operation_disable_set ();
- ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
+ ret = this->beneath->insert_breakpoint (gdbarch, bp_tgt);
do_cleanups (old_cleanups);
if (ret != 0)
@@ -1700,11 +1822,10 @@ record_full_insert_breakpoint (struct target_ops *ops,
/* "to_remove_breakpoint" method for process record target. */
-static int
-record_full_remove_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt,
- enum remove_bp_reason reason)
+int
+record_full_target::remove_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt,
+ enum remove_bp_reason reason)
{
struct record_full_breakpoint *bp;
int ix;
@@ -1723,8 +1844,7 @@ record_full_remove_breakpoint (struct target_ops *ops,
int ret;
old_cleanups = record_full_gdb_operation_disable_set ();
- ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch,
- bp_tgt, reason);
+ ret = this->beneath->remove_breakpoint (gdbarch, bp_tgt, reason);
do_cleanups (old_cleanups);
if (ret != 0)
@@ -1745,17 +1865,16 @@ record_full_remove_breakpoint (struct target_ops *ops,
/* "to_can_execute_reverse" method for process record target. */
-static int
-record_full_can_execute_reverse (struct target_ops *self)
+int
+record_full_base_target::can_execute_reverse ()
{
return 1;
}
/* "to_get_bookmark" method for process record and prec over core. */
-static gdb_byte *
-record_full_get_bookmark (struct target_ops *self, const char *args,
- int from_tty)
+gdb_byte *
+record_full_base_target::get_bookmark (const char *args, int from_tty)
{
char *ret = NULL;
@@ -1777,9 +1896,9 @@ record_full_get_bookmark (struct target_ops *self, const char *args,
/* "to_goto_bookmark" method for process record and prec over core. */
-static void
-record_full_goto_bookmark (struct target_ops *self,
- const gdb_byte *raw_bookmark, int from_tty)
+void
+record_full_base_target::goto_bookmark (const gdb_byte *raw_bookmark,
+ int from_tty)
{
const char *bookmark = (const char *) raw_bookmark;
struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
@@ -1806,14 +1925,14 @@ record_full_goto_bookmark (struct target_ops *self,
do_cleanups (cleanup);
}
-static enum exec_direction_kind
-record_full_execution_direction (struct target_ops *self)
+enum exec_direction_kind
+record_full_base_target::execution_direction ()
{
return record_full_execution_dir;
}
-static void
-record_full_info (struct target_ops *self)
+void
+record_full_base_target::info_record ()
{
struct record_full_entry *p;
@@ -1856,26 +1975,26 @@ record_full_info (struct target_ops *self)
record_full_insn_max_num);
}
-/* The "to_record_delete" target method. */
+/* The "to_delete_record" target method. */
-static void
-record_full_delete (struct target_ops *self)
+void
+record_full_base_target::delete_record ()
{
record_full_list_release_following (record_full_list);
}
/* The "to_record_is_replaying" target method. */
-static int
-record_full_is_replaying (struct target_ops *self, ptid_t ptid)
+int
+record_full_base_target::record_is_replaying (ptid_t ptid)
{
return RECORD_FULL_IS_REPLAY;
}
/* The "to_record_will_replay" target method. */
-static int
-record_full_will_replay (struct target_ops *self, ptid_t ptid, int dir)
+int
+record_full_base_target::record_will_replay (ptid_t ptid, int dir)
{
/* We can currently only record when executing forwards. Should we be able
to record when executing backwards on targets that support reverse
@@ -1914,8 +2033,8 @@ record_full_goto_entry (struct record_full_entry *p)
/* The "to_goto_record_begin" target method. */
-static void
-record_full_goto_begin (struct target_ops *self)
+void
+record_full_base_target::goto_record_begin ()
{
struct record_full_entry *p = NULL;
@@ -1928,8 +2047,8 @@ record_full_goto_begin (struct target_ops *self)
/* The "to_goto_record_end" target method. */
-static void
-record_full_goto_end (struct target_ops *self)
+void
+record_full_base_target::goto_record_end ()
{
struct record_full_entry *p = NULL;
@@ -1944,8 +2063,8 @@ record_full_goto_end (struct target_ops *self)
/* The "to_goto_record" target method. */
-static void
-record_full_goto (struct target_ops *self, ULONGEST target_insn)
+void
+record_full_base_target::goto_record (ULONGEST target_insn)
{
struct record_full_entry *p = NULL;
@@ -1958,69 +2077,21 @@ record_full_goto (struct target_ops *self, ULONGEST target_insn)
/* The "to_record_stop_replaying" target method. */
-static void
-record_full_stop_replaying (struct target_ops *self)
+void
+record_full_base_target::record_stop_replaying ()
{
- record_full_goto_end (self);
-}
-
-static void
-init_record_full_ops (void)
-{
- record_full_ops.to_shortname = "record-full";
- record_full_ops.to_longname = "Process record and replay target";
- record_full_ops.to_doc =
- "Log program while executing and replay execution from log.";
- record_full_ops.to_open = record_full_open;
- record_full_ops.to_close = record_full_close;
- record_full_ops.to_async = record_full_async;
- record_full_ops.to_resume = record_full_resume;
- record_full_ops.to_wait = record_full_wait;
- record_full_ops.to_disconnect = record_disconnect;
- record_full_ops.to_detach = record_detach;
- record_full_ops.to_mourn_inferior = record_mourn_inferior;
- record_full_ops.to_kill = record_kill;
- record_full_ops.to_store_registers = record_full_store_registers;
- record_full_ops.to_xfer_partial = record_full_xfer_partial;
- record_full_ops.to_insert_breakpoint = record_full_insert_breakpoint;
- record_full_ops.to_remove_breakpoint = record_full_remove_breakpoint;
- record_full_ops.to_stopped_by_watchpoint = record_full_stopped_by_watchpoint;
- record_full_ops.to_stopped_data_address = record_full_stopped_data_address;
- record_full_ops.to_stopped_by_sw_breakpoint
- = record_full_stopped_by_sw_breakpoint;
- record_full_ops.to_supports_stopped_by_sw_breakpoint
- = record_full_supports_stopped_by_sw_breakpoint;
- record_full_ops.to_stopped_by_hw_breakpoint
- = record_full_stopped_by_hw_breakpoint;
- record_full_ops.to_supports_stopped_by_hw_breakpoint
- = record_full_supports_stopped_by_hw_breakpoint;
- record_full_ops.to_can_execute_reverse = record_full_can_execute_reverse;
- record_full_ops.to_stratum = record_stratum;
- /* Add bookmark target methods. */
- record_full_ops.to_get_bookmark = record_full_get_bookmark;
- record_full_ops.to_goto_bookmark = record_full_goto_bookmark;
- record_full_ops.to_execution_direction = record_full_execution_direction;
- record_full_ops.to_info_record = record_full_info;
- record_full_ops.to_save_record = record_full_save;
- record_full_ops.to_delete_record = record_full_delete;
- record_full_ops.to_record_is_replaying = record_full_is_replaying;
- record_full_ops.to_record_will_replay = record_full_will_replay;
- record_full_ops.to_record_stop_replaying = record_full_stop_replaying;
- record_full_ops.to_goto_record_begin = record_full_goto_begin;
- record_full_ops.to_goto_record_end = record_full_goto_end;
- record_full_ops.to_goto_record = record_full_goto;
- record_full_ops.to_magic = OPS_MAGIC;
+ goto_record_end ();
}
/* "to_resume" method for prec over corefile. */
-static void
-record_full_core_resume (struct target_ops *ops, ptid_t ptid, int step,
- enum gdb_signal signal)
+void
+record_full_core_target::resume (ptid_t ptid, int step,
+ enum gdb_signal signal)
{
record_full_resume_step = step;
record_full_resumed = 1;
- record_full_execution_dir = execution_direction;
+ record_full_execution_dir = ::execution_direction;
/* We are about to start executing the inferior (or simulate it),
let's register it with the event loop. */
@@ -2030,21 +2101,20 @@ record_full_core_resume (struct target_ops *ops, ptid_t ptid, int step,
/* "to_kill" method for prec over corefile. */
-static void
-record_full_core_kill (struct target_ops *ops)
+void
+record_full_core_target::kill ()
{
if (record_debug)
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_core_kill\n");
- unpush_target (&record_full_core_ops);
+ unpush_target (this);
}
/* "to_fetch_registers" method for prec over corefile. */
-static void
-record_full_core_fetch_registers (struct target_ops *ops,
- struct regcache *regcache,
- int regno)
+void
+record_full_core_target::fetch_registers (struct regcache *regcache,
+ int regno)
{
if (regno < 0)
{
@@ -2062,18 +2132,16 @@ 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 target_ops *self,
- struct regcache *regcache)
+void
+record_full_core_target::prepare_to_store (struct regcache *regcache)
{
}
/* "to_store_registers" method for prec over corefile. */
-static void
-record_full_core_store_registers (struct target_ops *ops,
- struct regcache *regcache,
- int regno)
+void
+record_full_core_target::store_registers (struct regcache *regcache,
+ int regno)
{
if (record_full_gdb_operation_disable)
regcache_raw_collect (regcache, regno,
@@ -2084,12 +2152,11 @@ record_full_core_store_registers (struct target_ops *ops,
/* "to_xfer_partial" method for prec over corefile. */
-static enum target_xfer_status
-record_full_core_xfer_partial (struct target_ops *ops,
- enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+enum target_xfer_status
+record_full_core_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
if (object == TARGET_OBJECT_MEMORY)
{
@@ -2153,11 +2220,10 @@ record_full_core_xfer_partial (struct target_ops *ops,
else
{
if (!entry)
- return ops->beneath->to_xfer_partial (ops->beneath,
- object, annex,
- readbuf, writebuf,
- offset, len,
- xfered_len);
+ return this->beneath->xfer_partial (object, annex,
+ readbuf, writebuf,
+ offset, len,
+ xfered_len);
memcpy (readbuf, entry->buf + sec_offset,
(size_t) len);
@@ -2174,92 +2240,38 @@ record_full_core_xfer_partial (struct target_ops *ops,
error (_("You can't do that without a process to debug."));
}
- return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
+ return this->beneath->xfer_partial (object, annex,
+ readbuf, writebuf, offset, len,
+ xfered_len);
}
/* "to_insert_breakpoint" method for prec over corefile. */
-static int
-record_full_core_insert_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
+int
+record_full_core_target::insert_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
return 0;
}
/* "to_remove_breakpoint" method for prec over corefile. */
-static int
-record_full_core_remove_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt,
- enum remove_bp_reason reason)
+int
+record_full_core_target::remove_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt,
+ enum remove_bp_reason reason)
{
return 0;
}
/* "to_has_execution" method for prec over corefile. */
-static int
-record_full_core_has_execution (struct target_ops *ops, ptid_t the_ptid)
+int
+record_full_core_target::has_execution (ptid_t the_ptid)
{
return 1;
}
-static void
-init_record_full_core_ops (void)
-{
- record_full_core_ops.to_shortname = "record-core";
- record_full_core_ops.to_longname = "Process record and replay target";
- record_full_core_ops.to_doc =
- "Log program while executing and replay execution from log.";
- record_full_core_ops.to_open = record_full_open;
- record_full_core_ops.to_close = record_full_close;
- record_full_core_ops.to_async = record_full_async;
- record_full_core_ops.to_resume = record_full_core_resume;
- record_full_core_ops.to_wait = record_full_wait;
- record_full_core_ops.to_kill = record_full_core_kill;
- record_full_core_ops.to_fetch_registers = record_full_core_fetch_registers;
- record_full_core_ops.to_prepare_to_store = record_full_core_prepare_to_store;
- record_full_core_ops.to_store_registers = record_full_core_store_registers;
- record_full_core_ops.to_xfer_partial = record_full_core_xfer_partial;
- record_full_core_ops.to_insert_breakpoint
- = record_full_core_insert_breakpoint;
- record_full_core_ops.to_remove_breakpoint
- = record_full_core_remove_breakpoint;
- record_full_core_ops.to_stopped_by_watchpoint
- = record_full_stopped_by_watchpoint;
- record_full_core_ops.to_stopped_data_address
- = record_full_stopped_data_address;
- record_full_core_ops.to_stopped_by_sw_breakpoint
- = record_full_stopped_by_sw_breakpoint;
- record_full_core_ops.to_supports_stopped_by_sw_breakpoint
- = record_full_supports_stopped_by_sw_breakpoint;
- record_full_core_ops.to_stopped_by_hw_breakpoint
- = record_full_stopped_by_hw_breakpoint;
- record_full_core_ops.to_supports_stopped_by_hw_breakpoint
- = record_full_supports_stopped_by_hw_breakpoint;
- record_full_core_ops.to_can_execute_reverse
- = record_full_can_execute_reverse;
- record_full_core_ops.to_has_execution = record_full_core_has_execution;
- record_full_core_ops.to_stratum = record_stratum;
- /* Add bookmark target methods. */
- record_full_core_ops.to_get_bookmark = record_full_get_bookmark;
- record_full_core_ops.to_goto_bookmark = record_full_goto_bookmark;
- record_full_core_ops.to_execution_direction
- = record_full_execution_direction;
- record_full_core_ops.to_info_record = record_full_info;
- record_full_core_ops.to_delete_record = record_full_delete;
- record_full_core_ops.to_record_is_replaying = record_full_is_replaying;
- record_full_core_ops.to_record_will_replay = record_full_will_replay;
- record_full_core_ops.to_goto_record_begin = record_full_goto_begin;
- record_full_core_ops.to_goto_record_end = record_full_goto_end;
- record_full_core_ops.to_goto_record = record_full_goto;
- record_full_core_ops.to_magic = OPS_MAGIC;
-}
-
/* Record log save-file format
Version 1 (never released)
@@ -2543,7 +2555,7 @@ static void
cmd_record_full_restore (char *args, int from_tty)
{
core_file_command (args, from_tty);
- record_full_open (args, from_tty);
+ the_record_full_target->open (args, from_tty);
}
static void
@@ -2560,8 +2572,8 @@ record_full_save_cleanups (void *data)
/* Save the execution log to a file. We use a modified elf corefile
format, with an extra section for our data. */
-static void
-record_full_save (struct target_ops *self, const char *recfilename)
+void
+record_full_base_target::save_record (const char *recfilename)
{
struct record_full_entry *cur_record_full_list;
uint32_t magic;
@@ -2847,11 +2859,11 @@ _initialize_record_full (void)
record_full_first.next = NULL;
record_full_first.type = record_full_end;
- init_record_full_ops ();
- add_target (&record_full_ops);
- add_deprecated_target_alias (&record_full_ops, "record");
- init_record_full_core_ops ();
- add_target (&record_full_core_ops);
+ the_record_full_target = new record_full_target ();
+ add_target (the_record_full_target);
+ add_deprecated_target_alias (the_record_full_target, "record");
+ the_record_full_core_target = new record_full_core_target ();
+ add_target (the_record_full_core_target);
add_prefix_cmd ("full", class_obscure, cmd_record_full_start,
_("Start full execution recording."), &record_full_cmdlist,
diff --git a/gdb/record.c b/gdb/record.c
index 1af134f68fe..e5b984b4ce7 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -112,9 +112,9 @@ record_read_memory (struct gdbarch *gdbarch,
static void
record_stop (struct target_ops *t)
{
- DEBUG ("stop %s", t->to_shortname);
+ DEBUG ("stop %s", t->shortname ());
- t->to_stop_recording (t);
+ t->stop_recording ();
}
/* Unpush the record target. */
@@ -122,7 +122,7 @@ record_stop (struct target_ops *t)
static void
record_unpush (struct target_ops *t)
{
- DEBUG ("unpush %s", t->to_shortname);
+ DEBUG ("unpush %s", t->shortname ());
unpush_target (t);
}
@@ -134,7 +134,7 @@ record_disconnect (struct target_ops *t, const char *args, int from_tty)
{
gdb_assert (t->to_stratum == record_stratum);
- DEBUG ("disconnect %s", t->to_shortname);
+ DEBUG ("disconnect %s", t->shortname ());
record_stop (t);
record_unpush (t);
@@ -149,7 +149,7 @@ record_detach (struct target_ops *t, const char *args, int from_tty)
{
gdb_assert (t->to_stratum == record_stratum);
- DEBUG ("detach %s", t->to_shortname);
+ DEBUG ("detach %s", t->shortname ());
record_stop (t);
record_unpush (t);
@@ -164,7 +164,7 @@ record_mourn_inferior (struct target_ops *t)
{
gdb_assert (t->to_stratum == record_stratum);
- DEBUG ("mourn inferior %s", t->to_shortname);
+ DEBUG ("mourn inferior %s", t->shortname ());
/* It is safer to not stop recording. Resources will be freed when
threads are discarded. */
@@ -180,7 +180,7 @@ record_kill (struct target_ops *t)
{
gdb_assert (t->to_stratum == record_stratum);
- DEBUG ("kill %s", t->to_shortname);
+ DEBUG ("kill %s", t->shortname ());
/* It is safer to not stop recording. Resources will be freed when
threads are discarded. */
@@ -303,8 +303,8 @@ info_record_command (char *args, int from_tty)
return;
}
- printf_filtered (_("Active record target: %s\n"), t->to_shortname);
- t->to_info_record (t);
+ printf_filtered (_("Active record target: %s\n"), t->shortname ());
+ t->info_record ();
}
/* The "record save" command. */
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 11d36eb6591..14e01cdf473 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -69,36 +69,82 @@ static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list);
static void gdb_os_error (host_callback *, const char *, ...)
ATTRIBUTE_NORETURN;
-static void gdbsim_kill (struct target_ops *);
+void simulator_command (char *args, int from_tty);
-static void gdbsim_load (struct target_ops *self, const char *prog,
- int fromtty);
+/* Naming convention:
-static void gdbsim_open (const char *args, int from_tty);
+ sim_* are the interface to the simulator (see remote-sim.h).
+ gdbsim_* are stuff which is internal to gdb. */
-static void gdbsim_close (struct target_ops *self);
+struct gdbsim_target
+ : public memory_breakpoint_target<target_ops>
+{
+ gdbsim_target ()
+ {
+ to_stratum = process_stratum;
+ }
-static void gdbsim_detach (struct target_ops *ops, const char *args,
- int from_tty);
+ const char *shortname () OVERRIDE
+ { return "sim"; }
-static void gdbsim_prepare_to_store (struct target_ops *self,
- struct regcache *regcache);
+ const char *longname () OVERRIDE
+ { return _("simulator"); }
-static void gdbsim_files_info (struct target_ops *target);
+ const char *doc () OVERRIDE
+ {
+ return _("Use the compiled-in simulator.");
+ }
-static void gdbsim_mourn_inferior (struct target_ops *target);
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
-static void gdbsim_interrupt (struct target_ops *self, ptid_t ptid);
+ void detach (const char *, int) OVERRIDE;
-void simulator_command (char *args, int from_tty);
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
-/* Naming convention:
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+ void prepare_to_store (struct regcache *) OVERRIDE;
- sim_* are the interface to the simulator (see remote-sim.h).
- gdbsim_* are stuff which is internal to gdb. */
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ void files_info () OVERRIDE;
+
+ void kill () OVERRIDE;
+
+ void load (const char *, int) OVERRIDE;
+
+ bool can_create_inferior () OVERRIDE { return true; }
+ void create_inferior (char *, char *, char **, int) OVERRIDE;
-/* Forward data declarations */
-extern struct target_ops gdbsim_ops;
+ void mourn_inferior () OVERRIDE;
+
+ void interrupt (ptid_t) OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ int has_all_memory () OVERRIDE;
+ int has_memory () OVERRIDE;
+
+ int has_stack () OVERRIDE
+ { return default_child_has_stack (); }
+
+ int has_registers () OVERRIDE
+ { return default_child_has_registers (); }
+
+ int has_execution (ptid_t ptid) OVERRIDE
+ { return default_child_has_execution (ptid); }
+};
+
+static struct gdbsim_target gdbsim_ops;
static const struct inferior_data *sim_inferior_data_key;
@@ -424,9 +470,8 @@ one2one_register_sim_regno (struct gdbarch *gdbarch, int regnum)
return regnum;
}
-static void
-gdbsim_fetch_register (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+gdbsim_target::fetch_registers (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct sim_inferior_data *sim_data
@@ -435,7 +480,7 @@ gdbsim_fetch_register (struct target_ops *ops,
if (regno == -1)
{
for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
- gdbsim_fetch_register (ops, regcache, regno);
+ fetch_registers (regcache, regno);
return;
}
@@ -500,9 +545,8 @@ gdbsim_fetch_register (struct target_ops *ops,
}
-static void
-gdbsim_store_register (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+gdbsim_target::store_registers (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct sim_inferior_data *sim_data
@@ -511,7 +555,7 @@ gdbsim_store_register (struct target_ops *ops,
if (regno == -1)
{
for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
- gdbsim_store_register (ops, regcache, regno);
+ store_registers (regcache, regno);
return;
}
else if (gdbarch_register_sim_regno (gdbarch, regno) >= 0)
@@ -546,8 +590,8 @@ gdbsim_store_register (struct target_ops *ops,
/* Kill the running program. This may involve closing any open files
and releasing other resources acquired by the simulated program. */
-static void
-gdbsim_kill (struct target_ops *ops)
+void
+gdbsim_target::kill ()
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "gdbsim_kill\n");
@@ -561,8 +605,8 @@ gdbsim_kill (struct target_ops *ops)
not only bring new code into the target process, but also to update
GDB's symbol tables to match. */
-static void
-gdbsim_load (struct target_ops *self, const char *args, int fromtty)
+void
+gdbsim_target::load (const char *args, int fromtty)
{
char **argv;
const char *prog;
@@ -604,9 +648,9 @@ gdbsim_load (struct target_ops *self, const char *args, int fromtty)
/* This is called not only when we first attach, but also when the
user types "run" after having attached. */
-static void
-gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args,
- char **env, int from_tty)
+void
+gdbsim_target::create_inferior (char *exec_file, char *args,
+ char **env, int from_tty)
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
@@ -625,7 +669,7 @@ gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args,
args);
if (ptid_equal (inferior_ptid, sim_data->remote_sim_ptid))
- gdbsim_kill (target);
+ kill ();
remove_breakpoints ();
init_wait_for_inferior ();
@@ -665,8 +709,8 @@ gdbsim_create_inferior (struct target_ops *target, char *exec_file, char *args,
Targets should supply this routine, if only to provide an error message. */
/* Called when selecting the simulator. E.g. (gdb) target sim name. */
-static void
-gdbsim_open (const char *args, int from_tty)
+void
+gdbsim_target::open (const char *args, int from_tty)
{
int len;
char *arg_buf;
@@ -793,8 +837,8 @@ gdbsim_close_inferior (struct inferior *inf, void *arg)
/* Close out all files and local state before this target loses control. */
-static void
-gdbsim_close (struct target_ops *self)
+void
+gdbsim_target::close ()
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
@@ -824,13 +868,13 @@ gdbsim_close (struct target_ops *self)
/* Terminate the open connection to the remote debugger.
Use this when you want to detach and do something else with your gdb. */
-static void
-gdbsim_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+gdbsim_target::detach (const char *args, int from_tty)
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "gdbsim_detach: args \"%s\"\n", args);
- unpush_target (ops); /* calls gdbsim_close to do the real work */
+ unpush_target (this); /* calls gdbsim_close to do the real work */
if (from_tty)
printf_filtered ("Ending simulator %s debugging\n", target_shortname);
}
@@ -869,9 +913,8 @@ gdbsim_resume_inferior (struct inferior *inf, void *arg)
return 0;
}
-static void
-gdbsim_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal siggnal)
+void
+gdbsim_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
{
struct resume_data rd;
struct sim_inferior_data *sim_data
@@ -924,8 +967,8 @@ gdbsim_interrupt_inferior (struct inferior *inf, void *arg)
return 0;
}
-static void
-gdbsim_interrupt (struct target_ops *self, ptid_t ptid)
+void
+gdbsim_target::interrupt (ptid_t ptid)
{
struct sim_inferior_data *sim_data;
@@ -966,12 +1009,11 @@ gdb_os_poll_quit (host_callback *p)
static void
gdbsim_cntrl_c (int signo)
{
- gdbsim_interrupt (NULL, minus_one_ptid);
+ gdbsim_ops.interrupt (minus_one_ptid);
}
-static ptid_t
-gdbsim_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *status, int options)
+ptid_t
+gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status, int options)
{
struct sim_inferior_data *sim_data;
static sighandler_t prev_sigint;
@@ -1055,8 +1097,8 @@ gdbsim_wait (struct target_ops *ops,
that registers contains all the registers from the program being
debugged. */
-static void
-gdbsim_prepare_to_store (struct target_ops *self, struct regcache *regcache)
+void
+gdbsim_target::prepare_to_store (struct regcache *regcache)
{
/* Do nothing, since we can store individual regs. */
}
@@ -1076,7 +1118,7 @@ gdbsim_xfer_memory (struct target_ops *target,
/* If this target doesn't have memory yet, return 0 causing the
request to be passed to a lower target, hopefully an exec
file. */
- if (!target->to_has_memory (target))
+ if (!target->has_memory ())
return TARGET_XFER_EOF;
if (!sim_data->program_loaded)
@@ -1124,16 +1166,16 @@ gdbsim_xfer_memory (struct target_ops *target,
/* Target to_xfer_partial implementation. */
-static enum target_xfer_status
-gdbsim_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+enum target_xfer_status
+gdbsim_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
case TARGET_OBJECT_MEMORY:
- return gdbsim_xfer_memory (ops, readbuf, writebuf, offset, len,
+ return gdbsim_xfer_memory (this, readbuf, writebuf, offset, len,
xfered_len);
default:
@@ -1141,8 +1183,8 @@ gdbsim_xfer_partial (struct target_ops *ops, enum target_object object,
}
}
-static void
-gdbsim_files_info (struct target_ops *target)
+void
+gdbsim_target::files_info ()
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
@@ -1164,8 +1206,8 @@ gdbsim_files_info (struct target_ops *target)
/* Clear the simulator's notion of what the break points are. */
-static void
-gdbsim_mourn_inferior (struct target_ops *target)
+void
+gdbsim_target::mourn_inferior ()
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
@@ -1249,8 +1291,8 @@ sim_command_completer (struct cmd_list_element *ignore, const char *text,
/* Check to see if a thread is still alive. */
-static int
-gdbsim_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+gdbsim_target::thread_alive (ptid_t ptid)
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data_by_ptid (ptid, SIM_INSTANCE_NOT_NEEDED);
@@ -1268,16 +1310,16 @@ gdbsim_thread_alive (struct target_ops *ops, ptid_t ptid)
/* Convert a thread ID to a string. Returns the string in a static
buffer. */
-static char *
-gdbsim_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+gdbsim_target::pid_to_str (ptid_t ptid)
{
return normal_pid_to_str (ptid);
}
/* Simulator memory may be accessed after the program has been loaded. */
-static int
-gdbsim_has_all_memory (struct target_ops *ops)
+int
+gdbsim_target::has_all_memory ()
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
@@ -1288,8 +1330,8 @@ gdbsim_has_all_memory (struct target_ops *ops)
return 1;
}
-static int
-gdbsim_has_memory (struct target_ops *ops)
+int
+gdbsim_target::has_memory ()
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
@@ -1300,50 +1342,11 @@ gdbsim_has_memory (struct target_ops *ops)
return 1;
}
-/* Define the target subroutine names. */
-
-struct target_ops gdbsim_ops;
-
-static void
-init_gdbsim_ops (void)
-{
- gdbsim_ops.to_shortname = "sim";
- gdbsim_ops.to_longname = "simulator";
- gdbsim_ops.to_doc = "Use the compiled-in simulator.";
- gdbsim_ops.to_open = gdbsim_open;
- gdbsim_ops.to_close = gdbsim_close;
- gdbsim_ops.to_detach = gdbsim_detach;
- gdbsim_ops.to_resume = gdbsim_resume;
- gdbsim_ops.to_wait = gdbsim_wait;
- gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
- gdbsim_ops.to_store_registers = gdbsim_store_register;
- gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
- gdbsim_ops.to_xfer_partial = gdbsim_xfer_partial;
- gdbsim_ops.to_files_info = gdbsim_files_info;
- gdbsim_ops.to_insert_breakpoint = memory_insert_breakpoint;
- gdbsim_ops.to_remove_breakpoint = memory_remove_breakpoint;
- gdbsim_ops.to_kill = gdbsim_kill;
- gdbsim_ops.to_load = gdbsim_load;
- gdbsim_ops.to_create_inferior = gdbsim_create_inferior;
- gdbsim_ops.to_mourn_inferior = gdbsim_mourn_inferior;
- gdbsim_ops.to_interrupt = gdbsim_interrupt;
- gdbsim_ops.to_thread_alive = gdbsim_thread_alive;
- gdbsim_ops.to_pid_to_str = gdbsim_pid_to_str;
- gdbsim_ops.to_stratum = process_stratum;
- gdbsim_ops.to_has_all_memory = gdbsim_has_all_memory;
- gdbsim_ops.to_has_memory = gdbsim_has_memory;
- gdbsim_ops.to_has_stack = default_child_has_stack;
- gdbsim_ops.to_has_registers = default_child_has_registers;
- gdbsim_ops.to_has_execution = default_child_has_execution;
- gdbsim_ops.to_magic = OPS_MAGIC;
-}
-
void
_initialize_remote_sim (void)
{
struct cmd_list_element *c;
- init_gdbsim_ops ();
add_target (&gdbsim_ops);
c = add_com ("sim", class_obscure, simulator_command,
diff --git a/gdb/remote.c b/gdb/remote.c
index 910ac813860..96d1330b7d3 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -72,6 +72,328 @@
#include "btrace.h"
#include "record-btrace.h"
+struct remote_target : public target_ops
+{
+ remote_target ()
+ {
+ to_stratum = process_stratum;
+ }
+
+ const char *shortname () OVERRIDE
+ { return "remote"; }
+
+ const char *longname () OVERRIDE
+ { return _("Remote serial target in gdb-specific protocol"); }
+
+ const char *doc () OVERRIDE
+ {
+ return _("\
+Use a remote computer via a serial line, using a gdb-specific protocol.\n\
+Specify the serial device it is connected to\n\
+(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).");
+ }
+
+ thread_control_capabilities get_thread_control_capabilities () OVERRIDE
+ { return tc_schedlock; }
+
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
+
+ void detach (const char *, int) OVERRIDE;
+ void disconnect (const char *, int) OVERRIDE;
+
+ void resume (ptid_t, int, enum gdb_signal) OVERRIDE;
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+ void prepare_to_store (struct regcache *) OVERRIDE;
+
+ void files_info () OVERRIDE;
+
+ int insert_breakpoint (struct gdbarch *, struct bp_target_info *) OVERRIDE;
+
+ int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
+ enum remove_bp_reason) OVERRIDE;
+
+
+ int stopped_by_sw_breakpoint () OVERRIDE;
+ int supports_stopped_by_sw_breakpoint () OVERRIDE;
+
+ int stopped_by_hw_breakpoint () OVERRIDE;
+
+ int supports_stopped_by_hw_breakpoint () OVERRIDE;
+
+ int stopped_by_watchpoint () OVERRIDE;
+
+ int stopped_data_address (CORE_ADDR *) OVERRIDE;
+
+ int watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) OVERRIDE;
+
+ int can_use_hw_breakpoint (enum bptype, int, int) OVERRIDE;
+
+ int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *) OVERRIDE;
+
+ int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) OVERRIDE;
+
+ int region_ok_for_hw_watchpoint (CORE_ADDR, int) OVERRIDE;
+
+ int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
+ struct expression *) OVERRIDE;
+
+ int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
+ struct expression *) OVERRIDE;
+
+ void kill () OVERRIDE;
+
+ void load (const char *, int) OVERRIDE;
+
+ void mourn_inferior () OVERRIDE;
+
+ void pass_signals (int, unsigned char *) OVERRIDE;
+
+ int set_syscall_catchpoint (int, int, int, int, int *) OVERRIDE;
+
+ void program_signals (int, unsigned char *) OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ const char *thread_name (struct thread_info *) OVERRIDE;
+
+ void update_thread_list () OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ char *extra_thread_info (struct thread_info *) OVERRIDE;
+
+ ptid_t get_ada_task_ptid (long lwp, long thread) OVERRIDE;
+
+ void stop (ptid_t) OVERRIDE;
+
+ void interrupt (ptid_t) OVERRIDE;
+
+ void pass_ctrlc () OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ ULONGEST get_memory_xfer_limit () OVERRIDE;
+
+ void rcmd (const char *command, struct ui_file *output) OVERRIDE;
+
+ char *pid_to_exec_file (int pid) OVERRIDE;
+
+ void log_command (const char *cmd) OVERRIDE
+ {
+ serial_log_command (this, cmd);
+ }
+
+ CORE_ADDR get_thread_local_address (ptid_t ptid,
+ CORE_ADDR load_module_addr,
+ CORE_ADDR offset) OVERRIDE;
+
+ int has_all_memory () OVERRIDE { return default_child_has_all_memory (); }
+ int has_memory () OVERRIDE { return default_child_has_memory (); }
+ int has_stack () OVERRIDE { return default_child_has_stack (); }
+ int has_registers () OVERRIDE { return default_child_has_registers (); }
+ int has_execution (ptid_t ptid) OVERRIDE { return default_child_has_execution (ptid); }
+
+ int can_execute_reverse () OVERRIDE;
+
+ VEC(mem_region_s) *memory_map () OVERRIDE;
+
+ void flash_erase (ULONGEST address, LONGEST length) OVERRIDE;
+
+ void flash_done () OVERRIDE;
+
+ const struct target_desc *read_description () OVERRIDE;
+
+ int search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp) OVERRIDE;
+
+ int can_async_p () OVERRIDE;
+
+ int is_async_p () OVERRIDE;
+
+ void async (int) OVERRIDE;
+
+ void thread_events (int) OVERRIDE;
+
+ int can_do_single_step () OVERRIDE;
+
+ void terminal_inferior () OVERRIDE;
+
+ void terminal_ours () OVERRIDE;
+
+ int supports_non_stop () OVERRIDE;
+
+ int supports_multi_process () OVERRIDE;
+
+ int supports_disable_randomization () OVERRIDE;
+
+ int filesystem_is_local () OVERRIDE;
+
+
+ int fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno) OVERRIDE;
+
+ int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, int *target_errno) OVERRIDE;
+
+ int fileio_pread (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *target_errno) OVERRIDE;
+
+ int fileio_fstat (int fd, struct stat *sb, int *target_errno) OVERRIDE;
+
+ int fileio_close (int fd, int *target_errno) OVERRIDE;
+
+ int fileio_unlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno) OVERRIDE;
+
+ char *fileio_readlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno) OVERRIDE;
+
+
+ int supports_enable_disable_tracepoint () OVERRIDE;
+
+ int supports_string_tracing () OVERRIDE;
+
+ int supports_evaluation_of_breakpoint_conditions () OVERRIDE;
+
+ int can_run_breakpoint_commands () OVERRIDE;
+
+ void trace_init () OVERRIDE;
+
+ void download_tracepoint (struct bp_location *location) OVERRIDE;
+
+ int can_download_tracepoint () OVERRIDE;
+
+ void download_trace_state_variable (struct trace_state_variable *tsv) OVERRIDE;
+
+ void enable_tracepoint (struct bp_location *location) OVERRIDE;
+
+ void disable_tracepoint (struct bp_location *location) OVERRIDE;
+
+ void trace_set_readonly_regions () OVERRIDE;
+
+ void trace_start () OVERRIDE;
+
+ int get_trace_status (struct trace_status *ts) OVERRIDE;
+
+ void get_tracepoint_status (struct breakpoint *tp, struct uploaded_tp *utp)
+ OVERRIDE;
+
+ void trace_stop () OVERRIDE;
+
+ int trace_find (enum trace_find_type type, int num,
+ CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) OVERRIDE;
+
+ int get_trace_state_variable_value (int tsv, LONGEST *val) OVERRIDE;
+
+ int save_trace_data (const char *filename) OVERRIDE;
+
+ int upload_tracepoints (struct uploaded_tp **utpp) OVERRIDE;
+
+ int upload_trace_state_variables (struct uploaded_tsv **utsvp) OVERRIDE;
+
+ LONGEST get_raw_trace_data (gdb_byte *buf, ULONGEST offset, LONGEST len) OVERRIDE;
+
+ int get_min_fast_tracepoint_insn_len () OVERRIDE;
+
+ void set_disconnected_tracing (int val) OVERRIDE;
+
+ void set_circular_trace_buffer (int val) OVERRIDE;
+
+ void set_trace_buffer_size (LONGEST val) OVERRIDE;
+
+ int set_trace_notes (const char *user, const char *notes,
+ const char *stopnotes) OVERRIDE;
+
+ int core_of_thread (ptid_t ptid) OVERRIDE;
+
+ int verify_memory (const gdb_byte *data,
+ CORE_ADDR memaddr, ULONGEST size) OVERRIDE;
+
+
+ int get_tib_address (ptid_t ptid, CORE_ADDR *addr) OVERRIDE;
+
+ void set_permissions () OVERRIDE;
+
+ int static_tracepoint_marker_at (CORE_ADDR,
+ struct static_tracepoint_marker *marker) OVERRIDE;
+
+ VEC(static_tracepoint_marker_p) *
+ static_tracepoint_markers_by_strid (const char *id) OVERRIDE;
+
+ struct traceframe_info *traceframe_info () OVERRIDE;
+
+ int use_agent (int use) OVERRIDE;
+ int can_use_agent () OVERRIDE;
+
+ int supports_btrace (enum btrace_format) OVERRIDE;
+
+ struct btrace_target_info *enable_btrace (ptid_t ptid,
+ const struct btrace_config *conf) OVERRIDE;
+
+ void disable_btrace (struct btrace_target_info *tinfo) OVERRIDE;
+
+ void teardown_btrace (struct btrace_target_info *tinfo) OVERRIDE;
+
+ enum btrace_error read_btrace (struct btrace_data *data,
+ struct btrace_target_info *btinfo,
+ enum btrace_read_type type) OVERRIDE;
+
+ const struct btrace_config *btrace_conf (const struct btrace_target_info *) OVERRIDE;
+ int augmented_libraries_svr4_read () OVERRIDE;
+ int follow_fork (int, int) OVERRIDE;
+ void follow_exec (struct inferior *, char *) OVERRIDE;
+ int insert_fork_catchpoint (int) OVERRIDE;
+ int remove_fork_catchpoint (int) OVERRIDE;
+ int insert_vfork_catchpoint (int) OVERRIDE;
+ int remove_vfork_catchpoint (int) OVERRIDE;
+ int insert_exec_catchpoint (int) OVERRIDE;
+ int remove_exec_catchpoint (int) OVERRIDE;
+ enum exec_direction_kind execution_direction () OVERRIDE;
+
+protected:
+ void open_1 (const char *name, int from_tty, int extended_p);
+ void start_remote (int from_tty, int extended_p);
+};
+
+/* Set up the extended remote target by extending the standard remote
+ target and adding to it. */
+
+class extended_remote_target : public remote_target
+{
+public:
+ const char *shortname () OVERRIDE
+ { return "extended-remote"; }
+
+ const char *longname () OVERRIDE
+ { return _("Extended remote serial target in gdb-specific protocol"); }
+
+ void open (const char *, int) OVERRIDE;
+
+ bool can_create_inferior () OVERRIDE { return true; }
+ void create_inferior (char *, char *, char **, int) OVERRIDE;
+
+ void detach (const char *, int) OVERRIDE;
+
+ bool can_attach () OVERRIDE { return true; }
+ void attach (const char *, int) OVERRIDE;
+
+ void post_attach (int) OVERRIDE;
+ int supports_disable_randomization () OVERRIDE;
+};
+
/* Temp hacks for tracepoint encoding migration. */
static char *target_buf;
static long target_buf_size;
@@ -102,42 +424,18 @@ static int getpkt_sane (char **buf, long *sizeof_buf, int forever);
static int getpkt_or_notif_sane (char **buf, long *sizeof_buf,
int forever, int *is_notif);
-static void remote_files_info (struct target_ops *ignore);
-
-static void remote_prepare_to_store (struct target_ops *self,
- struct regcache *regcache);
-
-static void remote_open_1 (const char *, int, struct target_ops *,
- int extended_p);
-
-static void remote_close (struct target_ops *self);
-
struct remote_state;
static int remote_vkill (int pid, struct remote_state *rs);
static void remote_kill_k (void);
-static void remote_mourn (struct target_ops *ops);
-
-static void extended_remote_restart (void);
-
static void remote_send (char **buf, long *sizeof_buf_p);
static int readchar (int timeout);
static void remote_serial_write (const char *str, int len);
-static void remote_kill (struct target_ops *ops);
-
-static int remote_can_async_p (struct target_ops *);
-
-static int remote_is_async_p (struct target_ops *);
-
-static void remote_async (struct target_ops *ops, int enable);
-
-static void remote_thread_events (struct target_ops *ops, int enable);
-
static void interrupt_query (void);
static void set_general_thread (struct ptid ptid);
@@ -151,12 +449,6 @@ static long read_frame (char **buf_p, long *sizeof_buf);
static int hexnumlen (ULONGEST num);
-static void init_remote_ops (void);
-
-static void init_extended_remote_ops (void);
-
-static void remote_stop (struct target_ops *self, ptid_t);
-
static int stubhex (int ch);
static int hexnumstr (char *, ULONGEST);
@@ -191,17 +483,6 @@ static void show_remote_protocol_packet_cmd (struct ui_file *file,
static char *write_ptid (char *buf, const char *endbuf, ptid_t ptid);
static ptid_t read_ptid (char *buf, char **obuf);
-static void remote_set_permissions (struct target_ops *self);
-
-static int remote_get_trace_status (struct target_ops *self,
- struct trace_status *ts);
-
-static int remote_upload_tracepoints (struct target_ops *self,
- struct uploaded_tp **utpp);
-
-static int remote_upload_trace_state_variables (struct target_ops *self,
- struct uploaded_tsv **utsvp);
-
static void remote_query_supported (void);
static void remote_check_symbols (void);
@@ -220,16 +501,10 @@ static void remove_new_fork_children (struct threads_listing_context *);
static void remote_async_inferior_event_handler (gdb_client_data);
-static void remote_terminal_ours (struct target_ops *self);
-
static int remote_read_description_p (struct target_ops *target);
static void remote_console_output (char *msg);
-static int remote_supports_cond_breakpoints (struct target_ops *self);
-
-static int remote_can_run_breakpoint_commands (struct target_ops *self);
-
static void remote_btrace_reset (void);
static void remote_btrace_maybe_reopen (void);
@@ -889,10 +1164,6 @@ packet_reg_from_pnum (struct remote_arch_state *rsa, LONGEST pnum)
return NULL;
}
-static struct target_ops remote_ops;
-
-static struct target_ops extended_remote_ops;
-
/* FIXME: cagney/1999-09-23: Even though getpkt was called with
``forever'' still use the normal timeout mechanism. This is
currently used by the ASYNC code to guarentee that target reads
@@ -1643,8 +1914,8 @@ remote_exec_event_p (struct remote_state *rs)
/* Insert fork catchpoint target routine. If fork events are enabled
then return success, nothing more to do. */
-static int
-remote_insert_fork_catchpoint (struct target_ops *ops, int pid)
+int
+remote_target::insert_fork_catchpoint (int pid)
{
struct remote_state *rs = get_remote_state ();
@@ -1654,8 +1925,8 @@ remote_insert_fork_catchpoint (struct target_ops *ops, int pid)
/* Remove fork catchpoint target routine. Nothing to do, just
return success. */
-static int
-remote_remove_fork_catchpoint (struct target_ops *ops, int pid)
+int
+remote_target::remove_fork_catchpoint (int pid)
{
return 0;
}
@@ -1663,8 +1934,8 @@ remote_remove_fork_catchpoint (struct target_ops *ops, int pid)
/* Insert vfork catchpoint target routine. If vfork events are enabled
then return success, nothing more to do. */
-static int
-remote_insert_vfork_catchpoint (struct target_ops *ops, int pid)
+int
+remote_target::insert_vfork_catchpoint (int pid)
{
struct remote_state *rs = get_remote_state ();
@@ -1674,8 +1945,8 @@ remote_insert_vfork_catchpoint (struct target_ops *ops, int pid)
/* Remove vfork catchpoint target routine. Nothing to do, just
return success. */
-static int
-remote_remove_vfork_catchpoint (struct target_ops *ops, int pid)
+int
+remote_target::remove_vfork_catchpoint (int pid)
{
return 0;
}
@@ -1683,8 +1954,8 @@ remote_remove_vfork_catchpoint (struct target_ops *ops, int pid)
/* Insert exec catchpoint target routine. If exec events are
enabled, just return success. */
-static int
-remote_insert_exec_catchpoint (struct target_ops *ops, int pid)
+int
+remote_target::insert_exec_catchpoint (int pid)
{
struct remote_state *rs = get_remote_state ();
@@ -1694,8 +1965,8 @@ remote_insert_exec_catchpoint (struct target_ops *ops, int pid)
/* Remove exec catchpoint target routine. Nothing to do, just
return success. */
-static int
-remote_remove_exec_catchpoint (struct target_ops *ops, int pid)
+int
+remote_target::remove_exec_catchpoint (int pid)
{
return 0;
}
@@ -1952,9 +2223,8 @@ record_currthread (struct remote_state *rs, ptid_t currthread)
/* If 'QPassSignals' is supported, tell the remote stub what signals
it can simply pass through to the inferior without reporting. */
-static void
-remote_pass_signals (struct target_ops *self,
- int numsigs, unsigned char *pass_signals)
+void
+remote_target::pass_signals (int numsigs, unsigned char *pass_signals)
{
if (packet_support (PACKET_QPassSignals) != PACKET_DISABLE)
{
@@ -2003,10 +2273,9 @@ remote_pass_signals (struct target_ops *self,
/* If 'QCatchSyscalls' is supported, tell the remote stub
to report syscalls to GDB. */
-static int
-remote_set_syscall_catchpoint (struct target_ops *self,
- int pid, int needed, int any_count,
- int table_size, int *table)
+int
+remote_target::set_syscall_catchpoint (int pid, int needed, int any_count,
+ int table_size, int *table)
{
char *catch_packet;
enum packet_result result;
@@ -2090,9 +2359,8 @@ remote_set_syscall_catchpoint (struct target_ops *self,
/* If 'QProgramSignals' is supported, tell the remote stub what
signals it should pass through to the inferior when detaching. */
-static void
-remote_program_signals (struct target_ops *self,
- int numsigs, unsigned char *signals)
+void
+remote_target::program_signals (int numsigs, unsigned char *signals)
{
if (packet_support (PACKET_QProgramSignals) != PACKET_DISABLE)
{
@@ -2212,7 +2480,7 @@ set_general_process (void)
to model non-threaded targets as single-threaded. */
static int
-remote_thread_always_alive (struct target_ops *ops, ptid_t ptid)
+remote_thread_always_alive (ptid_t ptid)
{
if (ptid_equal (ptid, magic_null_ptid))
/* The main thread is always alive. */
@@ -2230,15 +2498,15 @@ remote_thread_always_alive (struct target_ops *ops, ptid_t ptid)
/* Return nonzero if the thread PTID is still alive on the remote
system. */
-static int
-remote_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+remote_target::thread_alive (ptid_t ptid)
{
struct remote_state *rs = get_remote_state ();
char *p, *endp;
/* Check if this is a thread that we made up ourselves to model
non-threaded targets as single-threaded. */
- if (remote_thread_always_alive (ops, ptid))
+ if (remote_thread_always_alive (ptid))
return 1;
p = rs->buf;
@@ -2255,8 +2523,8 @@ remote_thread_alive (struct target_ops *ops, ptid_t ptid)
/* Return a pointer to a thread name if we know it and NULL otherwise.
The thread_info object owns the memory for the name. */
-static const char *
-remote_thread_name (struct target_ops *ops, struct thread_info *info)
+const char *
+remote_target::thread_name (struct thread_info *info)
{
if (info->priv != NULL)
return info->priv->name;
@@ -3203,8 +3471,8 @@ remote_get_threads_with_qthreadinfo (struct target_ops *ops,
/* Implement the to_update_thread_list function for the remote
targets. */
-static void
-remote_update_thread_list (struct target_ops *ops)
+void
+remote_target::update_thread_list ()
{
struct threads_listing_context context;
struct cleanup *old_chain;
@@ -3216,9 +3484,9 @@ remote_update_thread_list (struct target_ops *ops)
/* We have a few different mechanisms to fetch the thread list. Try
them all, starting with the most preferred one first, falling
back to older methods. */
- if (remote_get_threads_with_qxfer (ops, &context)
- || remote_get_threads_with_qthreadinfo (ops, &context)
- || remote_get_threads_with_ql (ops, &context))
+ if (remote_get_threads_with_qxfer (this, &context)
+ || remote_get_threads_with_qthreadinfo (this, &context)
+ || remote_get_threads_with_ql (this, &context))
{
int i;
struct thread_item *item;
@@ -3227,7 +3495,7 @@ remote_update_thread_list (struct target_ops *ops)
got_list = 1;
if (VEC_empty (thread_item_t, context.items)
- && remote_thread_always_alive (ops, inferior_ptid))
+ && remote_thread_always_alive (inferior_ptid))
{
/* Some targets don't really support threads, but still
reply an (empty) thread list in response to the thread
@@ -3310,8 +3578,8 @@ remote_update_thread_list (struct target_ops *ops)
* Optional: targets are not required to implement this function.
*/
-static char *
-remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
+char *
+remote_target::extra_thread_info (struct thread_info *tp)
{
struct remote_state *rs = get_remote_state ();
int result;
@@ -3391,9 +3659,9 @@ remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
}
-static int
-remote_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR addr,
- struct static_tracepoint_marker *marker)
+int
+remote_target::static_tracepoint_marker_at (CORE_ADDR addr,
+ struct static_tracepoint_marker *marker)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
@@ -3417,9 +3685,8 @@ remote_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR addr,
return 0;
}
-static VEC(static_tracepoint_marker_p) *
-remote_static_tracepoint_markers_by_strid (struct target_ops *self,
- const char *strid)
+VEC(static_tracepoint_marker_p) *
+remote_target::static_tracepoint_markers_by_strid (const char *strid)
{
struct remote_state *rs = get_remote_state ();
VEC(static_tracepoint_marker_p) *markers = NULL;
@@ -3472,8 +3739,8 @@ remote_static_tracepoint_markers_by_strid (struct target_ops *self,
/* Implement the to_get_ada_task_ptid function for the remote targets. */
-static ptid_t
-remote_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
+ptid_t
+remote_target::get_ada_task_ptid (long lwp, long thread)
{
return ptid_build (ptid_get_pid (inferior_ptid), lwp, 0);
}
@@ -3496,8 +3763,8 @@ extended_remote_restart (void)
/* Clean up connection to a remote debugger. */
-static void
-remote_close (struct target_ops *self)
+void
+remote_target::close ()
{
struct remote_state *rs = get_remote_state ();
@@ -3505,7 +3772,7 @@ remote_close (struct target_ops *self)
return; /* already closed */
/* Make sure we leave stdin registered in the event loop. */
- remote_terminal_ours (self);
+ terminal_ours ();
serial_close (rs->remote_desc);
rs->remote_desc = NULL;
@@ -4002,8 +4269,8 @@ process_initial_stop_replies (int from_tty)
/* Start the remote connection and sync state. */
-static void
-remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
+void
+remote_target::start_remote (int from_tty, int extended_p)
{
struct remote_state *rs = get_remote_state ();
struct packet_config *noack_config;
@@ -4032,7 +4299,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* If the stub wants to get a QAllow, compose one and send it. */
if (packet_support (PACKET_QAllow) != PACKET_DISABLE)
- remote_set_permissions (target);
+ set_permissions ();
/* gdbserver < 7.7 (before its fix from 2013-12-11) did reply to any
unknown 'v' packet with string "OK". "OK" gets interpreted by GDB
@@ -4097,7 +4364,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* On OSs where the list of libraries is global to all
processes, we fetch them early. */
if (gdbarch_has_global_solist (target_gdbarch ()))
- solib_add (NULL, from_tty, target, auto_solib_add);
+ solib_add (NULL, from_tty, this, auto_solib_add);
if (target_is_non_stop_p ())
{
@@ -4115,7 +4382,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
controlling. We default to adding them in the running state.
The '?' query below will then tell us about which threads are
stopped. */
- remote_update_thread_list (target);
+ this->update_thread_list ();
}
else if (packet_support (PACKET_QNonStop) == PACKET_ENABLE)
{
@@ -4131,11 +4398,11 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* Upload TSVs regardless of whether the target is running or not. The
remote stub, such as GDBserver, may have some predefined or builtin
TSVs, even if the target is not running. */
- if (remote_get_trace_status (target, current_trace_status ()) != -1)
+ if (get_trace_status (current_trace_status ()) != -1)
{
struct uploaded_tsv *uploaded_tsvs = NULL;
- remote_upload_trace_state_variables (target, &uploaded_tsvs);
+ upload_trace_state_variables (&uploaded_tsvs);
merge_uploaded_trace_state_variables (&uploaded_tsvs);
}
@@ -4215,7 +4482,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
how to do it some other way, try again. This is not
supported for non-stop; it could be, but it is tricky if
there are no stopped threads when we connect. */
- if (remote_read_description_p (target)
+ if (remote_read_description_p (this)
&& gdbarch_target_desc (target_gdbarch ()) == NULL)
{
target_clear_description ();
@@ -4227,7 +4494,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
strcpy (rs->buf, wait_status);
rs->cached_wait_status = 1;
- start_remote (from_tty); /* Initialize gdb process mechanisms. */
+ ::start_remote (from_tty); /* Initialize gdb process mechanisms. */
}
else
{
@@ -4270,7 +4537,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
gdb_assert (wait_status == NULL);
/* Report all signals during attach/startup. */
- remote_pass_signals (target, 0, NULL);
+ pass_signals (0, NULL);
/* If there are already stopped threads, mark them stopped and
report their stops before giving the prompt to the user. */
@@ -4289,14 +4556,14 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* Possibly the target has been engaged in a trace run started
previously; find out where things are at. */
- if (remote_get_trace_status (target, current_trace_status ()) != -1)
+ if (get_trace_status (current_trace_status ()) != -1)
{
struct uploaded_tp *uploaded_tps = NULL;
if (current_trace_status ()->running)
printf_filtered (_("Trace is already running on the target.\n"));
- remote_upload_tracepoints (target, &uploaded_tps);
+ upload_tracepoints (&uploaded_tps);
merge_uploaded_tracepoints (&uploaded_tps);
}
@@ -4319,19 +4586,19 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
/* Open a connection to a remote debugger.
NAME is the filename used for communication. */
-static void
-remote_open (const char *name, int from_tty)
+void
+remote_target::open (const char *name, int from_tty)
{
- remote_open_1 (name, from_tty, &remote_ops, 0);
+ open_1 (name, from_tty, 0);
}
/* Open a connection to a remote debugger using the extended
remote gdb protocol. NAME is the filename used for communication. */
-static void
-extended_remote_open (const char *name, int from_tty)
+void
+extended_remote_target::open (const char *name, int from_tty)
{
- remote_open_1 (name, from_tty, &extended_remote_ops, 1 /*extended_p */);
+ open_1 (name, from_tty, 1 /*extended_p */);
}
/* Reset all packets back to "unknown support". Called when opening a
@@ -4419,7 +4686,7 @@ remote_check_symbols (void)
instead of any data function descriptor. */
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
- &current_target);
+ target_stack);
xsnprintf (msg, get_remote_packet_size (), "qSymbol:%s:%s",
phex_nz (sym_addr, addr_size), &reply[8]);
@@ -4462,7 +4729,7 @@ remote_serial_open (const char *name)
permissions. */
void
-remote_set_permissions (struct target_ops *self)
+remote_target::set_permissions ()
{
struct remote_state *rs = get_remote_state ();
@@ -4934,9 +5201,8 @@ remote_unpush_and_throw (void)
throw_error (TARGET_CLOSE_ERROR, _("Disconnected from target."));
}
-static void
-remote_open_1 (const char *name, int from_tty,
- struct target_ops *target, int extended_p)
+void
+remote_target::open_1 (const char *name, int from_tty, int extended_p)
{
struct remote_state *rs = get_remote_state ();
@@ -5006,7 +5272,7 @@ remote_open_1 (const char *name, int from_tty,
puts_filtered (name);
puts_filtered ("\n");
}
- push_target (target); /* Switch to using remote target now. */
+ push_target (this); /* Switch to using remote target now. */
/* Register extra event sources in the event loop. */
remote_async_inferior_event_token
@@ -5077,7 +5343,7 @@ remote_open_1 (const char *name, int from_tty,
TRY
{
- remote_start_remote (from_tty, target, extended_p);
+ start_remote (from_tty, extended_p);
}
CATCH (ex, RETURN_MASK_ALL)
{
@@ -5166,14 +5432,14 @@ remote_detach_1 (const char *args, int from_tty)
}
}
-static void
-remote_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+remote_target::detach (const char *args, int from_tty)
{
remote_detach_1 (args, from_tty);
}
-static void
-extended_remote_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+extended_remote_target::detach (const char *args, int from_tty)
{
remote_detach_1 (args, from_tty);
}
@@ -5185,9 +5451,8 @@ extended_remote_detach (struct target_ops *ops, const char *args, int from_tty)
it is named remote_follow_fork in anticipation of using it for the
remote target as well. */
-static int
-remote_follow_fork (struct target_ops *ops, int follow_child,
- int detach_fork)
+int
+remote_target::follow_fork (int follow_child, int detach_fork)
{
struct remote_state *rs = get_remote_state ();
enum target_waitkind kind = inferior_thread ()->pending_follow.kind;
@@ -5223,9 +5488,8 @@ remote_follow_fork (struct target_ops *ops, int follow_child,
inferior, which may be the same as the exec'ing inferior unless
follow-exec-mode is "new". */
-static void
-remote_follow_exec (struct target_ops *ops,
- struct inferior *inf, char *execd_pathname)
+void
+remote_target::follow_exec (struct inferior *inf, char *execd_pathname)
{
/* We know that this is a target file name, so if it has the "target:"
prefix we strip it off before saving it in the program space. */
@@ -5237,8 +5501,8 @@ remote_follow_exec (struct target_ops *ops,
/* Same as remote_detach, but don't send the "D" packet; just disconnect. */
-static void
-remote_disconnect (struct target_ops *target, const char *args, int from_tty)
+void
+remote_target::disconnect (const char *args, int from_tty)
{
if (args)
error (_("Argument given to \"disconnect\" when remotely debugging."));
@@ -5246,7 +5510,7 @@ remote_disconnect (struct target_ops *target, const char *args, int from_tty)
/* Make sure we unpush even the extended remote targets. Calling
target_mourn_inferior won't unpush, and remote_mourn won't
unpush if there is more than one inferior left. */
- unpush_target (target);
+ unpush_target (this);
generic_mourn_inferior ();
if (from_tty)
@@ -5256,9 +5520,8 @@ remote_disconnect (struct target_ops *target, const char *args, int from_tty)
/* Attach to the process specified by ARGS. If FROM_TTY is non-zero,
be chatty about it. */
-static void
-extended_remote_attach (struct target_ops *target, const char *args,
- int from_tty)
+void
+extended_remote_target::attach (const char *args, int from_tty)
{
struct remote_state *rs = get_remote_state ();
int pid;
@@ -5321,7 +5584,7 @@ extended_remote_attach (struct target_ops *target, const char *args,
struct thread_info *thread;
/* Get list of threads. */
- remote_update_thread_list (target);
+ update_thread_list ();
thread = first_thread_of_process (pid);
if (thread)
@@ -5372,8 +5635,8 @@ extended_remote_attach (struct target_ops *target, const char *args,
/* Implementation of the to_post_attach method. */
-static void
-extended_remote_post_attach (struct target_ops *ops, int pid)
+void
+extended_remote_target::post_attach (int pid)
{
/* Get text, data & bss offsets. */
get_offsets ();
@@ -5638,9 +5901,8 @@ remote_vcont_resume (ptid_t ptid, int step, enum gdb_signal siggnal)
/* Tell the remote machine to resume. */
-static void
-remote_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal siggnal)
+void
+remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
{
struct remote_state *rs = get_remote_state ();
char *buf;
@@ -5658,11 +5920,11 @@ remote_resume (struct target_ops *ops,
rs->last_sent_signal = siggnal;
rs->last_sent_step = step;
- rs->last_resume_exec_dir = execution_direction;
+ rs->last_resume_exec_dir = ::execution_direction;
/* The vCont packet doesn't need to specify threads via Hc. */
/* No reverse support (yet) for vCont. */
- if (execution_direction != EXEC_REVERSE)
+ if (::execution_direction != EXEC_REVERSE)
if (remote_vcont_resume (ptid, step, siggnal))
goto done;
@@ -5677,7 +5939,7 @@ remote_resume (struct target_ops *ops,
resume_clear_thread_private_info (thread);
buf = rs->buf;
- if (execution_direction == EXEC_REVERSE)
+ if (::execution_direction == EXEC_REVERSE)
{
/* We don't pass signals to the target in reverse exec mode. */
if (info_verbose && siggnal != GDB_SIGNAL_0)
@@ -5830,8 +6092,8 @@ remote_interrupt_ns (void)
/* Implement the to_stop function for the remote targets. */
-static void
-remote_stop (struct target_ops *self, ptid_t ptid)
+void
+remote_target::stop (ptid_t ptid)
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "remote_stop called\n");
@@ -5848,8 +6110,8 @@ remote_stop (struct target_ops *self, ptid_t ptid)
/* Implement the to_interrupt function for the remote targets. */
-static void
-remote_interrupt (struct target_ops *self, ptid_t ptid)
+void
+remote_target::interrupt (ptid_t ptid)
{
struct remote_state *rs = get_remote_state ();
@@ -5864,8 +6126,8 @@ remote_interrupt (struct target_ops *self, ptid_t ptid)
/* Implement the to_pass_ctrlc function for the remote targets. */
-static void
-remote_pass_ctrlc (struct target_ops *self)
+void
+remote_target::pass_ctrlc ()
{
struct remote_state *rs = get_remote_state ();
@@ -5912,8 +6174,8 @@ interrupt_query (void)
different in that explicit transfer of ownership to/from GDB/target
is required. */
-static void
-remote_terminal_inferior (struct target_ops *self)
+void
+remote_target::terminal_inferior ()
{
/* FIXME: cagney/1999-09-27: Make calls to target_terminal_*()
idempotent. The event-loop GDB talking to an asynchronous target
@@ -5929,8 +6191,8 @@ remote_terminal_inferior (struct target_ops *self)
passed on down to the target. */
}
-static void
-remote_terminal_ours (struct target_ops *self)
+void
+remote_target::terminal_ours ()
{
/* See FIXME in remote_terminal_inferior. */
if (remote_async_terminal_ours_p)
@@ -7018,9 +7280,8 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
/* Wait until the remote machine stops, then return, storing status in
STATUS just as `wait' would. */
-static ptid_t
-remote_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *status, int options)
+ptid_t
+remote_target::wait (ptid_t ptid, struct target_waitstatus *status, int options)
{
ptid_t event_ptid;
@@ -7254,9 +7515,8 @@ set_remote_traceframe (void)
warning (_("could not set remote traceframe"));
}
-static void
-remote_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+remote_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
@@ -7305,8 +7565,8 @@ remote_fetch_registers (struct target_ops *ops,
'G' request), we have to read out the ones we don't want to change
first. */
-static void
-remote_prepare_to_store (struct target_ops *self, struct regcache *regcache)
+void
+remote_target::prepare_to_store (struct regcache *regcache)
{
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
@@ -7412,9 +7672,8 @@ store_registers_using_G (const struct regcache *regcache)
/* Store register REGNUM, or all registers if REGNUM == -1, from the contents
of the register cache buffer. FIXME: ignores errors. */
-static void
-remote_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regnum)
+void
+remote_target::store_registers (struct regcache *regcache, int regnum)
{
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
@@ -8034,9 +8293,8 @@ restore_remote_timeout (void *p)
In future, we'll need to decide on a better approach. */
static const int remote_flash_timeout = 1000;
-static void
-remote_flash_erase (struct target_ops *ops,
- ULONGEST address, LONGEST length)
+void
+remote_target::flash_erase (ULONGEST address, LONGEST length)
{
int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
int saved_remote_timeout = remote_timeout;
@@ -8080,8 +8338,8 @@ remote_flash_write (struct target_ops *ops, ULONGEST address,
return ret;
}
-static void
-remote_flash_done (struct target_ops *ops)
+void
+remote_target::flash_done ()
{
int saved_remote_timeout = remote_timeout;
int ret;
@@ -8103,8 +8361,8 @@ remote_flash_done (struct target_ops *ops)
}
}
-static void
-remote_files_info (struct target_ops *ignore)
+void
+remote_target::files_info ()
{
puts_filtered ("Debugging a target over a serial line.\n");
}
@@ -8885,8 +9143,8 @@ kill_new_fork_children (int pid, struct remote_state *rs)
/* Target hook to kill the current inferior. */
-static void
-remote_kill (struct target_ops *ops)
+void
+remote_target::kill ()
{
int res = -1;
int pid = ptid_get_pid (inferior_ptid);
@@ -8987,15 +9245,15 @@ remote_kill_k (void)
END_CATCH
}
-static void
-remote_mourn (struct target_ops *target)
+void
+remote_target::mourn_inferior ()
{
struct remote_state *rs = get_remote_state ();
/* In 'target remote' mode with one inferior, we close the connection. */
if (!rs->extended && number_of_live_inferiors () <= 1)
{
- unpush_target (target);
+ unpush_target (this);
/* remote_close takes care of doing most of the clean up. */
generic_mourn_inferior ();
@@ -9055,8 +9313,8 @@ remote_mourn (struct target_ops *target)
}
}
-static int
-extended_remote_supports_disable_randomization (struct target_ops *self)
+int
+extended_remote_target::supports_disable_randomization ()
{
return packet_support (PACKET_QDisableRandomization) == PACKET_ENABLE;
}
@@ -9147,10 +9405,9 @@ extended_remote_run (char *args)
executable file and the command line arguments, but not the
environment. */
-static void
-extended_remote_create_inferior (struct target_ops *ops,
- char *exec_file, char *args,
- char **env, int from_tty)
+void
+extended_remote_target::create_inferior (char *exec_file, char *args,
+ char **env, int from_tty)
{
int run_worked;
char *stop_reply;
@@ -9163,7 +9420,7 @@ extended_remote_create_inferior (struct target_ops *ops,
target_async (1);
/* Disable address space randomization if requested (and supported). */
- if (extended_remote_supports_disable_randomization (ops))
+ if (supports_disable_randomization ())
extended_remote_disable_randomization (disable_randomization);
/* Now restart the remote server. */
@@ -9266,10 +9523,9 @@ remote_add_target_side_commands (struct gdbarch *gdbarch,
support, we ask the remote target to do the work; on targets
which don't, we insert a traditional memory breakpoint. */
-static int
-remote_insert_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
+int
+remote_target::insert_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
/* Try the "Z" s/w breakpoint packet if it is not already disabled.
If it succeeds, then set the support to PACKET_ENABLE. If it
@@ -9301,10 +9557,10 @@ remote_insert_breakpoint (struct target_ops *ops,
p += hexnumstr (p, addr);
xsnprintf (p, endbuf - p, ",%d", bpsize);
- if (remote_supports_cond_breakpoints (ops))
+ if (supports_evaluation_of_breakpoint_conditions ())
remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
- if (remote_can_run_breakpoint_commands (ops))
+ if (can_run_breakpoint_commands ())
remote_add_target_side_commands (gdbarch, bp_tgt, p);
putpkt (rs->buf);
@@ -9329,14 +9585,13 @@ remote_insert_breakpoint (struct target_ops *ops,
throw_error (NOT_SUPPORTED_ERROR, _("\
Target doesn't support breakpoints that have target side commands."));
- return memory_insert_breakpoint (ops, gdbarch, bp_tgt);
+ return memory_insert_breakpoint (this, gdbarch, bp_tgt);
}
-static int
-remote_remove_breakpoint (struct target_ops *ops,
- struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt,
- enum remove_bp_reason reason)
+int
+remote_target::remove_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt,
+ enum remove_bp_reason reason)
{
CORE_ADDR addr = bp_tgt->placed_address;
struct remote_state *rs = get_remote_state ();
@@ -9365,7 +9620,7 @@ remote_remove_breakpoint (struct target_ops *ops,
return (rs->buf[0] == 'E');
}
- return memory_remove_breakpoint (ops, gdbarch, bp_tgt, reason);
+ return memory_remove_breakpoint (this, gdbarch, bp_tgt, reason);
}
static enum Z_packet_type
@@ -9388,9 +9643,9 @@ watchpoint_to_Z_packet (int type)
}
}
-static int
-remote_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
- enum target_hw_bp_type type, struct expression *cond)
+int
+remote_target::insert_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type, struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf + get_remote_packet_size ();
@@ -9427,9 +9682,9 @@ remote_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
_("remote_insert_watchpoint: reached end of function"));
}
-static int
-remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
- CORE_ADDR start, int length)
+int
+remote_target::watchpoint_addr_within_range (CORE_ADDR addr,
+ CORE_ADDR start, int length)
{
CORE_ADDR diff = remote_address_masked (addr - start);
@@ -9437,9 +9692,9 @@ remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
}
-static int
-remote_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
- enum target_hw_bp_type type, struct expression *cond)
+int
+remote_target::remove_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type, struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf + get_remote_packet_size ();
@@ -9479,9 +9734,8 @@ int remote_hw_watchpoint_limit = -1;
int remote_hw_watchpoint_length_limit = -1;
int remote_hw_breakpoint_limit = -1;
-static int
-remote_region_ok_for_hw_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len)
+int
+remote_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
{
if (remote_hw_watchpoint_length_limit == 0)
return 0;
@@ -9493,9 +9747,8 @@ remote_region_ok_for_hw_watchpoint (struct target_ops *self,
return 0;
}
-static int
-remote_check_watch_resources (struct target_ops *self,
- enum bptype type, int cnt, int ot)
+int
+remote_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot)
{
if (type == bp_hardware_breakpoint)
{
@@ -9522,8 +9775,8 @@ remote_check_watch_resources (struct target_ops *self,
/* The to_stopped_by_sw_breakpoint method of target remote. */
-static int
-remote_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+remote_target::stopped_by_sw_breakpoint ()
{
struct thread_info *thread = inferior_thread ();
@@ -9534,16 +9787,16 @@ remote_stopped_by_sw_breakpoint (struct target_ops *ops)
/* The to_supports_stopped_by_sw_breakpoint method of target
remote. */
-static int
-remote_supports_stopped_by_sw_breakpoint (struct target_ops *ops)
+int
+remote_target::supports_stopped_by_sw_breakpoint ()
{
return (packet_support (PACKET_swbreak_feature) == PACKET_ENABLE);
}
/* The to_stopped_by_hw_breakpoint method of target remote. */
-static int
-remote_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+remote_target::stopped_by_hw_breakpoint ()
{
struct thread_info *thread = inferior_thread ();
@@ -9554,14 +9807,14 @@ remote_stopped_by_hw_breakpoint (struct target_ops *ops)
/* The to_supports_stopped_by_hw_breakpoint method of target
remote. */
-static int
-remote_supports_stopped_by_hw_breakpoint (struct target_ops *ops)
+int
+remote_target::supports_stopped_by_hw_breakpoint ()
{
return (packet_support (PACKET_hwbreak_feature) == PACKET_ENABLE);
}
-static int
-remote_stopped_by_watchpoint (struct target_ops *ops)
+int
+remote_target::stopped_by_watchpoint ()
{
struct thread_info *thread = inferior_thread ();
@@ -9569,8 +9822,8 @@ remote_stopped_by_watchpoint (struct target_ops *ops)
&& thread->priv->stop_reason == TARGET_STOPPED_BY_WATCHPOINT);
}
-static int
-remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+int
+remote_target::stopped_data_address (CORE_ADDR *addr_p)
{
struct thread_info *thread = inferior_thread ();
@@ -9585,9 +9838,9 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
}
-static int
-remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
+int
+remote_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
CORE_ADDR addr = bp_tgt->reqstd_address;
struct remote_state *rs;
@@ -9620,10 +9873,10 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
p += hexnumstr (p, (ULONGEST) addr);
xsnprintf (p, endbuf - p, ",%x", bpsize);
- if (remote_supports_cond_breakpoints (self))
+ if (supports_evaluation_of_breakpoint_conditions ())
remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
- if (remote_can_run_breakpoint_commands (self))
+ if (can_run_breakpoint_commands ())
remote_add_target_side_commands (gdbarch, bp_tgt, p);
putpkt (rs->buf);
@@ -9651,9 +9904,9 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
}
-static int
-remote_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
+int
+remote_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
CORE_ADDR addr;
struct remote_state *rs = get_remote_state ();
@@ -9693,9 +9946,8 @@ remote_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
/* Verify memory using the "qCRC:" request. */
-static int
-remote_verify_memory (struct target_ops *ops,
- const gdb_byte *data, CORE_ADDR lma, ULONGEST size)
+int
+remote_target::verify_memory (const gdb_byte *data, CORE_ADDR lma, ULONGEST size)
{
struct remote_state *rs = get_remote_state ();
unsigned long host_crc, target_crc;
@@ -9734,7 +9986,7 @@ remote_verify_memory (struct target_ops *ops,
}
}
- return simple_verify_memory (ops, data, lma, size);
+ return simple_verify_memory (this, data, lma, size);
}
/* compare-sections command
@@ -9824,7 +10076,7 @@ the loaded file\n"));
target is returned, or -1 for error. */
static enum target_xfer_status
-remote_write_qxfer (struct target_ops *ops, const char *object_name,
+remote_write_qxfer (const char *object_name,
const char *annex, const gdb_byte *writebuf,
ULONGEST offset, LONGEST len, ULONGEST *xfered_len,
struct packet_config *packet)
@@ -9867,7 +10119,7 @@ remote_write_qxfer (struct target_ops *ops, const char *object_name,
target supports this object. */
static enum target_xfer_status
-remote_read_qxfer (struct target_ops *ops, const char *object_name,
+remote_read_qxfer (const char *object_name,
const char *annex,
gdb_byte *readbuf, ULONGEST offset, LONGEST len,
ULONGEST *xfered_len,
@@ -9947,11 +10199,11 @@ remote_read_qxfer (struct target_ops *ops, const char *object_name,
}
}
-static enum target_xfer_status
-remote_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+enum target_xfer_status
+remote_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
struct remote_state *rs;
int i;
@@ -9977,7 +10229,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
return remote_write_bytes (offset, writebuf, len, unit_size,
xfered_len);
else
- return remote_read_bytes (ops, offset, readbuf, len, unit_size,
+ return remote_read_bytes (this, offset, readbuf, len, unit_size,
xfered_len);
}
@@ -9985,11 +10237,11 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
if (object == TARGET_OBJECT_SPU)
{
if (readbuf)
- return remote_read_qxfer (ops, "spu", annex, readbuf, offset, len,
+ return remote_read_qxfer ("spu", annex, readbuf, offset, len,
xfered_len, &remote_protocol_packets
[PACKET_qXfer_spu_read]);
else
- return remote_write_qxfer (ops, "spu", annex, writebuf, offset, len,
+ return remote_write_qxfer ("spu", annex, writebuf, offset, len,
xfered_len, &remote_protocol_packets
[PACKET_qXfer_spu_write]);
}
@@ -9998,11 +10250,11 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
if (object == TARGET_OBJECT_SIGNAL_INFO)
{
if (readbuf)
- return remote_read_qxfer (ops, "siginfo", annex, readbuf, offset, len,
+ return remote_read_qxfer ("siginfo", annex, readbuf, offset, len,
xfered_len, &remote_protocol_packets
[PACKET_qXfer_siginfo_read]);
else
- return remote_write_qxfer (ops, "siginfo", annex,
+ return remote_write_qxfer ("siginfo", annex,
writebuf, offset, len, xfered_len,
&remote_protocol_packets
[PACKET_qXfer_siginfo_write]);
@@ -10011,7 +10263,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
if (object == TARGET_OBJECT_STATIC_TRACE_DATA)
{
if (readbuf)
- return remote_read_qxfer (ops, "statictrace", annex,
+ return remote_read_qxfer ("statictrace", annex,
readbuf, offset, len, xfered_len,
&remote_protocol_packets
[PACKET_qXfer_statictrace_read]);
@@ -10025,7 +10277,7 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
switch (object)
{
case TARGET_OBJECT_FLASH:
- return remote_flash_write (ops, offset, len, xfered_len,
+ return remote_flash_write (this, offset, len, xfered_len,
writebuf);
default:
@@ -10043,28 +10295,28 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
case TARGET_OBJECT_AUXV:
gdb_assert (annex == NULL);
- return remote_read_qxfer (ops, "auxv", annex, readbuf, offset, len,
+ return remote_read_qxfer ("auxv", annex, readbuf, offset, len,
xfered_len,
&remote_protocol_packets[PACKET_qXfer_auxv]);
case TARGET_OBJECT_AVAILABLE_FEATURES:
return remote_read_qxfer
- (ops, "features", annex, readbuf, offset, len, xfered_len,
+ ("features", annex, readbuf, offset, len, xfered_len,
&remote_protocol_packets[PACKET_qXfer_features]);
case TARGET_OBJECT_LIBRARIES:
return remote_read_qxfer
- (ops, "libraries", annex, readbuf, offset, len, xfered_len,
+ ("libraries", annex, readbuf, offset, len, xfered_len,
&remote_protocol_packets[PACKET_qXfer_libraries]);
case TARGET_OBJECT_LIBRARIES_SVR4:
return remote_read_qxfer
- (ops, "libraries-svr4", annex, readbuf, offset, len, xfered_len,
+ ("libraries-svr4", annex, readbuf, offset, len, xfered_len,
&remote_protocol_packets[PACKET_qXfer_libraries_svr4]);
case TARGET_OBJECT_MEMORY_MAP:
gdb_assert (annex == NULL);
- return remote_read_qxfer (ops, "memory-map", annex, readbuf, offset, len,
+ return remote_read_qxfer ("memory-map", annex, readbuf, offset, len,
xfered_len,
&remote_protocol_packets[PACKET_qXfer_memory_map]);
@@ -10072,43 +10324,43 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
/* Should only get here if we're connected. */
gdb_assert (rs->remote_desc);
return remote_read_qxfer
- (ops, "osdata", annex, readbuf, offset, len, xfered_len,
+ ("osdata", annex, readbuf, offset, len, xfered_len,
&remote_protocol_packets[PACKET_qXfer_osdata]);
case TARGET_OBJECT_THREADS:
gdb_assert (annex == NULL);
- return remote_read_qxfer (ops, "threads", annex, readbuf, offset, len,
+ return remote_read_qxfer ("threads", annex, readbuf, offset, len,
xfered_len,
&remote_protocol_packets[PACKET_qXfer_threads]);
case TARGET_OBJECT_TRACEFRAME_INFO:
gdb_assert (annex == NULL);
return remote_read_qxfer
- (ops, "traceframe-info", annex, readbuf, offset, len, xfered_len,
+ ("traceframe-info", annex, readbuf, offset, len, xfered_len,
&remote_protocol_packets[PACKET_qXfer_traceframe_info]);
case TARGET_OBJECT_FDPIC:
- return remote_read_qxfer (ops, "fdpic", annex, readbuf, offset, len,
+ return remote_read_qxfer ("fdpic", annex, readbuf, offset, len,
xfered_len,
&remote_protocol_packets[PACKET_qXfer_fdpic]);
case TARGET_OBJECT_OPENVMS_UIB:
- return remote_read_qxfer (ops, "uib", annex, readbuf, offset, len,
+ return remote_read_qxfer ("uib", annex, readbuf, offset, len,
xfered_len,
&remote_protocol_packets[PACKET_qXfer_uib]);
case TARGET_OBJECT_BTRACE:
- return remote_read_qxfer (ops, "btrace", annex, readbuf, offset, len,
+ return remote_read_qxfer ("btrace", annex, readbuf, offset, len,
xfered_len,
&remote_protocol_packets[PACKET_qXfer_btrace]);
case TARGET_OBJECT_BTRACE_CONF:
- return remote_read_qxfer (ops, "btrace-conf", annex, readbuf, offset,
+ return remote_read_qxfer ("btrace-conf", annex, readbuf, offset,
len, xfered_len,
&remote_protocol_packets[PACKET_qXfer_btrace_conf]);
case TARGET_OBJECT_EXEC_FILE:
- return remote_read_qxfer (ops, "exec-file", annex, readbuf, offset,
+ return remote_read_qxfer ("exec-file", annex, readbuf, offset,
len, xfered_len,
&remote_protocol_packets[PACKET_qXfer_exec_file]);
@@ -10162,17 +10414,16 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
/* Implementation of to_get_memory_xfer_limit. */
-static ULONGEST
-remote_get_memory_xfer_limit (struct target_ops *ops)
+ULONGEST
+remote_target::get_memory_xfer_limit ()
{
return get_memory_write_packet_size ();
}
-static int
-remote_search_memory (struct target_ops* ops,
- CORE_ADDR start_addr, ULONGEST search_space_len,
- const gdb_byte *pattern, ULONGEST pattern_len,
- CORE_ADDR *found_addrp)
+int
+remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp)
{
int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
struct remote_state *rs = get_remote_state ();
@@ -10206,7 +10457,7 @@ remote_search_memory (struct target_ops* ops,
{
/* Target doesn't provided special support, fall back and use the
standard support (copy memory and do the search here). */
- return simple_search_memory (ops, start_addr, search_space_len,
+ return simple_search_memory (this, start_addr, search_space_len,
pattern, pattern_len, found_addrp);
}
@@ -10237,7 +10488,7 @@ remote_search_memory (struct target_ops* ops,
supported. If so, fall back to the simple way. */
if (packet->support == PACKET_DISABLE)
{
- return simple_search_memory (ops, start_addr, search_space_len,
+ return simple_search_memory (this, start_addr, search_space_len,
pattern, pattern_len, found_addrp);
}
return -1;
@@ -10259,9 +10510,8 @@ remote_search_memory (struct target_ops* ops,
return found;
}
-static void
-remote_rcmd (struct target_ops *self, const char *command,
- struct ui_file *outbuf)
+void
+remote_target::rcmd (const char *command, struct ui_file *outbuf)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
@@ -10329,11 +10579,11 @@ remote_rcmd (struct target_ops *self, const char *command,
}
}
-static VEC(mem_region_s) *
-remote_memory_map (struct target_ops *ops)
+VEC(mem_region_s) *
+remote_target::memory_map ()
{
VEC(mem_region_s) *result = NULL;
- char *text = target_read_stralloc (&current_target,
+ char *text = target_read_stralloc (target_stack,
TARGET_OBJECT_MEMORY_MAP, NULL);
if (text)
@@ -10520,8 +10770,8 @@ init_remote_threadtests (void)
/* Convert a thread ID to a string. Returns the string in a static
buffer. */
-static char *
-remote_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+remote_target::pid_to_str (ptid_t ptid)
{
static char buf[64];
struct remote_state *rs = get_remote_state ();
@@ -10569,9 +10819,9 @@ remote_pid_to_str (struct target_ops *ops, ptid_t ptid)
/* Get the address of the thread local variable in OBJFILE which is
stored at OFFSET within the thread local storage for thread PTID. */
-static CORE_ADDR
-remote_get_thread_local_address (struct target_ops *ops,
- ptid_t ptid, CORE_ADDR lm, CORE_ADDR offset)
+CORE_ADDR
+remote_target::get_thread_local_address (ptid_t ptid, CORE_ADDR lm,
+ CORE_ADDR offset)
{
if (packet_support (PACKET_qGetTLSAddr) != PACKET_DISABLE)
{
@@ -10617,8 +10867,8 @@ remote_get_thread_local_address (struct target_ops *ops,
/* Provide thread local base, i.e. Thread Information Block address.
Returns 1 if ptid is found and thread_local_base is non zero. */
-static int
-remote_get_tib_address (struct target_ops *self, ptid_t ptid, CORE_ADDR *addr)
+int
+remote_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
{
if (packet_support (PACKET_qGetTIBAddr) != PACKET_DISABLE)
{
@@ -10724,8 +10974,8 @@ remote_read_description_p (struct target_ops *target)
return 0;
}
-static const struct target_desc *
-remote_read_description (struct target_ops *target)
+const struct target_desc *
+remote_target::read_description ()
{
struct remote_g_packet_data *data
= ((struct remote_g_packet_data *)
@@ -10734,7 +10984,7 @@ remote_read_description (struct target_ops *target)
/* Do not try this during initial connection, when we do not know
whether there is a running but stopped thread. */
if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid))
- return target->beneath->to_read_description (target->beneath);
+ return beneath->read_description ();
if (!VEC_empty (remote_g_packet_guess_s, data->guesses))
{
@@ -10753,7 +11003,7 @@ remote_read_description (struct target_ops *target)
an architecture, but it's too tricky to do safely. */
}
- return target->beneath->to_read_description (target->beneath);
+ return beneath->read_description ();
}
/* Remote file transfer support. This is host-initiated I/O, not
@@ -11058,6 +11308,15 @@ remote_hostio_open (struct target_ops *self,
remote_errno, NULL, NULL);
}
+int
+remote_target::fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *remote_errno)
+{
+ return remote_hostio_open (this, inf, filename, flags, mode, warn_if_slow,
+ remote_errno);
+}
+
/* Implementation of to_fileio_pwrite. */
static int
@@ -11087,6 +11346,13 @@ remote_hostio_pwrite (struct target_ops *self,
remote_errno, NULL, NULL);
}
+int
+remote_target::fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, int *remote_errno)
+{
+ return remote_hostio_pwrite (this, fd, write_buf, len, offset, remote_errno);
+}
+
/* Helper for the implementation of to_fileio_pread. Read the file
from the remote side with vFile:pread. */
@@ -11197,6 +11463,13 @@ remote_hostio_pread (struct target_ops *self,
return remote_hostio_pread_from_cache (rs, fd, read_buf, len, offset);
}
+int
+remote_target::fileio_pread (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *remote_errno)
+{
+ return remote_hostio_pread (this, fd, read_buf, len, offset, remote_errno);
+}
+
/* Implementation of to_fileio_close. */
static int
@@ -11216,6 +11489,12 @@ remote_hostio_close (struct target_ops *self, int fd, int *remote_errno)
remote_errno, NULL, NULL);
}
+int
+remote_target::fileio_close (int fd, int *remote_errno)
+{
+ return remote_hostio_close (this, fd, remote_errno);
+}
+
/* Implementation of to_fileio_unlink. */
static int
@@ -11239,12 +11518,18 @@ remote_hostio_unlink (struct target_ops *self,
remote_errno, NULL, NULL);
}
+int
+remote_target::fileio_unlink (struct inferior *inf, const char *filename,
+ int *remote_errno)
+{
+ return remote_hostio_unlink (this, inf, filename, remote_errno);
+}
+
/* Implementation of to_fileio_readlink. */
-static char *
-remote_hostio_readlink (struct target_ops *self,
- struct inferior *inf, const char *filename,
- int *remote_errno)
+char *
+remote_target::fileio_readlink (struct inferior *inf, const char *filename,
+ int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
@@ -11282,10 +11567,8 @@ remote_hostio_readlink (struct target_ops *self,
/* Implementation of to_fileio_fstat. */
-static int
-remote_hostio_fstat (struct target_ops *self,
- int fd, struct stat *st,
- int *remote_errno)
+int
+remote_target::fileio_fstat (int fd, struct stat *st, int *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf;
@@ -11342,8 +11625,8 @@ remote_hostio_fstat (struct target_ops *self,
/* Implementation of to_filesystem_is_local. */
-static int
-remote_filesystem_is_local (struct target_ops *self)
+int
+remote_target::filesystem_is_local ()
{
/* Valgrind GDB presents itself as a remote target but works
on the local filesystem: it does not implement remote get
@@ -11362,12 +11645,12 @@ remote_filesystem_is_local (struct target_ops *self)
/* Try opening a file to probe support. The supplied
filename is irrelevant, we only care about whether
the stub recognizes the packet or not. */
- fd = remote_hostio_open (self, NULL, "just probing",
+ fd = remote_hostio_open (this, NULL, "just probing",
FILEIO_O_RDONLY, 0700, 0,
&remote_errno);
if (fd >= 0)
- remote_hostio_close (self, fd, &remote_errno);
+ remote_hostio_close (this, fd, &remote_errno);
ps = packet_support (PACKET_vFile_open);
}
@@ -11695,8 +11978,8 @@ remote_command (char *args, int from_tty)
help_list (remote_cmdlist, "remote ", all_commands, gdb_stdout);
}
-static int
-remote_can_execute_reverse (struct target_ops *self)
+int
+remote_target::can_execute_reverse ()
{
if (packet_support (PACKET_bs) == PACKET_ENABLE
|| packet_support (PACKET_bc) == PACKET_ENABLE)
@@ -11705,21 +11988,21 @@ remote_can_execute_reverse (struct target_ops *self)
return 0;
}
-static int
-remote_supports_non_stop (struct target_ops *self)
+int
+remote_target::supports_non_stop ()
{
return 1;
}
-static int
-remote_supports_disable_randomization (struct target_ops *self)
+int
+remote_target::supports_disable_randomization ()
{
/* Only supported in extended mode. */
return 0;
}
-static int
-remote_supports_multi_process (struct target_ops *self)
+int
+remote_target::supports_multi_process ()
{
struct remote_state *rs = get_remote_state ();
@@ -11727,56 +12010,56 @@ remote_supports_multi_process (struct target_ops *self)
}
static int
-remote_supports_cond_tracepoints (void)
+remote_supports_cond_tracepoints ()
{
return packet_support (PACKET_ConditionalTracepoints) == PACKET_ENABLE;
}
-static int
-remote_supports_cond_breakpoints (struct target_ops *self)
+int
+remote_target::supports_evaluation_of_breakpoint_conditions ()
{
return packet_support (PACKET_ConditionalBreakpoints) == PACKET_ENABLE;
}
static int
-remote_supports_fast_tracepoints (void)
+remote_supports_fast_tracepoints ()
{
return packet_support (PACKET_FastTracepoints) == PACKET_ENABLE;
}
static int
-remote_supports_static_tracepoints (void)
+remote_supports_static_tracepoints ()
{
return packet_support (PACKET_StaticTracepoints) == PACKET_ENABLE;
}
static int
-remote_supports_install_in_trace (void)
+remote_supports_install_in_trace ()
{
return packet_support (PACKET_InstallInTrace) == PACKET_ENABLE;
}
-static int
-remote_supports_enable_disable_tracepoint (struct target_ops *self)
+int
+remote_target::supports_enable_disable_tracepoint ()
{
return (packet_support (PACKET_EnableDisableTracepoints_feature)
== PACKET_ENABLE);
}
-static int
-remote_supports_string_tracing (struct target_ops *self)
+int
+remote_target::supports_string_tracing ()
{
return packet_support (PACKET_tracenz_feature) == PACKET_ENABLE;
}
-static int
-remote_can_run_breakpoint_commands (struct target_ops *self)
+int
+remote_target::can_run_breakpoint_commands ()
{
return packet_support (PACKET_BreakpointCommands) == PACKET_ENABLE;
}
-static void
-remote_trace_init (struct target_ops *self)
+void
+remote_target::trace_init ()
{
putpkt ("QTinit");
remote_get_noisy_reply (&target_buf, &target_buf_size);
@@ -11846,8 +12129,8 @@ remote_download_command_source (int num, ULONGEST addr,
}
}
-static void
-remote_download_tracepoint (struct target_ops *self, struct bp_location *loc)
+void
+remote_target::download_tracepoint (struct bp_location *loc)
{
#define BUF_SIZE 2048
@@ -12019,8 +12302,8 @@ remote_download_tracepoint (struct target_ops *self, struct bp_location *loc)
do_cleanups (old_chain);
}
-static int
-remote_can_download_tracepoint (struct target_ops *self)
+int
+remote_target::can_download_tracepoint ()
{
struct remote_state *rs = get_remote_state ();
struct trace_status *ts;
@@ -12033,7 +12316,7 @@ remote_can_download_tracepoint (struct target_ops *self)
return 0;
ts = current_trace_status ();
- status = remote_get_trace_status (self, ts);
+ status = get_trace_status (ts);
if (status == -1 || !ts->running_known || !ts->running)
return 0;
@@ -12047,9 +12330,8 @@ remote_can_download_tracepoint (struct target_ops *self)
}
-static void
-remote_download_trace_state_variable (struct target_ops *self,
- struct trace_state_variable *tsv)
+void
+remote_target::download_trace_state_variable (struct trace_state_variable *tsv)
{
struct remote_state *rs = get_remote_state ();
char *p;
@@ -12070,9 +12352,8 @@ remote_download_trace_state_variable (struct target_ops *self,
error (_("Error on target while downloading trace state variable."));
}
-static void
-remote_enable_tracepoint (struct target_ops *self,
- struct bp_location *location)
+void
+remote_target::enable_tracepoint (struct bp_location *location)
{
struct remote_state *rs = get_remote_state ();
char addr_buf[40];
@@ -12088,9 +12369,8 @@ remote_enable_tracepoint (struct target_ops *self,
error (_("Error on target while enabling tracepoint."));
}
-static void
-remote_disable_tracepoint (struct target_ops *self,
- struct bp_location *location)
+void
+remote_target::disable_tracepoint (struct bp_location *location)
{
struct remote_state *rs = get_remote_state ();
char addr_buf[40];
@@ -12106,8 +12386,8 @@ remote_disable_tracepoint (struct target_ops *self,
error (_("Error on target while disabling tracepoint."));
}
-static void
-remote_trace_set_readonly_regions (struct target_ops *self)
+void
+remote_target::trace_set_readonly_regions ()
{
asection *s;
bfd *abfd = NULL;
@@ -12155,8 +12435,8 @@ Too many sections for read-only sections definition packet."));
}
}
-static void
-remote_trace_start (struct target_ops *self)
+void
+remote_target::trace_start ()
{
putpkt ("QTStart");
remote_get_noisy_reply (&target_buf, &target_buf_size);
@@ -12166,8 +12446,8 @@ remote_trace_start (struct target_ops *self)
error (_("Bogus reply from target: %s"), target_buf);
}
-static int
-remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
+int
+remote_target::get_trace_status (struct trace_status *ts)
{
/* Initialize it just to avoid a GCC false warning. */
char *p = NULL;
@@ -12216,9 +12496,9 @@ remote_get_trace_status (struct target_ops *self, struct trace_status *ts)
return ts->running;
}
-static void
-remote_get_tracepoint_status (struct target_ops *self, struct breakpoint *bp,
- struct uploaded_tp *utp)
+void
+remote_target::get_tracepoint_status (struct breakpoint *bp,
+ struct uploaded_tp *utp)
{
struct remote_state *rs = get_remote_state ();
char *reply;
@@ -12263,8 +12543,8 @@ remote_get_tracepoint_status (struct target_ops *self, struct breakpoint *bp,
}
}
-static void
-remote_trace_stop (struct target_ops *self)
+void
+remote_target::trace_stop ()
{
putpkt ("QTStop");
remote_get_noisy_reply (&target_buf, &target_buf_size);
@@ -12274,11 +12554,10 @@ remote_trace_stop (struct target_ops *self)
error (_("Bogus reply from target: %s"), target_buf);
}
-static int
-remote_trace_find (struct target_ops *self,
- enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2,
- int *tpp)
+int
+remote_target::trace_find (enum trace_find_type type, int num,
+ CORE_ADDR addr1, CORE_ADDR addr2,
+ int *tpp)
{
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf + get_remote_packet_size ();
@@ -12357,9 +12636,8 @@ remote_trace_find (struct target_ops *self,
return target_frameno;
}
-static int
-remote_get_trace_state_variable_value (struct target_ops *self,
- int tsvnum, LONGEST *val)
+int
+remote_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
{
struct remote_state *rs = get_remote_state ();
char *reply;
@@ -12382,8 +12660,8 @@ remote_get_trace_state_variable_value (struct target_ops *self,
return 0;
}
-static int
-remote_save_trace_data (struct target_ops *self, const char *filename)
+int
+remote_target::save_trace_data (const char *filename)
{
struct remote_state *rs = get_remote_state ();
char *p, *reply;
@@ -12409,9 +12687,8 @@ remote_save_trace_data (struct target_ops *self, const char *filename)
memory, plus we want to be able to ask for as much as possible, but
not be unhappy if we don't get as much as we ask for. */
-static LONGEST
-remote_get_raw_trace_data (struct target_ops *self,
- gdb_byte *buf, ULONGEST offset, LONGEST len)
+LONGEST
+remote_target::get_raw_trace_data (gdb_byte *buf, ULONGEST offset, LONGEST len)
{
struct remote_state *rs = get_remote_state ();
char *reply;
@@ -12448,8 +12725,8 @@ remote_get_raw_trace_data (struct target_ops *self,
return -1;
}
-static void
-remote_set_disconnected_tracing (struct target_ops *self, int val)
+void
+remote_target::set_disconnected_tracing (int val)
{
struct remote_state *rs = get_remote_state ();
@@ -12469,8 +12746,8 @@ remote_set_disconnected_tracing (struct target_ops *self, int val)
warning (_("Target does not support disconnected tracing."));
}
-static int
-remote_core_of_thread (struct target_ops *ops, ptid_t ptid)
+int
+remote_target::core_of_thread (ptid_t ptid)
{
struct thread_info *info = find_thread_ptid (ptid);
@@ -12479,8 +12756,8 @@ remote_core_of_thread (struct target_ops *ops, ptid_t ptid)
return -1;
}
-static void
-remote_set_circular_trace_buffer (struct target_ops *self, int val)
+void
+remote_target::set_circular_trace_buffer (int val)
{
struct remote_state *rs = get_remote_state ();
char *reply;
@@ -12494,12 +12771,12 @@ remote_set_circular_trace_buffer (struct target_ops *self, int val)
error (_("Bogus reply from target: %s"), reply);
}
-static struct traceframe_info *
-remote_traceframe_info (struct target_ops *self)
+struct traceframe_info *
+remote_target::traceframe_info ()
{
char *text;
- text = target_read_stralloc (&current_target,
+ text = target_read_stralloc (target_stack,
TARGET_OBJECT_TRACEFRAME_INFO, NULL);
if (text != NULL)
{
@@ -12519,8 +12796,8 @@ remote_traceframe_info (struct target_ops *self)
if the packet is not supported, and 0 if the minimum instruction
length is unknown. */
-static int
-remote_get_min_fast_tracepoint_insn_len (struct target_ops *self)
+int
+remote_target::get_min_fast_tracepoint_insn_len ()
{
struct remote_state *rs = get_remote_state ();
char *reply;
@@ -12548,8 +12825,8 @@ remote_get_min_fast_tracepoint_insn_len (struct target_ops *self)
}
}
-static void
-remote_set_trace_buffer_size (struct target_ops *self, LONGEST val)
+void
+remote_target::set_trace_buffer_size (LONGEST val)
{
if (packet_support (PACKET_QTBuffer_size) != PACKET_DISABLE)
{
@@ -12579,10 +12856,9 @@ remote_set_trace_buffer_size (struct target_ops *self, LONGEST val)
}
}
-static int
-remote_set_trace_notes (struct target_ops *self,
- const char *user, const char *notes,
- const char *stop_notes)
+int
+remote_target::set_trace_notes (const char *user, const char *notes,
+ const char *stop_notes)
{
struct remote_state *rs = get_remote_state ();
char *reply;
@@ -12626,8 +12902,8 @@ remote_set_trace_notes (struct target_ops *self,
return 1;
}
-static int
-remote_use_agent (struct target_ops *self, int use)
+int
+remote_target::use_agent (int use)
{
if (packet_support (PACKET_QAgent) != PACKET_DISABLE)
{
@@ -12640,7 +12916,7 @@ remote_use_agent (struct target_ops *self, int use)
if (strcmp (rs->buf, "OK") == 0)
{
- use_agent = use;
+ ::use_agent = use;
return 1;
}
}
@@ -12648,8 +12924,8 @@ remote_use_agent (struct target_ops *self, int use)
return 0;
}
-static int
-remote_can_use_agent (struct target_ops *self)
+int
+remote_target::can_use_agent ()
{
return (packet_support (PACKET_QAgent) != PACKET_DISABLE);
}
@@ -12675,8 +12951,8 @@ remote_btrace_reset (void)
/* Check whether the target supports branch tracing. */
-static int
-remote_supports_btrace (struct target_ops *self, enum btrace_format format)
+int
+remote_target::supports_btrace (enum btrace_format format)
{
if (packet_support (PACKET_Qbtrace_off) != PACKET_ENABLE)
return 0;
@@ -12770,7 +13046,7 @@ btrace_read_config (struct btrace_config *conf)
{
char *xml;
- xml = target_read_stralloc (&current_target,
+ xml = target_read_stralloc (target_stack,
TARGET_OBJECT_BTRACE_CONF, "");
if (xml != NULL)
{
@@ -12838,9 +13114,8 @@ remote_btrace_maybe_reopen (void)
/* Enable branch tracing. */
-static struct btrace_target_info *
-remote_enable_btrace (struct target_ops *self, ptid_t ptid,
- const struct btrace_config *conf)
+struct btrace_target_info *
+remote_target::enable_btrace (ptid_t ptid, const struct btrace_config *conf)
{
struct btrace_target_info *tinfo = NULL;
struct packet_config *packet = NULL;
@@ -12901,9 +13176,8 @@ remote_enable_btrace (struct target_ops *self, ptid_t ptid,
/* Disable branch tracing. */
-static void
-remote_disable_btrace (struct target_ops *self,
- struct btrace_target_info *tinfo)
+void
+remote_target::disable_btrace (struct btrace_target_info *tinfo)
{
struct packet_config *packet = &remote_protocol_packets[PACKET_Qbtrace_off];
struct remote_state *rs = get_remote_state ();
@@ -12934,9 +13208,8 @@ remote_disable_btrace (struct target_ops *self,
/* Teardown branch tracing. */
-static void
-remote_teardown_btrace (struct target_ops *self,
- struct btrace_target_info *tinfo)
+void
+remote_target::teardown_btrace (struct btrace_target_info *tinfo)
{
/* We must not talk to the target during teardown. */
xfree (tinfo);
@@ -12944,11 +13217,10 @@ remote_teardown_btrace (struct target_ops *self,
/* Read the branch trace. */
-static enum btrace_error
-remote_read_btrace (struct target_ops *self,
- struct btrace_data *btrace,
- struct btrace_target_info *tinfo,
- enum btrace_read_type type)
+enum btrace_error
+remote_target::read_btrace (struct btrace_data *btrace,
+ struct btrace_target_info *tinfo,
+ enum btrace_read_type type)
{
struct packet_config *packet = &remote_protocol_packets[PACKET_qXfer_btrace];
struct cleanup *cleanup;
@@ -12979,7 +13251,7 @@ remote_read_btrace (struct target_ops *self,
(unsigned int) type);
}
- xml = target_read_stralloc (&current_target,
+ xml = target_read_stralloc (target_stack,
TARGET_OBJECT_BTRACE, annex);
if (xml == NULL)
return BTRACE_ERR_UNKNOWN;
@@ -12991,15 +13263,14 @@ remote_read_btrace (struct target_ops *self,
return BTRACE_ERR_NONE;
}
-static const struct btrace_config *
-remote_btrace_conf (struct target_ops *self,
- const struct btrace_target_info *tinfo)
+const struct btrace_config *
+remote_target::btrace_conf (const struct btrace_target_info *tinfo)
{
return &tinfo->conf;
}
-static int
-remote_augmented_libraries_svr4_read (struct target_ops *self)
+int
+remote_target::augmented_libraries_svr4_read ()
{
return (packet_support (PACKET_augmented_libraries_svr4_read_feature)
== PACKET_ENABLE);
@@ -13007,8 +13278,8 @@ remote_augmented_libraries_svr4_read (struct target_ops *self)
/* Implementation of to_load. */
-static void
-remote_load (struct target_ops *self, const char *name, int from_tty)
+void
+remote_target::load (const char *name, int from_tty)
{
generic_load (name, from_tty);
}
@@ -13017,8 +13288,8 @@ remote_load (struct target_ops *self, const char *name, int from_tty)
can be opened on the remote side to get the symbols for the child
process. Returns NULL if the operation is not supported. */
-static char *
-remote_pid_to_exec_file (struct target_ops *self, int pid)
+char *
+remote_target::pid_to_exec_file (int pid)
{
static char *filename = NULL;
struct inferior *inf;
@@ -13043,7 +13314,7 @@ remote_pid_to_exec_file (struct target_ops *self, int pid)
xsnprintf (annex, annex_size, "%x", pid);
}
- filename = target_read_stralloc (&current_target,
+ filename = target_read_stralloc (target_stack,
TARGET_OBJECT_EXEC_FILE, annex);
return filename;
@@ -13051,8 +13322,8 @@ remote_pid_to_exec_file (struct target_ops *self, int pid)
/* Implement the to_can_do_single_step target_ops method. */
-static int
-remote_can_do_single_step (struct target_ops *ops)
+int
+remote_target::can_do_single_step ()
{
/* We can only tell whether target supports single step or not by
supported s and S vCont actions if the stub supports vContSupported
@@ -13075,188 +13346,16 @@ remote_can_do_single_step (struct target_ops *ops)
/* Implementation of the to_execution_direction method for the remote
target. */
-static enum exec_direction_kind
-remote_execution_direction (struct target_ops *self)
+enum exec_direction_kind
+remote_target::execution_direction ()
{
struct remote_state *rs = get_remote_state ();
return rs->last_resume_exec_dir;
}
-static void
-init_remote_ops (void)
-{
- remote_ops.to_shortname = "remote";
- remote_ops.to_longname = "Remote serial target in gdb-specific protocol";
- remote_ops.to_doc =
- "Use a remote computer via a serial line, using a gdb-specific protocol.\n\
-Specify the serial device it is connected to\n\
-(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).";
- remote_ops.to_open = remote_open;
- remote_ops.to_close = remote_close;
- remote_ops.to_detach = remote_detach;
- remote_ops.to_disconnect = remote_disconnect;
- remote_ops.to_resume = remote_resume;
- remote_ops.to_wait = remote_wait;
- remote_ops.to_fetch_registers = remote_fetch_registers;
- remote_ops.to_store_registers = remote_store_registers;
- remote_ops.to_prepare_to_store = remote_prepare_to_store;
- remote_ops.to_files_info = remote_files_info;
- remote_ops.to_insert_breakpoint = remote_insert_breakpoint;
- remote_ops.to_remove_breakpoint = remote_remove_breakpoint;
- remote_ops.to_stopped_by_sw_breakpoint = remote_stopped_by_sw_breakpoint;
- remote_ops.to_supports_stopped_by_sw_breakpoint = remote_supports_stopped_by_sw_breakpoint;
- remote_ops.to_stopped_by_hw_breakpoint = remote_stopped_by_hw_breakpoint;
- remote_ops.to_supports_stopped_by_hw_breakpoint = remote_supports_stopped_by_hw_breakpoint;
- remote_ops.to_stopped_by_watchpoint = remote_stopped_by_watchpoint;
- remote_ops.to_stopped_data_address = remote_stopped_data_address;
- remote_ops.to_watchpoint_addr_within_range =
- remote_watchpoint_addr_within_range;
- remote_ops.to_can_use_hw_breakpoint = remote_check_watch_resources;
- remote_ops.to_insert_hw_breakpoint = remote_insert_hw_breakpoint;
- remote_ops.to_remove_hw_breakpoint = remote_remove_hw_breakpoint;
- remote_ops.to_region_ok_for_hw_watchpoint
- = remote_region_ok_for_hw_watchpoint;
- remote_ops.to_insert_watchpoint = remote_insert_watchpoint;
- remote_ops.to_remove_watchpoint = remote_remove_watchpoint;
- remote_ops.to_kill = remote_kill;
- remote_ops.to_load = remote_load;
- remote_ops.to_mourn_inferior = remote_mourn;
- remote_ops.to_pass_signals = remote_pass_signals;
- remote_ops.to_set_syscall_catchpoint = remote_set_syscall_catchpoint;
- remote_ops.to_program_signals = remote_program_signals;
- remote_ops.to_thread_alive = remote_thread_alive;
- remote_ops.to_thread_name = remote_thread_name;
- remote_ops.to_update_thread_list = remote_update_thread_list;
- remote_ops.to_pid_to_str = remote_pid_to_str;
- remote_ops.to_extra_thread_info = remote_threads_extra_info;
- remote_ops.to_get_ada_task_ptid = remote_get_ada_task_ptid;
- remote_ops.to_stop = remote_stop;
- remote_ops.to_interrupt = remote_interrupt;
- remote_ops.to_pass_ctrlc = remote_pass_ctrlc;
- remote_ops.to_xfer_partial = remote_xfer_partial;
- remote_ops.to_get_memory_xfer_limit = remote_get_memory_xfer_limit;
- remote_ops.to_rcmd = remote_rcmd;
- remote_ops.to_pid_to_exec_file = remote_pid_to_exec_file;
- remote_ops.to_log_command = serial_log_command;
- remote_ops.to_get_thread_local_address = remote_get_thread_local_address;
- remote_ops.to_stratum = process_stratum;
- remote_ops.to_has_all_memory = default_child_has_all_memory;
- remote_ops.to_has_memory = default_child_has_memory;
- remote_ops.to_has_stack = default_child_has_stack;
- remote_ops.to_has_registers = default_child_has_registers;
- remote_ops.to_has_execution = default_child_has_execution;
- remote_ops.to_has_thread_control = tc_schedlock; /* can lock scheduler */
- remote_ops.to_can_execute_reverse = remote_can_execute_reverse;
- remote_ops.to_magic = OPS_MAGIC;
- remote_ops.to_memory_map = remote_memory_map;
- remote_ops.to_flash_erase = remote_flash_erase;
- remote_ops.to_flash_done = remote_flash_done;
- remote_ops.to_read_description = remote_read_description;
- remote_ops.to_search_memory = remote_search_memory;
- remote_ops.to_can_async_p = remote_can_async_p;
- remote_ops.to_is_async_p = remote_is_async_p;
- remote_ops.to_async = remote_async;
- remote_ops.to_thread_events = remote_thread_events;
- remote_ops.to_can_do_single_step = remote_can_do_single_step;
- remote_ops.to_terminal_inferior = remote_terminal_inferior;
- remote_ops.to_terminal_ours = remote_terminal_ours;
- remote_ops.to_supports_non_stop = remote_supports_non_stop;
- remote_ops.to_supports_multi_process = remote_supports_multi_process;
- remote_ops.to_supports_disable_randomization
- = remote_supports_disable_randomization;
- remote_ops.to_filesystem_is_local = remote_filesystem_is_local;
- remote_ops.to_fileio_open = remote_hostio_open;
- remote_ops.to_fileio_pwrite = remote_hostio_pwrite;
- remote_ops.to_fileio_pread = remote_hostio_pread;
- remote_ops.to_fileio_fstat = remote_hostio_fstat;
- remote_ops.to_fileio_close = remote_hostio_close;
- remote_ops.to_fileio_unlink = remote_hostio_unlink;
- remote_ops.to_fileio_readlink = remote_hostio_readlink;
- remote_ops.to_supports_enable_disable_tracepoint = remote_supports_enable_disable_tracepoint;
- remote_ops.to_supports_string_tracing = remote_supports_string_tracing;
- remote_ops.to_supports_evaluation_of_breakpoint_conditions = remote_supports_cond_breakpoints;
- remote_ops.to_can_run_breakpoint_commands = remote_can_run_breakpoint_commands;
- remote_ops.to_trace_init = remote_trace_init;
- remote_ops.to_download_tracepoint = remote_download_tracepoint;
- remote_ops.to_can_download_tracepoint = remote_can_download_tracepoint;
- remote_ops.to_download_trace_state_variable
- = remote_download_trace_state_variable;
- remote_ops.to_enable_tracepoint = remote_enable_tracepoint;
- remote_ops.to_disable_tracepoint = remote_disable_tracepoint;
- remote_ops.to_trace_set_readonly_regions = remote_trace_set_readonly_regions;
- remote_ops.to_trace_start = remote_trace_start;
- remote_ops.to_get_trace_status = remote_get_trace_status;
- remote_ops.to_get_tracepoint_status = remote_get_tracepoint_status;
- remote_ops.to_trace_stop = remote_trace_stop;
- remote_ops.to_trace_find = remote_trace_find;
- remote_ops.to_get_trace_state_variable_value
- = remote_get_trace_state_variable_value;
- remote_ops.to_save_trace_data = remote_save_trace_data;
- remote_ops.to_upload_tracepoints = remote_upload_tracepoints;
- remote_ops.to_upload_trace_state_variables
- = remote_upload_trace_state_variables;
- remote_ops.to_get_raw_trace_data = remote_get_raw_trace_data;
- remote_ops.to_get_min_fast_tracepoint_insn_len = remote_get_min_fast_tracepoint_insn_len;
- remote_ops.to_set_disconnected_tracing = remote_set_disconnected_tracing;
- remote_ops.to_set_circular_trace_buffer = remote_set_circular_trace_buffer;
- remote_ops.to_set_trace_buffer_size = remote_set_trace_buffer_size;
- remote_ops.to_set_trace_notes = remote_set_trace_notes;
- remote_ops.to_core_of_thread = remote_core_of_thread;
- remote_ops.to_verify_memory = remote_verify_memory;
- remote_ops.to_get_tib_address = remote_get_tib_address;
- remote_ops.to_set_permissions = remote_set_permissions;
- remote_ops.to_static_tracepoint_marker_at
- = remote_static_tracepoint_marker_at;
- remote_ops.to_static_tracepoint_markers_by_strid
- = remote_static_tracepoint_markers_by_strid;
- remote_ops.to_traceframe_info = remote_traceframe_info;
- remote_ops.to_use_agent = remote_use_agent;
- remote_ops.to_can_use_agent = remote_can_use_agent;
- remote_ops.to_supports_btrace = remote_supports_btrace;
- remote_ops.to_enable_btrace = remote_enable_btrace;
- remote_ops.to_disable_btrace = remote_disable_btrace;
- remote_ops.to_teardown_btrace = remote_teardown_btrace;
- remote_ops.to_read_btrace = remote_read_btrace;
- remote_ops.to_btrace_conf = remote_btrace_conf;
- remote_ops.to_augmented_libraries_svr4_read =
- remote_augmented_libraries_svr4_read;
- remote_ops.to_follow_fork = remote_follow_fork;
- remote_ops.to_follow_exec = remote_follow_exec;
- remote_ops.to_insert_fork_catchpoint = remote_insert_fork_catchpoint;
- remote_ops.to_remove_fork_catchpoint = remote_remove_fork_catchpoint;
- remote_ops.to_insert_vfork_catchpoint = remote_insert_vfork_catchpoint;
- remote_ops.to_remove_vfork_catchpoint = remote_remove_vfork_catchpoint;
- remote_ops.to_insert_exec_catchpoint = remote_insert_exec_catchpoint;
- remote_ops.to_remove_exec_catchpoint = remote_remove_exec_catchpoint;
- remote_ops.to_execution_direction = remote_execution_direction;
-}
-
-/* Set up the extended remote vector by making a copy of the standard
- remote vector and adding to it. */
-
-static void
-init_extended_remote_ops (void)
-{
- extended_remote_ops = remote_ops;
-
- extended_remote_ops.to_shortname = "extended-remote";
- extended_remote_ops.to_longname =
- "Extended remote serial target in gdb-specific protocol";
- extended_remote_ops.to_doc =
- "Use a remote computer via a serial line, using a gdb-specific protocol.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
- extended_remote_ops.to_open = extended_remote_open;
- extended_remote_ops.to_create_inferior = extended_remote_create_inferior;
- extended_remote_ops.to_detach = extended_remote_detach;
- extended_remote_ops.to_attach = extended_remote_attach;
- extended_remote_ops.to_post_attach = extended_remote_post_attach;
- extended_remote_ops.to_supports_disable_randomization
- = extended_remote_supports_disable_randomization;
-}
-
-static int
-remote_can_async_p (struct target_ops *ops)
+int
+remote_target::can_async_p ()
{
struct remote_state *rs = get_remote_state ();
@@ -13268,8 +13367,8 @@ remote_can_async_p (struct target_ops *ops)
return serial_can_async_p (rs->remote_desc);
}
-static int
-remote_is_async_p (struct target_ops *ops)
+int
+remote_target::is_async_p ()
{
struct remote_state *rs = get_remote_state ();
@@ -13301,8 +13400,8 @@ remote_async_inferior_event_handler (gdb_client_data data)
inferior_event_handler (INF_REG_EVENT, NULL);
}
-static void
-remote_async (struct target_ops *ops, int enable)
+void
+remote_target::async (int enable)
{
struct remote_state *rs = get_remote_state ();
@@ -13336,8 +13435,8 @@ remote_async (struct target_ops *ops, int enable)
/* Implementation of the to_thread_events method. */
-static void
-remote_thread_events (struct target_ops *ops, int enable)
+void
+remote_target::thread_events (int enable)
{
struct remote_state *rs = get_remote_state ();
size_t size = get_remote_packet_size ();
@@ -13422,8 +13521,8 @@ remote_new_objfile (struct objfile *objfile)
tracepoints yet, we don't want to mess up the user's existing
collection. */
-static int
-remote_upload_tracepoints (struct target_ops *self, struct uploaded_tp **utpp)
+int
+remote_target::upload_tracepoints (struct uploaded_tp **utpp)
{
struct remote_state *rs = get_remote_state ();
char *p;
@@ -13443,9 +13542,8 @@ remote_upload_tracepoints (struct target_ops *self, struct uploaded_tp **utpp)
return 0;
}
-static int
-remote_upload_trace_state_variables (struct target_ops *self,
- struct uploaded_tsv **utsvp)
+int
+remote_target::upload_trace_state_variables (struct uploaded_tsv **utsvp)
{
struct remote_state *rs = get_remote_state ();
char *p;
@@ -13524,11 +13622,8 @@ _initialize_remote (void)
time. */
remote_state = new_remote_state ();
- init_remote_ops ();
- add_target (&remote_ops);
-
- init_extended_remote_ops ();
- add_target (&extended_remote_ops);
+ add_target (new remote_target ());
+ add_target (new extended_remote_target ());
/* Hook into new objfile notification. */
observer_attach_new_objfile (remote_new_objfile);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index e18064165ff..e8cd0eecd00 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -4626,7 +4626,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
case 1014: /* Data Cache Block set to Zero */
- if (target_auxv_search (&current_target, AT_DCACHEBSIZE, &at_dcsz) <= 0
+ if (target_auxv_search (target_stack, AT_DCACHEBSIZE, &at_dcsz) <= 0
|| at_dcsz == 0)
at_dcsz = 128; /* Assume 128-byte cache line size (POWER8) */
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index e91297b6e01..e562a630ae5 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -678,7 +678,7 @@ s390_read_description (struct target_ops *ops)
{
CORE_ADDR hwcap = 0;
- target_auxv_search (&current_target, AT_HWCAP, &hwcap);
+ target_auxv_search (target_stack, AT_HWCAP, &hwcap);
have_regset_tdb = (hwcap & HWCAP_S390_TE)
&& check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 70364b472a2..0a78023795b 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -1386,7 +1386,7 @@ s390_load (struct s390_prologue_data *data,
if (pv_is_constant (addr))
{
struct target_section *secp;
- secp = target_section_by_addr (&current_target, addr.k);
+ secp = target_section_by_addr (target_stack, addr.k);
if (secp != NULL
&& (bfd_get_section_flags (secp->the_bfd_section->owner,
secp->the_bfd_section)
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 000d2231692..5667aebed73 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -581,7 +581,7 @@ check_for_thread_db (void)
ptid_t ptid;
/* Don't attempt to use thread_db for remote targets. */
- if (!(target_can_run (&current_target) || core_bfd))
+ if (!(target_can_run () || core_bfd))
return;
/* Do nothing if we couldn't load libthread_db.so.1. */
@@ -1203,7 +1203,7 @@ sol_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
{
/* The list of threads is probably not up to date. Find any
thread that is missing from the list, and try again. */
- sol_update_thread_list (&current_target);
+ sol_update_thread_list (target_stack);
thread_info = iterate_over_threads (thread_db_find_thread_from_tid,
&thread);
}
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 51ab93ecf7b..b30a7df009a 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -303,7 +303,7 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
if (data->library_list != NULL)
return data->library_list;
- library_document = target_read_stralloc (&current_target,
+ library_document = target_read_stralloc (target_stack,
TARGET_OBJECT_LIBRARIES_AIX,
NULL);
if (library_document == NULL && warning_msg != NULL)
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index cd5dc8dc9f1..b2679192cfe 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -529,7 +529,7 @@ darwin_solib_read_all_image_info_addr (struct darwin_info *info)
if (TYPE_LENGTH (ptr_type) > sizeof (buf))
return;
- len = target_read (&current_target, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL,
+ len = target_read (target_stack, TARGET_OBJECT_DARWIN_DYLD_INFO, NULL,
buf, 0, TYPE_LENGTH (ptr_type));
if (len <= 0)
return;
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index ad79af06225..f97414ba713 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -290,7 +290,7 @@ dsbt_get_initial_loadmaps (void)
gdb_byte *buf;
struct dsbt_info *info = get_dsbt_info ();
- if (0 >= target_read_alloc (&current_target, TARGET_OBJECT_FDPIC,
+ if (0 >= target_read_alloc (target_stack, TARGET_OBJECT_FDPIC,
"exec", &buf))
{
info->exec_loadmap = NULL;
@@ -300,7 +300,7 @@ dsbt_get_initial_loadmaps (void)
if (solib_dsbt_debug)
dsbt_print_loadmap (info->exec_loadmap);
- if (0 >= target_read_alloc (&current_target, TARGET_OBJECT_FDPIC,
+ if (0 >= target_read_alloc (target_stack, TARGET_OBJECT_FDPIC,
"interp", &buf))
{
info->interp_loadmap = NULL;
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index fa2977ed60d..bbfb4fe0ae0 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -171,7 +171,7 @@ spu_current_sos (void)
;
/* Determine list of SPU ids. */
- size = target_read (&current_target, TARGET_OBJECT_SPU, NULL,
+ size = target_read (target_stack, TARGET_OBJECT_SPU, NULL,
buf, 0, sizeof buf);
/* Do not add stand-alone SPE executable context as shared library,
@@ -206,7 +206,7 @@ spu_current_sos (void)
already created the SPE context, but not installed the object-id
yet. Skip such entries; we'll be back for them later. */
xsnprintf (annex, sizeof annex, "%d/object-id", fd);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
(gdb_byte *) id, 0, sizeof id);
if (len <= 0 || len >= sizeof id)
continue;
@@ -421,7 +421,7 @@ spu_enable_break (struct objfile *objfile)
CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (spe_event_sym);
addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), addr,
- &current_target);
+ target_stack);
create_solib_event_breakpoint (target_gdbarch (), addr);
return 1;
}
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index fe36d458346..f1d0a9d70f0 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -459,11 +459,11 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size,
int pt_phdr_p = 0;
/* Get required auxv elements from target. */
- if (target_auxv_search (&current_target, AT_PHDR, &at_phdr) <= 0)
+ if (target_auxv_search (target_stack, AT_PHDR, &at_phdr) <= 0)
return 0;
- if (target_auxv_search (&current_target, AT_PHENT, &at_phent) <= 0)
+ if (target_auxv_search (target_stack, AT_PHENT, &at_phent) <= 0)
return 0;
- if (target_auxv_search (&current_target, AT_PHNUM, &at_phnum) <= 0)
+ if (target_auxv_search (target_stack, AT_PHNUM, &at_phnum) <= 0)
return 0;
if (!at_phdr || !at_phnum)
return 0;
@@ -1291,7 +1291,7 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list,
gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ());
/* Fetch the list of shared libraries. */
- svr4_library_document = target_read_stralloc (&current_target,
+ svr4_library_document = target_read_stralloc (target_stack,
TARGET_OBJECT_LIBRARIES_SVR4,
annex);
if (svr4_library_document == NULL)
@@ -1614,7 +1614,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
/* Cause svr4_current_sos() to be run if it hasn't been already. */
if (info->main_lm_addr == 0)
- solib_add (NULL, 0, &current_target, auto_solib_add);
+ solib_add (NULL, 0, target_stack, auto_solib_add);
/* svr4_current_sos() will set main_lm_addr for the main executable. */
if (objfile == symfile_objfile)
@@ -2273,7 +2273,7 @@ enable_break (struct svr4_info *info, int from_tty)
mean r_brk has already been relocated. Assume the dynamic linker
is the object containing r_brk. */
- solib_add (NULL, from_tty, &current_target, auto_solib_add);
+ solib_add (NULL, from_tty, target_stack, auto_solib_add);
sym_addr = 0;
if (info->debug_base && solib_svr4_r_map (info) != 0)
sym_addr = solib_svr4_r_brk (info);
@@ -2285,7 +2285,7 @@ enable_break (struct svr4_info *info, int from_tty)
sym_addr = gdbarch_addr_bits_remove
(target_gdbarch (), gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
- &current_target));
+ target_stack));
/* On at least some versions of Solaris there's a dynamic relocation
on _r_debug.r_brk and SYM_ADDR may not be relocated yet, e.g., if
@@ -2402,7 +2402,7 @@ enable_break (struct svr4_info *info, int from_tty)
/* If we were not able to find the base address of the loader
from our so_list, then try using the AT_BASE auxilliary entry. */
if (!load_addr_found)
- if (target_auxv_search (&current_target, AT_BASE, &load_addr) > 0)
+ if (target_auxv_search (target_stack, AT_BASE, &load_addr) > 0)
{
int addr_bit = gdbarch_addr_bit (target_gdbarch ());
@@ -2451,7 +2451,7 @@ enable_break (struct svr4_info *info, int from_tty)
info->debug_loader_name = xstrdup (interp_name);
info->debug_loader_offset_p = 1;
info->debug_loader_offset = load_addr;
- solib_add (NULL, from_tty, &current_target, auto_solib_add);
+ solib_add (NULL, from_tty, target_stack, auto_solib_add);
}
/* Record the relocated start and end address of the dynamic linker
@@ -2495,7 +2495,7 @@ enable_break (struct svr4_info *info, int from_tty)
/* We're done with both the temporary bfd and target. Closing
the target closes the underlying bfd, because it holds the
only remaining reference. */
- target_close (tmp_bfd_target);
+ target_bfd_close (tmp_bfd_target);
if (sym_addr != 0)
{
@@ -2526,7 +2526,7 @@ enable_break (struct svr4_info *info, int from_tty)
sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
- &current_target);
+ target_stack);
svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr);
return 1;
}
@@ -2543,7 +2543,7 @@ enable_break (struct svr4_info *info, int from_tty)
sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
sym_addr,
- &current_target);
+ target_stack);
svr4_create_solib_event_breakpoints (target_gdbarch (), sym_addr);
return 1;
}
@@ -2646,7 +2646,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
if ((bfd_get_file_flags (exec_bfd) & DYNAMIC) == 0)
return 0;
- if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) <= 0)
+ if (target_auxv_search (target_stack, AT_ENTRY, &entry_point) <= 0)
return 0;
exec_displacement = entry_point - bfd_get_start_address (exec_bfd);
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index e6350446ec1..1fd43136b9a 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -260,7 +260,7 @@ solib_target_current_sos (void)
int ix;
/* Fetch the list of shared libraries. */
- library_document = target_read_stralloc (&current_target,
+ library_document = target_read_stralloc (target_stack,
TARGET_OBJECT_LIBRARIES,
NULL);
if (library_document == NULL)
diff --git a/gdb/solib.c b/gdb/solib.c
index 22355058b3e..aa5614fc9d1 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1340,7 +1340,7 @@ handle_solib_event (void)
be adding them automatically. Switch terminal for any messages
produced by breakpoint_re_set. */
target_terminal_ours_for_output ();
- solib_add (NULL, 0, &current_target, auto_solib_add);
+ solib_add (NULL, 0, target_stack, auto_solib_add);
target_terminal_inferior ();
}
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 5a8acce8f25..91c2d9e297d 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -187,7 +187,7 @@ ULONGEST
sparc_fetch_wcookie (struct gdbarch *gdbarch)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct target_ops *ops = &current_target;
+ struct target_ops *ops = target_stack;
gdb_byte buf[8];
int len;
diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c
index d4da08e62ab..a994d26cf35 100644
--- a/gdb/spu-multiarch.c
+++ b/gdb/spu-multiarch.c
@@ -34,8 +34,44 @@
#include "ppc-linux-tdep.h"
#include "spu-tdep.h"
-/* This module's target vector. */
-static struct target_ops spu_ops;
+/* The SPU multi-architecture support target. */
+
+struct spu_multiarch_target FINAL : public target_ops
+{
+ spu_multiarch_target ()
+ { to_stratum = arch_stratum; };
+
+ const char *shortname () OVERRIDE
+ { return "spu"; }
+
+ const char *longname () OVERRIDE
+ { return _("SPU multi-architecture support."); }
+
+ const char *doc () OVERRIDE
+ { return _("SPU multi-architecture support."); }
+
+ void mourn_inferior () OVERRIDE;
+
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ int search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp) OVERRIDE;
+
+ int region_ok_for_hw_watchpoint (CORE_ADDR, int) OVERRIDE;
+
+ struct gdbarch *thread_architecture (ptid_t) OVERRIDE;
+};
+
+static spu_multiarch_target spu_ops;
/* Number of SPE objects loaded into the current inferior. */
static int spu_nr_solib;
@@ -112,8 +148,8 @@ spu_gdbarch (int spufs_fd)
}
/* Override the to_thread_architecture routine. */
-static struct gdbarch *
-spu_thread_architecture (struct target_ops *ops, ptid_t ptid)
+struct gdbarch *
+spu_multiarch_target::thread_architecture (ptid_t ptid)
{
int spufs_fd;
CORE_ADDR spufs_addr;
@@ -125,34 +161,33 @@ spu_thread_architecture (struct target_ops *ops, ptid_t ptid)
}
/* Override the to_region_ok_for_hw_watchpoint routine. */
-static int
-spu_region_ok_for_hw_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len)
+int
+spu_multiarch_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
{
- struct target_ops *ops_beneath = find_target_beneath (self);
+ struct target_ops *ops_beneath = find_target_beneath (this);
/* We cannot watch SPU local store. */
if (SPUADDR_SPU (addr) != -1)
return 0;
- return ops_beneath->to_region_ok_for_hw_watchpoint (ops_beneath, addr, len);
+ return ops_beneath->region_ok_for_hw_watchpoint (addr, len);
}
/* Override the to_fetch_registers routine. */
-static void
-spu_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+
+void
+spu_multiarch_target::fetch_registers (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct target_ops *ops_beneath = find_target_beneath (ops);
+ struct target_ops *ops_beneath = find_target_beneath (this);
int spufs_fd;
CORE_ADDR spufs_addr;
/* This version applies only if we're currently in spu_run. */
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
{
- ops_beneath->to_fetch_registers (ops_beneath, regcache, regno);
+ ops_beneath->fetch_registers (regcache, regno);
return;
}
@@ -194,19 +229,19 @@ spu_fetch_registers (struct target_ops *ops,
}
/* Override the to_store_registers routine. */
-static void
-spu_store_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+
+void
+spu_multiarch_target::store_registers (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- struct target_ops *ops_beneath = find_target_beneath (ops);
+ struct target_ops *ops_beneath = find_target_beneath (this);
int spufs_fd;
CORE_ADDR spufs_addr;
/* This version applies only if we're currently in spu_run. */
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu)
{
- ops_beneath->to_store_registers (ops_beneath, regcache, regno);
+ ops_beneath->store_registers (regcache, regno);
return;
}
@@ -241,13 +276,14 @@ spu_store_registers (struct target_ops *ops,
}
/* Override the to_xfer_partial routine. */
-static enum target_xfer_status
-spu_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+
+enum target_xfer_status
+spu_multiarch_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
- struct target_ops *ops_beneath = find_target_beneath (ops);
+ struct target_ops *ops_beneath = find_target_beneath (this);
/* Use the "mem" spufs file to access SPU local store. */
if (object == TARGET_OBJECT_MEMORY)
@@ -262,9 +298,9 @@ spu_xfer_partial (struct target_ops *ops, enum target_object object,
if (fd >= 0)
{
xsnprintf (mem_annex, sizeof mem_annex, "%d/mem", fd);
- ret = ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU,
- mem_annex, readbuf, writebuf,
- addr, len, xfered_len);
+ ret = ops_beneath->xfer_partial (TARGET_OBJECT_SPU,
+ mem_annex, readbuf, writebuf,
+ addr, len, xfered_len);
if (ret == TARGET_XFER_OK)
return ret;
@@ -274,41 +310,38 @@ spu_xfer_partial (struct target_ops *ops, enum target_object object,
trying the original address first, and getting end-of-file. */
xsnprintf (lslr_annex, sizeof lslr_annex, "%d/lslr", fd);
memset (buf, 0, sizeof buf);
- if (ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU,
- lslr_annex, buf, NULL,
- 0, sizeof buf, xfered_len)
+ if (ops_beneath->xfer_partial (TARGET_OBJECT_SPU,
+ lslr_annex, buf, NULL,
+ 0, sizeof buf, xfered_len)
!= TARGET_XFER_OK)
return ret;
lslr = strtoulst ((char *) buf, NULL, 16);
- return ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU,
- mem_annex, readbuf, writebuf,
- addr & lslr, len, xfered_len);
+ return ops_beneath->xfer_partial (TARGET_OBJECT_SPU,
+ mem_annex, readbuf, writebuf,
+ addr & lslr, len, xfered_len);
}
}
- return ops_beneath->to_xfer_partial (ops_beneath, object, annex,
- readbuf, writebuf, offset, len, xfered_len);
+ return ops_beneath->xfer_partial (object, annex,
+ readbuf, writebuf, offset, len, xfered_len);
}
/* Override the to_search_memory routine. */
-static int
-spu_search_memory (struct target_ops* ops,
- CORE_ADDR start_addr, ULONGEST search_space_len,
- const gdb_byte *pattern, ULONGEST pattern_len,
- CORE_ADDR *found_addrp)
+int
+spu_multiarch_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp)
{
- struct target_ops *ops_beneath = find_target_beneath (ops);
+ struct target_ops *ops_beneath = find_target_beneath (this);
/* For SPU local store, always fall back to the simple method. */
if (SPUADDR_SPU (start_addr) >= 0)
- return simple_search_memory (ops,
- start_addr, search_space_len,
+ return simple_search_memory (this, start_addr, search_space_len,
pattern, pattern_len, found_addrp);
- return ops_beneath->to_search_memory (ops_beneath,
- start_addr, search_space_len,
- pattern, pattern_len, found_addrp);
+ return ops_beneath->search_memory (start_addr, search_space_len,
+ pattern, pattern_len, found_addrp);
}
@@ -362,45 +395,21 @@ spu_multiarch_solib_unloaded (struct so_list *so)
spu_multiarch_deactivate ();
}
-static void
-spu_mourn_inferior (struct target_ops *ops)
+void
+spu_multiarch_target::mourn_inferior ()
{
- struct target_ops *ops_beneath = find_target_beneath (ops);
+ struct target_ops *ops_beneath = find_target_beneath (this);
- ops_beneath->to_mourn_inferior (ops_beneath);
+ ops_beneath->mourn_inferior ();
spu_multiarch_deactivate ();
}
-
-/* Initialize the SPU multi-architecture support target. */
-
-static void
-init_spu_ops (void)
-{
- spu_ops.to_shortname = "spu";
- spu_ops.to_longname = "SPU multi-architecture support.";
- spu_ops.to_doc = "SPU multi-architecture support.";
- spu_ops.to_mourn_inferior = spu_mourn_inferior;
- spu_ops.to_fetch_registers = spu_fetch_registers;
- spu_ops.to_store_registers = spu_store_registers;
- spu_ops.to_xfer_partial = spu_xfer_partial;
- spu_ops.to_search_memory = spu_search_memory;
- spu_ops.to_region_ok_for_hw_watchpoint = spu_region_ok_for_hw_watchpoint;
- spu_ops.to_thread_architecture = spu_thread_architecture;
- spu_ops.to_stratum = arch_stratum;
- spu_ops.to_magic = OPS_MAGIC;
-}
-
/* -Wmissing-prototypes */
extern initialize_file_ftype _initialize_spu_multiarch;
void
_initialize_spu_multiarch (void)
{
- /* Install ourselves on the target stack. */
- init_spu_ops ();
- complete_target_initialization (&spu_ops);
-
/* Install observers to watch for SPU objects. */
observer_attach_inferior_created (spu_multiarch_inferior_created);
observer_attach_solib_loaded (spu_multiarch_solib_loaded);
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index f62e8e76b6c..91a31f94ee3 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -198,7 +198,7 @@ spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname,
return status;
xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
memset (reg, 0, sizeof reg);
- target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ target_read (target_stack, TARGET_OBJECT_SPU, annex,
reg, 0, sizeof reg);
ul = strtoulst ((char *) reg, NULL, 16);
@@ -229,7 +229,7 @@ spu_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
if (status != REG_VALID)
return status;
xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
- target_read (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+ target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 16);
return status;
case SPU_SRR0_REGNUM:
@@ -263,7 +263,7 @@ spu_pseudo_register_write_spu (struct regcache *regcache, const char *regname,
xsnprintf (annex, sizeof annex, "%d/%s", (int) id, regname);
xsnprintf (reg, sizeof reg, "0x%s",
phex_nz (extract_unsigned_integer (buf, 4, byte_order), 4));
- target_write (&current_target, TARGET_OBJECT_SPU, annex,
+ target_write (target_stack, TARGET_OBJECT_SPU, annex,
(gdb_byte *) reg, 0, strlen (reg));
}
@@ -286,7 +286,7 @@ spu_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
case SPU_FPSCR_REGNUM:
regcache_raw_read_unsigned (regcache, SPU_ID_REGNUM, &id);
xsnprintf (annex, sizeof annex, "%d/fpcr", (int) id);
- target_write (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 16);
+ target_write (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 16);
break;
case SPU_SRR0_REGNUM:
@@ -2105,7 +2105,7 @@ info_spu_event_command (char *args, int from_tty)
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/event_status", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_status."));
@@ -2113,7 +2113,7 @@ info_spu_event_command (char *args, int from_tty)
event_status = strtoulst ((char *) buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/event_mask", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read event_mask."));
@@ -2162,7 +2162,7 @@ info_spu_signal_command (char *args, int from_tty)
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/signal1", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 4);
if (len < 0)
error (_("Could not read signal1."));
else if (len == 4)
@@ -2172,7 +2172,7 @@ info_spu_signal_command (char *args, int from_tty)
}
xsnprintf (annex, sizeof annex, "%d/signal1_type", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal1_type."));
@@ -2180,7 +2180,7 @@ info_spu_signal_command (char *args, int from_tty)
signal1_type = strtoulst ((char *) buf, NULL, 16);
xsnprintf (annex, sizeof annex, "%d/signal2", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex, buf, 0, 4);
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex, buf, 0, 4);
if (len < 0)
error (_("Could not read signal2."));
else if (len == 4)
@@ -2190,7 +2190,7 @@ info_spu_signal_command (char *args, int from_tty)
}
xsnprintf (annex, sizeof annex, "%d/signal2_type", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, (sizeof (buf) - 1));
if (len <= 0)
error (_("Could not read signal2_type."));
@@ -2285,7 +2285,7 @@ info_spu_mailbox_command (char *args, int from_tty)
chain = make_cleanup_ui_out_tuple_begin_end (current_uiout, "SPUInfoMailbox");
xsnprintf (annex, sizeof annex, "%d/mbox_info", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read mbox_info."));
@@ -2294,7 +2294,7 @@ info_spu_mailbox_command (char *args, int from_tty)
"mbox", "SPU Outbound Mailbox");
xsnprintf (annex, sizeof annex, "%d/ibox_info", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read ibox_info."));
@@ -2303,7 +2303,7 @@ info_spu_mailbox_command (char *args, int from_tty)
"ibox", "SPU Outbound Interrupt Mailbox");
xsnprintf (annex, sizeof annex, "%d/wbox_info", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, sizeof buf);
if (len < 0)
error (_("Could not read wbox_info."));
@@ -2524,7 +2524,7 @@ info_spu_dma_command (char *args, int from_tty)
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/dma_info", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, 40 + 16 * 32);
if (len <= 0)
error (_("Could not read dma_info."));
@@ -2603,7 +2603,7 @@ info_spu_proxydma_command (char *args, int from_tty)
id = get_frame_register_unsigned (frame, SPU_ID_REGNUM);
xsnprintf (annex, sizeof annex, "%d/proxydma_info", id);
- len = target_read (&current_target, TARGET_OBJECT_SPU, annex,
+ len = target_read (target_stack, TARGET_OBJECT_SPU, annex,
buf, 0, 24 + 8 * 32);
if (len <= 0)
error (_("Could not read proxydma_info."));
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7d7843ea7ce..af83388f585 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -942,7 +942,7 @@ init_entry_point_info (struct objfile *objfile)
entry_point
= gdbarch_convert_from_func_ptr_addr (get_objfile_arch (objfile),
entry_point,
- &current_target);
+ target_stack);
/* Remove any ISA markers, so that this matches entries in the
symbol table. */
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index ef7e14d31d1..de9201fe9b1 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -44,6 +44,8 @@
#define target_debug_do_print(E) \
fputs_unfiltered ((E), gdb_stdlog);
+#define target_debug_print_bool(X) \
+ target_debug_do_print (plongest (X))
#define target_debug_print_struct_target_ops_p(X) \
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_enum_target_object(X) \
@@ -160,6 +162,10 @@
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_enum_remove_bp_reason(X) \
target_debug_do_print (plongest (X))
+#define target_debug_print_enum_info_proc_what(X) \
+ target_debug_do_print (plongest (X))
+#define target_debug_print_thread_control_capabilities(X) \
+ target_debug_do_print (plongest (X))
static void
target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status)
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 57e7939b419..743123d7168 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -3,755 +3,1068 @@
/* To regenerate this file, run:*/
/* make-target-delegates target.h > target-delegates.c */
-static void
-delegate_post_attach (struct target_ops *self, int arg1)
-{
- self = self->beneath;
- self->to_post_attach (self, arg1);
-}
-
-static void
-tdefault_post_attach (struct target_ops *self, int arg1)
-{
-}
-static void
-debug_post_attach (struct target_ops *self, int arg1)
-{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_post_attach (...)\n", debug_target.to_shortname);
- debug_target.to_post_attach (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_post_attach (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+struct dummy_target : public target_ops
+{
+ dummy_target ();
+
+ const char *shortname () OVERRIDE;
+ const char *longname () OVERRIDE;
+ const char *doc () OVERRIDE;
+
+ void post_attach (int arg0) OVERRIDE;
+ void detach (const char *arg0, int arg1) OVERRIDE;
+ void disconnect (const char *arg0, int arg1) OVERRIDE;
+ void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) OVERRIDE;
+ ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2) OVERRIDE;
+ void fetch_registers (struct regcache *arg0, int arg1) OVERRIDE;
+ void store_registers (struct regcache *arg0, int arg1) OVERRIDE;
+ void prepare_to_store (struct regcache *arg0) OVERRIDE;
+ void files_info () OVERRIDE;
+ int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) OVERRIDE;
+ int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2) OVERRIDE;
+ int stopped_by_sw_breakpoint () OVERRIDE;
+ int supports_stopped_by_sw_breakpoint () OVERRIDE;
+ int stopped_by_hw_breakpoint () OVERRIDE;
+ int supports_stopped_by_hw_breakpoint () OVERRIDE;
+ int can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2) OVERRIDE;
+ int ranged_break_num_registers () OVERRIDE;
+ int insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) OVERRIDE;
+ int remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) OVERRIDE;
+ int remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) OVERRIDE;
+ int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) OVERRIDE;
+ int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) OVERRIDE;
+ int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) OVERRIDE;
+ int stopped_by_watchpoint () OVERRIDE;
+ int have_steppable_watchpoint () OVERRIDE;
+ bool have_continuable_watchpoint () OVERRIDE;
+ int stopped_data_address (CORE_ADDR *arg0) OVERRIDE;
+ int watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) OVERRIDE;
+ int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) OVERRIDE;
+ int can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) OVERRIDE;
+ int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) OVERRIDE;
+ int can_do_single_step () OVERRIDE;
+ bool supports_terminal_ours () OVERRIDE;
+ void terminal_init () OVERRIDE;
+ void terminal_inferior () OVERRIDE;
+ void terminal_ours_for_output () OVERRIDE;
+ void terminal_ours () OVERRIDE;
+ void terminal_info (const char *arg0, int arg1) OVERRIDE;
+ void kill () OVERRIDE;
+ void load (const char *arg0, int arg1) OVERRIDE;
+ void post_startup_inferior (ptid_t arg0) OVERRIDE;
+ int insert_fork_catchpoint (int arg0) OVERRIDE;
+ int remove_fork_catchpoint (int arg0) OVERRIDE;
+ int insert_vfork_catchpoint (int arg0) OVERRIDE;
+ int remove_vfork_catchpoint (int arg0) OVERRIDE;
+ int follow_fork (int arg0, int arg1) OVERRIDE;
+ int insert_exec_catchpoint (int arg0) OVERRIDE;
+ int remove_exec_catchpoint (int arg0) OVERRIDE;
+ void follow_exec (struct inferior *arg0, char *arg1) OVERRIDE;
+ int set_syscall_catchpoint (int arg0, int arg1, int arg2, int arg3, int *arg4) OVERRIDE;
+ int has_exited (int arg0, int arg1, int *arg2) OVERRIDE;
+ void mourn_inferior () OVERRIDE;
+ void pass_signals (int arg0, unsigned char * arg1) OVERRIDE;
+ void program_signals (int arg0, unsigned char * arg1) OVERRIDE;
+ int thread_alive (ptid_t arg0) OVERRIDE;
+ void update_thread_list () OVERRIDE;
+ char *pid_to_str (ptid_t arg0) OVERRIDE;
+ char *extra_thread_info (struct thread_info *arg0) OVERRIDE;
+ const char *thread_name (struct thread_info *arg0) OVERRIDE;
+ void stop (ptid_t arg0) OVERRIDE;
+ void interrupt (ptid_t arg0) OVERRIDE;
+ void pass_ctrlc () OVERRIDE;
+ void rcmd (const char *arg0, struct ui_file *arg1) OVERRIDE;
+ char *pid_to_exec_file (int arg0) OVERRIDE;
+ void log_command (const char *arg0) OVERRIDE;
+ struct target_section_table *get_section_table () OVERRIDE;
+ thread_control_capabilities get_thread_control_capabilities () OVERRIDE;
+ bool attach_no_wait () OVERRIDE;
+ int can_async_p () OVERRIDE;
+ int is_async_p () OVERRIDE;
+ void async (int arg0) OVERRIDE;
+ void thread_events (int arg0) OVERRIDE;
+ int supports_non_stop () OVERRIDE;
+ int always_non_stop_p () OVERRIDE;
+ int find_memory_regions (find_memory_region_ftype arg0, void *arg1) OVERRIDE;
+ char *make_corefile_notes (bfd *arg0, int *arg1) OVERRIDE;
+ gdb_byte *get_bookmark (const char *arg0, int arg1) OVERRIDE;
+ void goto_bookmark (const gdb_byte *arg0, int arg1) OVERRIDE;
+ CORE_ADDR get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2) OVERRIDE;
+ enum target_xfer_status xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6) OVERRIDE;
+ ULONGEST get_memory_xfer_limit () OVERRIDE;
+ VEC(mem_region_s) *memory_map () OVERRIDE;
+ void flash_erase (ULONGEST arg0, LONGEST arg1) OVERRIDE;
+ void flash_done () OVERRIDE;
+ const struct target_desc *read_description () OVERRIDE;
+ ptid_t get_ada_task_ptid (long arg0, long arg1) OVERRIDE;
+ int auxv_parse (gdb_byte **arg0, gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3) OVERRIDE;
+ int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4) OVERRIDE;
+ int can_execute_reverse () OVERRIDE;
+ enum exec_direction_kind execution_direction () OVERRIDE;
+ int supports_multi_process () OVERRIDE;
+ int supports_enable_disable_tracepoint () OVERRIDE;
+ int supports_disable_randomization () OVERRIDE;
+ int supports_string_tracing () OVERRIDE;
+ int supports_evaluation_of_breakpoint_conditions () OVERRIDE;
+ int can_run_breakpoint_commands () OVERRIDE;
+ struct gdbarch *thread_architecture (ptid_t arg0) OVERRIDE;
+ struct address_space *thread_address_space (ptid_t arg0) OVERRIDE;
+ int filesystem_is_local () OVERRIDE;
+ void trace_init () OVERRIDE;
+ void download_tracepoint (struct bp_location *arg0) OVERRIDE;
+ int can_download_tracepoint () OVERRIDE;
+ void download_trace_state_variable (struct trace_state_variable *arg0) OVERRIDE;
+ void enable_tracepoint (struct bp_location *arg0) OVERRIDE;
+ void disable_tracepoint (struct bp_location *arg0) OVERRIDE;
+ void trace_set_readonly_regions () OVERRIDE;
+ void trace_start () OVERRIDE;
+ int get_trace_status (struct trace_status *arg0) OVERRIDE;
+ void get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1) OVERRIDE;
+ void trace_stop () OVERRIDE;
+ int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4) OVERRIDE;
+ int get_trace_state_variable_value (int arg0, LONGEST *arg1) OVERRIDE;
+ int save_trace_data (const char *arg0) OVERRIDE;
+ int upload_tracepoints (struct uploaded_tp **arg0) OVERRIDE;
+ int upload_trace_state_variables (struct uploaded_tsv **arg0) OVERRIDE;
+ LONGEST get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2) OVERRIDE;
+ int get_min_fast_tracepoint_insn_len () OVERRIDE;
+ void set_disconnected_tracing (int arg0) OVERRIDE;
+ void set_circular_trace_buffer (int arg0) OVERRIDE;
+ void set_trace_buffer_size (LONGEST arg0) OVERRIDE;
+ int set_trace_notes (const char *arg0, const char *arg1, const char *arg2) OVERRIDE;
+ int core_of_thread (ptid_t arg0) OVERRIDE;
+ int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2) OVERRIDE;
+ int get_tib_address (ptid_t arg0, CORE_ADDR *arg1) OVERRIDE;
+ void set_permissions () OVERRIDE;
+ int static_tracepoint_marker_at (CORE_ADDR arg0, struct static_tracepoint_marker *arg1) OVERRIDE;
+ VEC(static_tracepoint_marker_p) *static_tracepoint_markers_by_strid (const char *arg0) OVERRIDE;
+ struct traceframe_info *traceframe_info () OVERRIDE;
+ int use_agent (int arg0) OVERRIDE;
+ int can_use_agent () OVERRIDE;
+ int supports_btrace (enum btrace_format arg0) OVERRIDE;
+ struct btrace_target_info *enable_btrace (ptid_t arg0, const struct btrace_config *arg1) OVERRIDE;
+ void disable_btrace (struct btrace_target_info *arg0) OVERRIDE;
+ void teardown_btrace (struct btrace_target_info *arg0) OVERRIDE;
+ enum btrace_error read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2) OVERRIDE;
+ const struct btrace_config *btrace_conf (const struct btrace_target_info *arg0) OVERRIDE;
+ void stop_recording () OVERRIDE;
+ void info_record () OVERRIDE;
+ void save_record (const char *arg0) OVERRIDE;
+ void delete_record () OVERRIDE;
+ int record_is_replaying (ptid_t arg0) OVERRIDE;
+ int record_will_replay (ptid_t arg0, int arg1) OVERRIDE;
+ void record_stop_replaying () OVERRIDE;
+ void goto_record_begin () OVERRIDE;
+ void goto_record_end () OVERRIDE;
+ void goto_record (ULONGEST arg0) OVERRIDE;
+ void insn_history (int arg0, int arg1) OVERRIDE;
+ void insn_history_from (ULONGEST arg0, int arg1, int arg2) OVERRIDE;
+ void insn_history_range (ULONGEST arg0, ULONGEST arg1, int arg2) OVERRIDE;
+ void call_history (int arg0, int arg1) OVERRIDE;
+ void call_history_from (ULONGEST arg0, int arg1, int arg2) OVERRIDE;
+ void call_history_range (ULONGEST arg0, ULONGEST arg1, int arg2) OVERRIDE;
+ int augmented_libraries_svr4_read () OVERRIDE;
+ const struct frame_unwind *get_unwinder () OVERRIDE;
+ const struct frame_unwind *get_tailcall_unwinder () OVERRIDE;
+ void prepare_to_generate_core () OVERRIDE;
+ void done_generating_core () OVERRIDE;
+};
+
+struct debug_target : public target_ops
+{
+ debug_target ();
+
+ const char *shortname () OVERRIDE;
+ const char *longname () OVERRIDE;
+ const char *doc () OVERRIDE;
+
+ void post_attach (int arg0) OVERRIDE;
+ void detach (const char *arg0, int arg1) OVERRIDE;
+ void disconnect (const char *arg0, int arg1) OVERRIDE;
+ void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) OVERRIDE;
+ ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2) OVERRIDE;
+ void fetch_registers (struct regcache *arg0, int arg1) OVERRIDE;
+ void store_registers (struct regcache *arg0, int arg1) OVERRIDE;
+ void prepare_to_store (struct regcache *arg0) OVERRIDE;
+ void files_info () OVERRIDE;
+ int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) OVERRIDE;
+ int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2) OVERRIDE;
+ int stopped_by_sw_breakpoint () OVERRIDE;
+ int supports_stopped_by_sw_breakpoint () OVERRIDE;
+ int stopped_by_hw_breakpoint () OVERRIDE;
+ int supports_stopped_by_hw_breakpoint () OVERRIDE;
+ int can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2) OVERRIDE;
+ int ranged_break_num_registers () OVERRIDE;
+ int insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) OVERRIDE;
+ int remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) OVERRIDE;
+ int remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) OVERRIDE;
+ int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) OVERRIDE;
+ int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) OVERRIDE;
+ int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) OVERRIDE;
+ int stopped_by_watchpoint () OVERRIDE;
+ int have_steppable_watchpoint () OVERRIDE;
+ bool have_continuable_watchpoint () OVERRIDE;
+ int stopped_data_address (CORE_ADDR *arg0) OVERRIDE;
+ int watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) OVERRIDE;
+ int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) OVERRIDE;
+ int can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) OVERRIDE;
+ int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) OVERRIDE;
+ int can_do_single_step () OVERRIDE;
+ bool supports_terminal_ours () OVERRIDE;
+ void terminal_init () OVERRIDE;
+ void terminal_inferior () OVERRIDE;
+ void terminal_ours_for_output () OVERRIDE;
+ void terminal_ours () OVERRIDE;
+ void terminal_info (const char *arg0, int arg1) OVERRIDE;
+ void kill () OVERRIDE;
+ void load (const char *arg0, int arg1) OVERRIDE;
+ void post_startup_inferior (ptid_t arg0) OVERRIDE;
+ int insert_fork_catchpoint (int arg0) OVERRIDE;
+ int remove_fork_catchpoint (int arg0) OVERRIDE;
+ int insert_vfork_catchpoint (int arg0) OVERRIDE;
+ int remove_vfork_catchpoint (int arg0) OVERRIDE;
+ int follow_fork (int arg0, int arg1) OVERRIDE;
+ int insert_exec_catchpoint (int arg0) OVERRIDE;
+ int remove_exec_catchpoint (int arg0) OVERRIDE;
+ void follow_exec (struct inferior *arg0, char *arg1) OVERRIDE;
+ int set_syscall_catchpoint (int arg0, int arg1, int arg2, int arg3, int *arg4) OVERRIDE;
+ int has_exited (int arg0, int arg1, int *arg2) OVERRIDE;
+ void mourn_inferior () OVERRIDE;
+ void pass_signals (int arg0, unsigned char * arg1) OVERRIDE;
+ void program_signals (int arg0, unsigned char * arg1) OVERRIDE;
+ int thread_alive (ptid_t arg0) OVERRIDE;
+ void update_thread_list () OVERRIDE;
+ char *pid_to_str (ptid_t arg0) OVERRIDE;
+ char *extra_thread_info (struct thread_info *arg0) OVERRIDE;
+ const char *thread_name (struct thread_info *arg0) OVERRIDE;
+ void stop (ptid_t arg0) OVERRIDE;
+ void interrupt (ptid_t arg0) OVERRIDE;
+ void pass_ctrlc () OVERRIDE;
+ void rcmd (const char *arg0, struct ui_file *arg1) OVERRIDE;
+ char *pid_to_exec_file (int arg0) OVERRIDE;
+ void log_command (const char *arg0) OVERRIDE;
+ struct target_section_table *get_section_table () OVERRIDE;
+ thread_control_capabilities get_thread_control_capabilities () OVERRIDE;
+ bool attach_no_wait () OVERRIDE;
+ int can_async_p () OVERRIDE;
+ int is_async_p () OVERRIDE;
+ void async (int arg0) OVERRIDE;
+ void thread_events (int arg0) OVERRIDE;
+ int supports_non_stop () OVERRIDE;
+ int always_non_stop_p () OVERRIDE;
+ int find_memory_regions (find_memory_region_ftype arg0, void *arg1) OVERRIDE;
+ char *make_corefile_notes (bfd *arg0, int *arg1) OVERRIDE;
+ gdb_byte *get_bookmark (const char *arg0, int arg1) OVERRIDE;
+ void goto_bookmark (const gdb_byte *arg0, int arg1) OVERRIDE;
+ CORE_ADDR get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2) OVERRIDE;
+ enum target_xfer_status xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6) OVERRIDE;
+ ULONGEST get_memory_xfer_limit () OVERRIDE;
+ VEC(mem_region_s) *memory_map () OVERRIDE;
+ void flash_erase (ULONGEST arg0, LONGEST arg1) OVERRIDE;
+ void flash_done () OVERRIDE;
+ const struct target_desc *read_description () OVERRIDE;
+ ptid_t get_ada_task_ptid (long arg0, long arg1) OVERRIDE;
+ int auxv_parse (gdb_byte **arg0, gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3) OVERRIDE;
+ int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4) OVERRIDE;
+ int can_execute_reverse () OVERRIDE;
+ enum exec_direction_kind execution_direction () OVERRIDE;
+ int supports_multi_process () OVERRIDE;
+ int supports_enable_disable_tracepoint () OVERRIDE;
+ int supports_disable_randomization () OVERRIDE;
+ int supports_string_tracing () OVERRIDE;
+ int supports_evaluation_of_breakpoint_conditions () OVERRIDE;
+ int can_run_breakpoint_commands () OVERRIDE;
+ struct gdbarch *thread_architecture (ptid_t arg0) OVERRIDE;
+ struct address_space *thread_address_space (ptid_t arg0) OVERRIDE;
+ int filesystem_is_local () OVERRIDE;
+ void trace_init () OVERRIDE;
+ void download_tracepoint (struct bp_location *arg0) OVERRIDE;
+ int can_download_tracepoint () OVERRIDE;
+ void download_trace_state_variable (struct trace_state_variable *arg0) OVERRIDE;
+ void enable_tracepoint (struct bp_location *arg0) OVERRIDE;
+ void disable_tracepoint (struct bp_location *arg0) OVERRIDE;
+ void trace_set_readonly_regions () OVERRIDE;
+ void trace_start () OVERRIDE;
+ int get_trace_status (struct trace_status *arg0) OVERRIDE;
+ void get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1) OVERRIDE;
+ void trace_stop () OVERRIDE;
+ int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4) OVERRIDE;
+ int get_trace_state_variable_value (int arg0, LONGEST *arg1) OVERRIDE;
+ int save_trace_data (const char *arg0) OVERRIDE;
+ int upload_tracepoints (struct uploaded_tp **arg0) OVERRIDE;
+ int upload_trace_state_variables (struct uploaded_tsv **arg0) OVERRIDE;
+ LONGEST get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2) OVERRIDE;
+ int get_min_fast_tracepoint_insn_len () OVERRIDE;
+ void set_disconnected_tracing (int arg0) OVERRIDE;
+ void set_circular_trace_buffer (int arg0) OVERRIDE;
+ void set_trace_buffer_size (LONGEST arg0) OVERRIDE;
+ int set_trace_notes (const char *arg0, const char *arg1, const char *arg2) OVERRIDE;
+ int core_of_thread (ptid_t arg0) OVERRIDE;
+ int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2) OVERRIDE;
+ int get_tib_address (ptid_t arg0, CORE_ADDR *arg1) OVERRIDE;
+ void set_permissions () OVERRIDE;
+ int static_tracepoint_marker_at (CORE_ADDR arg0, struct static_tracepoint_marker *arg1) OVERRIDE;
+ VEC(static_tracepoint_marker_p) *static_tracepoint_markers_by_strid (const char *arg0) OVERRIDE;
+ struct traceframe_info *traceframe_info () OVERRIDE;
+ int use_agent (int arg0) OVERRIDE;
+ int can_use_agent () OVERRIDE;
+ int supports_btrace (enum btrace_format arg0) OVERRIDE;
+ struct btrace_target_info *enable_btrace (ptid_t arg0, const struct btrace_config *arg1) OVERRIDE;
+ void disable_btrace (struct btrace_target_info *arg0) OVERRIDE;
+ void teardown_btrace (struct btrace_target_info *arg0) OVERRIDE;
+ enum btrace_error read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2) OVERRIDE;
+ const struct btrace_config *btrace_conf (const struct btrace_target_info *arg0) OVERRIDE;
+ void stop_recording () OVERRIDE;
+ void info_record () OVERRIDE;
+ void save_record (const char *arg0) OVERRIDE;
+ void delete_record () OVERRIDE;
+ int record_is_replaying (ptid_t arg0) OVERRIDE;
+ int record_will_replay (ptid_t arg0, int arg1) OVERRIDE;
+ void record_stop_replaying () OVERRIDE;
+ void goto_record_begin () OVERRIDE;
+ void goto_record_end () OVERRIDE;
+ void goto_record (ULONGEST arg0) OVERRIDE;
+ void insn_history (int arg0, int arg1) OVERRIDE;
+ void insn_history_from (ULONGEST arg0, int arg1, int arg2) OVERRIDE;
+ void insn_history_range (ULONGEST arg0, ULONGEST arg1, int arg2) OVERRIDE;
+ void call_history (int arg0, int arg1) OVERRIDE;
+ void call_history_from (ULONGEST arg0, int arg1, int arg2) OVERRIDE;
+ void call_history_range (ULONGEST arg0, ULONGEST arg1, int arg2) OVERRIDE;
+ int augmented_libraries_svr4_read () OVERRIDE;
+ const struct frame_unwind *get_unwinder () OVERRIDE;
+ const struct frame_unwind *get_tailcall_unwinder () OVERRIDE;
+ void prepare_to_generate_core () OVERRIDE;
+ void done_generating_core () OVERRIDE;
+};
+
+void
+target_ops::post_attach (int arg0)
+{
+ this->beneath->post_attach (arg0);
+}
+
+void
+dummy_target::post_attach (int arg0)
+{
+}
+
+void
+debug_target::post_attach (int arg0)
+{
+ fprintf_unfiltered (gdb_stdlog, "-> %s->post_attach (...)\n", this->beneath->shortname ());
+ this->beneath->post_attach (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->post_attach (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_detach (struct target_ops *self, const char *arg1, int arg2)
+void
+target_ops::detach (const char *arg0, int arg1)
{
- self = self->beneath;
- self->to_detach (self, arg1, arg2);
+ this->beneath->detach (arg0, arg1);
}
-static void
-tdefault_detach (struct target_ops *self, const char *arg1, int arg2)
+void
+dummy_target::detach (const char *arg0, int arg1)
{
}
-static void
-debug_detach (struct target_ops *self, const char *arg1, int arg2)
+void
+debug_target::detach (const char *arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_detach (...)\n", debug_target.to_shortname);
- debug_target.to_detach (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_detach (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->detach (...)\n", this->beneath->shortname ());
+ this->beneath->detach (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->detach (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_disconnect (struct target_ops *self, const char *arg1, int arg2)
+void
+target_ops::disconnect (const char *arg0, int arg1)
{
- self = self->beneath;
- self->to_disconnect (self, arg1, arg2);
+ this->beneath->disconnect (arg0, arg1);
}
-static void
-tdefault_disconnect (struct target_ops *self, const char *arg1, int arg2)
+void
+dummy_target::disconnect (const char *arg0, int arg1)
{
tcomplain ();
}
-static void
-debug_disconnect (struct target_ops *self, const char *arg1, int arg2)
+void
+debug_target::disconnect (const char *arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_disconnect (...)\n", debug_target.to_shortname);
- debug_target.to_disconnect (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_disconnect (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->disconnect (...)\n", this->beneath->shortname ());
+ this->beneath->disconnect (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->disconnect (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_resume (struct target_ops *self, ptid_t arg1, int arg2, enum gdb_signal arg3)
+void
+target_ops::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
{
- self = self->beneath;
- self->to_resume (self, arg1, arg2, arg3);
+ this->beneath->resume (arg0, arg1, arg2);
}
-static void
-tdefault_resume (struct target_ops *self, ptid_t arg1, int arg2, enum gdb_signal arg3)
+void
+dummy_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
{
noprocess ();
}
-static void
-debug_resume (struct target_ops *self, ptid_t arg1, int arg2, enum gdb_signal arg3)
+void
+debug_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_resume (...)\n", debug_target.to_shortname);
- debug_target.to_resume (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_resume (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->resume (...)\n", this->beneath->shortname ());
+ this->beneath->resume (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->resume (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_step (arg2);
+ target_debug_print_step (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_gdb_signal (arg3);
+ target_debug_print_enum_gdb_signal (arg2);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static ptid_t
-delegate_wait (struct target_ops *self, ptid_t arg1, struct target_waitstatus *arg2, int arg3)
+ptid_t
+target_ops::wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2)
+{
+ return this->beneath->wait (arg0, arg1, arg2);
+}
+
+ptid_t
+dummy_target::wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2)
{
- self = self->beneath;
- return self->to_wait (self, arg1, arg2, arg3);
+ return default_target_wait (this, arg0, arg1, arg2);
}
-static ptid_t
-debug_wait (struct target_ops *self, ptid_t arg1, struct target_waitstatus *arg2, int arg3)
+ptid_t
+debug_target::wait (ptid_t arg0, struct target_waitstatus *arg1, int arg2)
{
ptid_t result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_wait (...)\n", debug_target.to_shortname);
- result = debug_target.to_wait (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_wait (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->wait (...)\n", this->beneath->shortname ());
+ result = this->beneath->wait (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->wait (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_target_waitstatus_p (arg2);
+ target_debug_print_struct_target_waitstatus_p (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_options (arg3);
+ target_debug_print_options (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_ptid_t (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+void
+target_ops::fetch_registers (struct regcache *arg0, int arg1)
{
- self = self->beneath;
- self->to_fetch_registers (self, arg1, arg2);
+ this->beneath->fetch_registers (arg0, arg1);
}
-static void
-tdefault_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+void
+dummy_target::fetch_registers (struct regcache *arg0, int arg1)
{
}
-static void
-debug_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+void
+debug_target::fetch_registers (struct regcache *arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_fetch_registers (...)\n", debug_target.to_shortname);
- debug_target.to_fetch_registers (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_fetch_registers (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->fetch_registers (...)\n", this->beneath->shortname ());
+ this->beneath->fetch_registers (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->fetch_registers (", this->beneath->shortname ());
+ target_debug_print_struct_regcache_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_regcache_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+void
+target_ops::store_registers (struct regcache *arg0, int arg1)
{
- self = self->beneath;
- self->to_store_registers (self, arg1, arg2);
+ this->beneath->store_registers (arg0, arg1);
}
-static void
-tdefault_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+void
+dummy_target::store_registers (struct regcache *arg0, int arg1)
{
noprocess ();
}
-static void
-debug_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+void
+debug_target::store_registers (struct regcache *arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_store_registers (...)\n", debug_target.to_shortname);
- debug_target.to_store_registers (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_store_registers (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->store_registers (...)\n", this->beneath->shortname ());
+ this->beneath->store_registers (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->store_registers (", this->beneath->shortname ());
+ target_debug_print_struct_regcache_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_regcache_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_prepare_to_store (struct target_ops *self, struct regcache *arg1)
+void
+target_ops::prepare_to_store (struct regcache *arg0)
{
- self = self->beneath;
- self->to_prepare_to_store (self, arg1);
+ this->beneath->prepare_to_store (arg0);
}
-static void
-tdefault_prepare_to_store (struct target_ops *self, struct regcache *arg1)
+void
+dummy_target::prepare_to_store (struct regcache *arg0)
{
noprocess ();
}
-static void
-debug_prepare_to_store (struct target_ops *self, struct regcache *arg1)
+void
+debug_target::prepare_to_store (struct regcache *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_prepare_to_store (...)\n", debug_target.to_shortname);
- debug_target.to_prepare_to_store (&debug_target, arg1);
- 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);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->prepare_to_store (...)\n", this->beneath->shortname ());
+ this->beneath->prepare_to_store (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->prepare_to_store (", this->beneath->shortname ());
+ target_debug_print_struct_regcache_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_files_info (struct target_ops *self)
+void
+target_ops::files_info ()
{
- self = self->beneath;
- self->to_files_info (self);
+ this->beneath->files_info ();
}
-static void
-tdefault_files_info (struct target_ops *self)
+void
+dummy_target::files_info ()
{
}
-static void
-debug_files_info (struct target_ops *self)
+void
+debug_target::files_info ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_files_info (...)\n", debug_target.to_shortname);
- debug_target.to_files_info (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_files_info (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->files_info (...)\n", this->beneath->shortname ());
+ this->beneath->files_info ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->files_info (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_insert_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+target_ops::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+{
+ return this->beneath->insert_breakpoint (arg0, arg1);
+}
+
+int
+dummy_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
- self = self->beneath;
- return self->to_insert_breakpoint (self, arg1, arg2);
+ noprocess ();
}
-static int
-debug_insert_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+debug_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_insert_breakpoint (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insert_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_gdbarch_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insert_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->insert_breakpoint (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insert_breakpoint (", this->beneath->shortname ());
+ target_debug_print_struct_gdbarch_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_bp_target_info_p (arg2);
+ target_debug_print_struct_bp_target_info_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_remove_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2, enum remove_bp_reason arg3)
+int
+target_ops::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2)
+{
+ return this->beneath->remove_breakpoint (arg0, arg1, arg2);
+}
+
+int
+dummy_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2)
{
- self = self->beneath;
- return self->to_remove_breakpoint (self, arg1, arg2, arg3);
+ noprocess ();
}
-static int
-debug_remove_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2, enum remove_bp_reason arg3)
+int
+debug_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_remove_breakpoint (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_remove_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_gdbarch_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->remove_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->remove_breakpoint (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->remove_breakpoint (", this->beneath->shortname ());
+ target_debug_print_struct_gdbarch_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_bp_target_info_p (arg2);
+ target_debug_print_struct_bp_target_info_p (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_remove_bp_reason (arg3);
+ target_debug_print_enum_remove_bp_reason (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_stopped_by_sw_breakpoint (struct target_ops *self)
+int
+target_ops::stopped_by_sw_breakpoint ()
{
- self = self->beneath;
- return self->to_stopped_by_sw_breakpoint (self);
+ return this->beneath->stopped_by_sw_breakpoint ();
}
-static int
-tdefault_stopped_by_sw_breakpoint (struct target_ops *self)
+int
+dummy_target::stopped_by_sw_breakpoint ()
{
return 0;
}
-static int
-debug_stopped_by_sw_breakpoint (struct target_ops *self)
+int
+debug_target::stopped_by_sw_breakpoint ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_stopped_by_sw_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_stopped_by_sw_breakpoint (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_stopped_by_sw_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_by_sw_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->stopped_by_sw_breakpoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_by_sw_breakpoint (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_supports_stopped_by_sw_breakpoint (struct target_ops *self)
+int
+target_ops::supports_stopped_by_sw_breakpoint ()
{
- self = self->beneath;
- return self->to_supports_stopped_by_sw_breakpoint (self);
+ return this->beneath->supports_stopped_by_sw_breakpoint ();
}
-static int
-tdefault_supports_stopped_by_sw_breakpoint (struct target_ops *self)
+int
+dummy_target::supports_stopped_by_sw_breakpoint ()
{
return 0;
}
-static int
-debug_supports_stopped_by_sw_breakpoint (struct target_ops *self)
+int
+debug_target::supports_stopped_by_sw_breakpoint ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_stopped_by_sw_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_stopped_by_sw_breakpoint (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_stopped_by_sw_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_stopped_by_sw_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_stopped_by_sw_breakpoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_stopped_by_sw_breakpoint (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_stopped_by_hw_breakpoint (struct target_ops *self)
+int
+target_ops::stopped_by_hw_breakpoint ()
{
- self = self->beneath;
- return self->to_stopped_by_hw_breakpoint (self);
+ return this->beneath->stopped_by_hw_breakpoint ();
}
-static int
-tdefault_stopped_by_hw_breakpoint (struct target_ops *self)
+int
+dummy_target::stopped_by_hw_breakpoint ()
{
return 0;
}
-static int
-debug_stopped_by_hw_breakpoint (struct target_ops *self)
+int
+debug_target::stopped_by_hw_breakpoint ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_stopped_by_hw_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_stopped_by_hw_breakpoint (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_stopped_by_hw_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_by_hw_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->stopped_by_hw_breakpoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_by_hw_breakpoint (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_supports_stopped_by_hw_breakpoint (struct target_ops *self)
+int
+target_ops::supports_stopped_by_hw_breakpoint ()
{
- self = self->beneath;
- return self->to_supports_stopped_by_hw_breakpoint (self);
+ return this->beneath->supports_stopped_by_hw_breakpoint ();
}
-static int
-tdefault_supports_stopped_by_hw_breakpoint (struct target_ops *self)
+int
+dummy_target::supports_stopped_by_hw_breakpoint ()
{
return 0;
}
-static int
-debug_supports_stopped_by_hw_breakpoint (struct target_ops *self)
+int
+debug_target::supports_stopped_by_hw_breakpoint ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_stopped_by_hw_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_stopped_by_hw_breakpoint (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_stopped_by_hw_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_stopped_by_hw_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_stopped_by_hw_breakpoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_stopped_by_hw_breakpoint (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_can_use_hw_breakpoint (struct target_ops *self, enum bptype arg1, int arg2, int arg3)
+int
+target_ops::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
{
- self = self->beneath;
- return self->to_can_use_hw_breakpoint (self, arg1, arg2, arg3);
+ return this->beneath->can_use_hw_breakpoint (arg0, arg1, arg2);
}
-static int
-tdefault_can_use_hw_breakpoint (struct target_ops *self, enum bptype arg1, int arg2, int arg3)
+int
+dummy_target::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
{
return 0;
}
-static int
-debug_can_use_hw_breakpoint (struct target_ops *self, enum bptype arg1, int arg2, int arg3)
+int
+debug_target::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_use_hw_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_use_hw_breakpoint (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_use_hw_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_use_hw_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_use_hw_breakpoint (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_use_hw_breakpoint (", this->beneath->shortname ());
+ target_debug_print_enum_bptype (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_bptype (arg1);
+ target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_ranged_break_num_registers (struct target_ops *self)
+int
+target_ops::ranged_break_num_registers ()
{
- self = self->beneath;
- return self->to_ranged_break_num_registers (self);
+ return this->beneath->ranged_break_num_registers ();
}
-static int
-tdefault_ranged_break_num_registers (struct target_ops *self)
+int
+dummy_target::ranged_break_num_registers ()
{
return -1;
}
-static int
-debug_ranged_break_num_registers (struct target_ops *self)
+int
+debug_target::ranged_break_num_registers ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_ranged_break_num_registers (...)\n", debug_target.to_shortname);
- result = debug_target.to_ranged_break_num_registers (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_ranged_break_num_registers (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->ranged_break_num_registers (...)\n", this->beneath->shortname ());
+ result = this->beneath->ranged_break_num_registers ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->ranged_break_num_registers (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+target_ops::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
- self = self->beneath;
- return self->to_insert_hw_breakpoint (self, arg1, arg2);
+ return this->beneath->insert_hw_breakpoint (arg0, arg1);
}
-static int
-tdefault_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+dummy_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
return -1;
}
-static int
-debug_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+debug_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_hw_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_insert_hw_breakpoint (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insert_hw_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_gdbarch_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insert_hw_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->insert_hw_breakpoint (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insert_hw_breakpoint (", this->beneath->shortname ());
+ target_debug_print_struct_gdbarch_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_bp_target_info_p (arg2);
+ target_debug_print_struct_bp_target_info_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+target_ops::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
- self = self->beneath;
- return self->to_remove_hw_breakpoint (self, arg1, arg2);
+ return this->beneath->remove_hw_breakpoint (arg0, arg1);
}
-static int
-tdefault_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+dummy_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
return -1;
}
-static int
-debug_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
+int
+debug_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_hw_breakpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_remove_hw_breakpoint (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_remove_hw_breakpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->remove_hw_breakpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->remove_hw_breakpoint (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->remove_hw_breakpoint (", this->beneath->shortname ());
+ target_debug_print_struct_gdbarch_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_gdbarch_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_bp_target_info_p (arg2);
+ target_debug_print_struct_bp_target_info_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4)
+int
+target_ops::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
{
- self = self->beneath;
- return self->to_remove_watchpoint (self, arg1, arg2, arg3, arg4);
+ return this->beneath->remove_watchpoint (arg0, arg1, arg2, arg3);
}
-static int
-tdefault_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4)
+int
+dummy_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
{
return -1;
}
-static int
-debug_remove_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4)
+int
+debug_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_watchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_remove_watchpoint (&debug_target, arg1, arg2, arg3, arg4);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_remove_watchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->remove_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->remove_watchpoint (arg0, arg1, arg2, arg3);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->remove_watchpoint (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_target_hw_bp_type (arg3);
+ target_debug_print_enum_target_hw_bp_type (arg2);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_expression_p (arg4);
+ target_debug_print_struct_expression_p (arg3);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4)
+int
+target_ops::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
{
- self = self->beneath;
- return self->to_insert_watchpoint (self, arg1, arg2, arg3, arg4);
+ return this->beneath->insert_watchpoint (arg0, arg1, arg2, arg3);
}
-static int
-tdefault_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4)
+int
+dummy_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
{
return -1;
}
-static int
-debug_insert_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2, enum target_hw_bp_type arg3, struct expression *arg4)
+int
+debug_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_watchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_insert_watchpoint (&debug_target, arg1, arg2, arg3, arg4);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insert_watchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insert_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->insert_watchpoint (arg0, arg1, arg2, arg3);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insert_watchpoint (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_target_hw_bp_type (arg3);
+ target_debug_print_enum_target_hw_bp_type (arg2);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_expression_p (arg4);
+ target_debug_print_struct_expression_p (arg3);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_insert_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, enum target_hw_bp_type arg3)
+int
+target_ops::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
{
- self = self->beneath;
- return self->to_insert_mask_watchpoint (self, arg1, arg2, arg3);
+ return this->beneath->insert_mask_watchpoint (arg0, arg1, arg2);
}
-static int
-tdefault_insert_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, enum target_hw_bp_type arg3)
+int
+dummy_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
{
return 1;
}
-static int
-debug_insert_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, enum target_hw_bp_type arg3)
+int
+debug_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_mask_watchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_insert_mask_watchpoint (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insert_mask_watchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insert_mask_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->insert_mask_watchpoint (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insert_mask_watchpoint (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_target_hw_bp_type (arg3);
+ target_debug_print_enum_target_hw_bp_type (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_remove_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, enum target_hw_bp_type arg3)
+int
+target_ops::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
{
- self = self->beneath;
- return self->to_remove_mask_watchpoint (self, arg1, arg2, arg3);
+ return this->beneath->remove_mask_watchpoint (arg0, arg1, arg2);
}
-static int
-tdefault_remove_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, enum target_hw_bp_type arg3)
+int
+dummy_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
{
return 1;
}
-static int
-debug_remove_mask_watchpoint (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, enum target_hw_bp_type arg3)
+int
+debug_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_mask_watchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_remove_mask_watchpoint (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_remove_mask_watchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->remove_mask_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->remove_mask_watchpoint (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->remove_mask_watchpoint (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_target_hw_bp_type (arg3);
+ target_debug_print_enum_target_hw_bp_type (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_stopped_by_watchpoint (struct target_ops *self)
+int
+target_ops::stopped_by_watchpoint ()
{
- self = self->beneath;
- return self->to_stopped_by_watchpoint (self);
+ return this->beneath->stopped_by_watchpoint ();
}
-static int
-tdefault_stopped_by_watchpoint (struct target_ops *self)
+int
+dummy_target::stopped_by_watchpoint ()
{
return 0;
}
-static int
-debug_stopped_by_watchpoint (struct target_ops *self)
+int
+debug_target::stopped_by_watchpoint ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_stopped_by_watchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_stopped_by_watchpoint (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_stopped_by_watchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_by_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->stopped_by_watchpoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_by_watchpoint (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_stopped_data_address (struct target_ops *self, CORE_ADDR *arg1)
+int
+target_ops::have_steppable_watchpoint ()
{
- self = self->beneath;
- return self->to_stopped_data_address (self, arg1);
+ return this->beneath->have_steppable_watchpoint ();
}
-static int
-tdefault_stopped_data_address (struct target_ops *self, CORE_ADDR *arg1)
+int
+dummy_target::have_steppable_watchpoint ()
{
return 0;
}
-static int
-debug_stopped_data_address (struct target_ops *self, CORE_ADDR *arg1)
+int
+debug_target::have_steppable_watchpoint ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_stopped_data_address (...)\n", debug_target.to_shortname);
- result = debug_target.to_stopped_data_address (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_stopped_data_address (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->have_steppable_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->have_steppable_watchpoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->have_steppable_watchpoint (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+bool
+target_ops::have_continuable_watchpoint ()
+{
+ return this->beneath->have_continuable_watchpoint ();
+}
+
+bool
+dummy_target::have_continuable_watchpoint ()
+{
+ return 0;
+}
+
+bool
+debug_target::have_continuable_watchpoint ()
+{
+ bool result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->have_continuable_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->have_continuable_watchpoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->have_continuable_watchpoint (", this->beneath->shortname ());
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_bool (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
+int
+target_ops::stopped_data_address (CORE_ADDR *arg0)
+{
+ return this->beneath->stopped_data_address (arg0);
+}
+
+int
+dummy_target::stopped_data_address (CORE_ADDR *arg0)
{
- self = self->beneath;
- return self->to_watchpoint_addr_within_range (self, arg1, arg2, arg3);
+ return 0;
}
-static int
-debug_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3)
+int
+debug_target::stopped_data_address (CORE_ADDR *arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_watchpoint_addr_within_range (...)\n", debug_target.to_shortname);
- result = debug_target.to_watchpoint_addr_within_range (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_watchpoint_addr_within_range (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->stopped_data_address (...)\n", this->beneath->shortname ());
+ result = this->beneath->stopped_data_address (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->stopped_data_address (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR_p (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2)
+int
+target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
+{
+ return this->beneath->watchpoint_addr_within_range (arg0, arg1, arg2);
+}
+
+int
+dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
{
- self = self->beneath;
- return self->to_region_ok_for_hw_watchpoint (self, arg1, arg2);
+ return default_watchpoint_addr_within_range (this, arg0, arg1, arg2);
}
-static int
-debug_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2)
+int
+debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_region_ok_for_hw_watchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_region_ok_for_hw_watchpoint (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_region_ok_for_hw_watchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath->shortname ());
+ result = this->beneath->watchpoint_addr_within_range (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->watchpoint_addr_within_range (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
fputs_unfiltered (", ", gdb_stdlog);
@@ -762,528 +1075,541 @@ debug_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR arg1, int
return result;
}
-static int
-delegate_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
+int
+target_ops::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
+{
+ return this->beneath->region_ok_for_hw_watchpoint (arg0, arg1);
+}
+
+int
+dummy_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
+{
+ return default_region_ok_for_hw_watchpoint (this, arg0, arg1);
+}
+
+int
+debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
{
- self = self->beneath;
- return self->to_can_accel_watchpoint_condition (self, arg1, arg2, arg3, arg4);
+ int result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->region_ok_for_hw_watchpoint (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->region_ok_for_hw_watchpoint (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
+ fputs_unfiltered (", ", gdb_stdlog);
+ target_debug_print_int (arg1);
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_int (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
}
-static int
-tdefault_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
+int
+target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
+{
+ return this->beneath->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
+}
+
+int
+dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
{
return 0;
}
-static int
-debug_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1, int arg2, int arg3, struct expression *arg4)
+int
+debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_accel_watchpoint_condition (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_accel_watchpoint_condition (&debug_target, arg1, arg2, arg3, arg4);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_accel_watchpoint_condition (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg1);
+ target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_expression_p (arg4);
+ target_debug_print_struct_expression_p (arg3);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2)
+int
+target_ops::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
{
- self = self->beneath;
- return self->to_masked_watch_num_registers (self, arg1, arg2);
+ return this->beneath->masked_watch_num_registers (arg0, arg1);
}
-static int
-tdefault_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2)
+int
+dummy_target::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
{
return -1;
}
-static int
-debug_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2)
+int
+debug_target::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_masked_watch_num_registers (...)\n", debug_target.to_shortname);
- result = debug_target.to_masked_watch_num_registers (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_masked_watch_num_registers (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->masked_watch_num_registers (...)\n", this->beneath->shortname ());
+ result = this->beneath->masked_watch_num_registers (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->masked_watch_num_registers (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_can_do_single_step (struct target_ops *self)
+int
+target_ops::can_do_single_step ()
{
- self = self->beneath;
- return self->to_can_do_single_step (self);
+ return this->beneath->can_do_single_step ();
}
-static int
-tdefault_can_do_single_step (struct target_ops *self)
+int
+dummy_target::can_do_single_step ()
{
return -1;
}
-static int
-debug_can_do_single_step (struct target_ops *self)
+int
+debug_target::can_do_single_step ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_do_single_step (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_do_single_step (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_do_single_step (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_do_single_step (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_do_single_step ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_do_single_step (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_terminal_init (struct target_ops *self)
+bool
+target_ops::supports_terminal_ours ()
+{
+ return this->beneath->supports_terminal_ours ();
+}
+
+bool
+dummy_target::supports_terminal_ours ()
+{
+ return 0;
+}
+
+bool
+debug_target::supports_terminal_ours ()
+{
+ bool result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_terminal_ours (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_terminal_ours ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_terminal_ours (", this->beneath->shortname ());
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_bool (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
+void
+target_ops::terminal_init ()
{
- self = self->beneath;
- self->to_terminal_init (self);
+ this->beneath->terminal_init ();
}
-static void
-tdefault_terminal_init (struct target_ops *self)
+void
+dummy_target::terminal_init ()
{
}
-static void
-debug_terminal_init (struct target_ops *self)
+void
+debug_target::terminal_init ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_terminal_init (...)\n", debug_target.to_shortname);
- debug_target.to_terminal_init (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_terminal_init (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->terminal_init (...)\n", this->beneath->shortname ());
+ this->beneath->terminal_init ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->terminal_init (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_terminal_inferior (struct target_ops *self)
+void
+target_ops::terminal_inferior ()
{
- self = self->beneath;
- self->to_terminal_inferior (self);
+ this->beneath->terminal_inferior ();
}
-static void
-tdefault_terminal_inferior (struct target_ops *self)
+void
+dummy_target::terminal_inferior ()
{
}
-static void
-debug_terminal_inferior (struct target_ops *self)
+void
+debug_target::terminal_inferior ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_terminal_inferior (...)\n", debug_target.to_shortname);
- debug_target.to_terminal_inferior (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_terminal_inferior (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->terminal_inferior (...)\n", this->beneath->shortname ());
+ this->beneath->terminal_inferior ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->terminal_inferior (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_terminal_ours_for_output (struct target_ops *self)
+void
+target_ops::terminal_ours_for_output ()
{
- self = self->beneath;
- self->to_terminal_ours_for_output (self);
+ this->beneath->terminal_ours_for_output ();
}
-static void
-tdefault_terminal_ours_for_output (struct target_ops *self)
+void
+dummy_target::terminal_ours_for_output ()
{
}
-static void
-debug_terminal_ours_for_output (struct target_ops *self)
+void
+debug_target::terminal_ours_for_output ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_terminal_ours_for_output (...)\n", debug_target.to_shortname);
- debug_target.to_terminal_ours_for_output (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_terminal_ours_for_output (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->terminal_ours_for_output (...)\n", this->beneath->shortname ());
+ this->beneath->terminal_ours_for_output ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->terminal_ours_for_output (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_terminal_ours (struct target_ops *self)
+void
+target_ops::terminal_ours ()
{
- self = self->beneath;
- self->to_terminal_ours (self);
+ this->beneath->terminal_ours ();
}
-static void
-tdefault_terminal_ours (struct target_ops *self)
+void
+dummy_target::terminal_ours ()
{
}
-static void
-debug_terminal_ours (struct target_ops *self)
+void
+debug_target::terminal_ours ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_terminal_ours (...)\n", debug_target.to_shortname);
- debug_target.to_terminal_ours (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_terminal_ours (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->terminal_ours (...)\n", this->beneath->shortname ());
+ this->beneath->terminal_ours ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->terminal_ours (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_terminal_info (struct target_ops *self, const char *arg1, int arg2)
+void
+target_ops::terminal_info (const char *arg0, int arg1)
{
- self = self->beneath;
- self->to_terminal_info (self, arg1, arg2);
+ this->beneath->terminal_info (arg0, arg1);
}
-static void
-debug_terminal_info (struct target_ops *self, const char *arg1, int arg2)
+void
+dummy_target::terminal_info (const char *arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_terminal_info (...)\n", debug_target.to_shortname);
- debug_target.to_terminal_info (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_terminal_info (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ default_terminal_info (this, arg0, arg1);
+}
+
+void
+debug_target::terminal_info (const char *arg0, int arg1)
+{
+ fprintf_unfiltered (gdb_stdlog, "-> %s->terminal_info (...)\n", this->beneath->shortname ());
+ this->beneath->terminal_info (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->terminal_info (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_kill (struct target_ops *self)
+void
+target_ops::kill ()
{
- self = self->beneath;
- self->to_kill (self);
+ this->beneath->kill ();
}
-static void
-tdefault_kill (struct target_ops *self)
+void
+dummy_target::kill ()
{
noprocess ();
}
-static void
-debug_kill (struct target_ops *self)
+void
+debug_target::kill ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_kill (...)\n", debug_target.to_shortname);
- debug_target.to_kill (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_kill (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->kill (...)\n", this->beneath->shortname ());
+ this->beneath->kill ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->kill (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_load (struct target_ops *self, const char *arg1, int arg2)
+void
+target_ops::load (const char *arg0, int arg1)
{
- self = self->beneath;
- self->to_load (self, arg1, arg2);
+ this->beneath->load (arg0, arg1);
}
-static void
-tdefault_load (struct target_ops *self, const char *arg1, int arg2)
+void
+dummy_target::load (const char *arg0, int arg1)
{
tcomplain ();
}
-static void
-debug_load (struct target_ops *self, const char *arg1, int arg2)
+void
+debug_target::load (const char *arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_load (...)\n", debug_target.to_shortname);
- debug_target.to_load (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_load (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->load (...)\n", this->beneath->shortname ());
+ this->beneath->load (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->load (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_post_startup_inferior (struct target_ops *self, ptid_t arg1)
+void
+target_ops::post_startup_inferior (ptid_t arg0)
{
- self = self->beneath;
- self->to_post_startup_inferior (self, arg1);
+ this->beneath->post_startup_inferior (arg0);
}
-static void
-tdefault_post_startup_inferior (struct target_ops *self, ptid_t arg1)
+void
+dummy_target::post_startup_inferior (ptid_t arg0)
{
}
-static void
-debug_post_startup_inferior (struct target_ops *self, ptid_t arg1)
+void
+debug_target::post_startup_inferior (ptid_t arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_post_startup_inferior (...)\n", debug_target.to_shortname);
- debug_target.to_post_startup_inferior (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_post_startup_inferior (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->post_startup_inferior (...)\n", this->beneath->shortname ());
+ this->beneath->post_startup_inferior (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->post_startup_inferior (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_insert_fork_catchpoint (struct target_ops *self, int arg1)
+int
+target_ops::insert_fork_catchpoint (int arg0)
{
- self = self->beneath;
- return self->to_insert_fork_catchpoint (self, arg1);
+ return this->beneath->insert_fork_catchpoint (arg0);
}
-static int
-tdefault_insert_fork_catchpoint (struct target_ops *self, int arg1)
+int
+dummy_target::insert_fork_catchpoint (int arg0)
{
return 1;
}
-static int
-debug_insert_fork_catchpoint (struct target_ops *self, int arg1)
+int
+debug_target::insert_fork_catchpoint (int arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_fork_catchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_insert_fork_catchpoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insert_fork_catchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insert_fork_catchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->insert_fork_catchpoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insert_fork_catchpoint (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_remove_fork_catchpoint (struct target_ops *self, int arg1)
+int
+target_ops::remove_fork_catchpoint (int arg0)
{
- self = self->beneath;
- return self->to_remove_fork_catchpoint (self, arg1);
+ return this->beneath->remove_fork_catchpoint (arg0);
}
-static int
-tdefault_remove_fork_catchpoint (struct target_ops *self, int arg1)
+int
+dummy_target::remove_fork_catchpoint (int arg0)
{
return 1;
}
-static int
-debug_remove_fork_catchpoint (struct target_ops *self, int arg1)
+int
+debug_target::remove_fork_catchpoint (int arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_fork_catchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_remove_fork_catchpoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_remove_fork_catchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->remove_fork_catchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->remove_fork_catchpoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->remove_fork_catchpoint (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_insert_vfork_catchpoint (struct target_ops *self, int arg1)
+int
+target_ops::insert_vfork_catchpoint (int arg0)
{
- self = self->beneath;
- return self->to_insert_vfork_catchpoint (self, arg1);
+ return this->beneath->insert_vfork_catchpoint (arg0);
}
-static int
-tdefault_insert_vfork_catchpoint (struct target_ops *self, int arg1)
+int
+dummy_target::insert_vfork_catchpoint (int arg0)
{
return 1;
}
-static int
-debug_insert_vfork_catchpoint (struct target_ops *self, int arg1)
+int
+debug_target::insert_vfork_catchpoint (int arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_vfork_catchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_insert_vfork_catchpoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insert_vfork_catchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insert_vfork_catchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->insert_vfork_catchpoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insert_vfork_catchpoint (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_remove_vfork_catchpoint (struct target_ops *self, int arg1)
+int
+target_ops::remove_vfork_catchpoint (int arg0)
{
- self = self->beneath;
- return self->to_remove_vfork_catchpoint (self, arg1);
+ return this->beneath->remove_vfork_catchpoint (arg0);
}
-static int
-tdefault_remove_vfork_catchpoint (struct target_ops *self, int arg1)
+int
+dummy_target::remove_vfork_catchpoint (int arg0)
{
return 1;
}
-static int
-debug_remove_vfork_catchpoint (struct target_ops *self, int arg1)
+int
+debug_target::remove_vfork_catchpoint (int arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_vfork_catchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_remove_vfork_catchpoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_remove_vfork_catchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->remove_vfork_catchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->remove_vfork_catchpoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->remove_vfork_catchpoint (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_follow_fork (struct target_ops *self, int arg1, int arg2)
+int
+target_ops::follow_fork (int arg0, int arg1)
{
- self = self->beneath;
- return self->to_follow_fork (self, arg1, arg2);
+ return this->beneath->follow_fork (arg0, arg1);
}
-static int
-debug_follow_fork (struct target_ops *self, int arg1, int arg2)
+int
+dummy_target::follow_fork (int arg0, int arg1)
+{
+ return default_follow_fork (this, arg0, arg1);
+}
+
+int
+debug_target::follow_fork (int arg0, int arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_follow_fork (...)\n", debug_target.to_shortname);
- result = debug_target.to_follow_fork (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_follow_fork (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->follow_fork (...)\n", this->beneath->shortname ());
+ result = this->beneath->follow_fork (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->follow_fork (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_insert_exec_catchpoint (struct target_ops *self, int arg1)
+int
+target_ops::insert_exec_catchpoint (int arg0)
{
- self = self->beneath;
- return self->to_insert_exec_catchpoint (self, arg1);
+ return this->beneath->insert_exec_catchpoint (arg0);
}
-static int
-tdefault_insert_exec_catchpoint (struct target_ops *self, int arg1)
+int
+dummy_target::insert_exec_catchpoint (int arg0)
{
return 1;
}
-static int
-debug_insert_exec_catchpoint (struct target_ops *self, int arg1)
+int
+debug_target::insert_exec_catchpoint (int arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insert_exec_catchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_insert_exec_catchpoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insert_exec_catchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insert_exec_catchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->insert_exec_catchpoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insert_exec_catchpoint (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_remove_exec_catchpoint (struct target_ops *self, int arg1)
+int
+target_ops::remove_exec_catchpoint (int arg0)
{
- self = self->beneath;
- return self->to_remove_exec_catchpoint (self, arg1);
+ return this->beneath->remove_exec_catchpoint (arg0);
}
-static int
-tdefault_remove_exec_catchpoint (struct target_ops *self, int arg1)
+int
+dummy_target::remove_exec_catchpoint (int arg0)
{
return 1;
}
-static int
-debug_remove_exec_catchpoint (struct target_ops *self, int arg1)
+int
+debug_target::remove_exec_catchpoint (int arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_remove_exec_catchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_remove_exec_catchpoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_remove_exec_catchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->remove_exec_catchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->remove_exec_catchpoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->remove_exec_catchpoint (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_follow_exec (struct target_ops *self, struct inferior *arg1, char *arg2)
+void
+target_ops::follow_exec (struct inferior *arg0, char *arg1)
{
- self = self->beneath;
- self->to_follow_exec (self, arg1, arg2);
+ this->beneath->follow_exec (arg0, arg1);
}
-static void
-tdefault_follow_exec (struct target_ops *self, struct inferior *arg1, char *arg2)
+void
+dummy_target::follow_exec (struct inferior *arg0, char *arg1)
{
}
-static void
-debug_follow_exec (struct target_ops *self, struct inferior *arg1, char *arg2)
+void
+debug_target::follow_exec (struct inferior *arg0, char *arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_follow_exec (...)\n", debug_target.to_shortname);
- debug_target.to_follow_exec (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_follow_exec (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->follow_exec (...)\n", this->beneath->shortname ());
+ this->beneath->follow_exec (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->follow_exec (", this->beneath->shortname ());
+ target_debug_print_struct_inferior_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_inferior_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_char_p (arg2);
+ target_debug_print_char_p (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_set_syscall_catchpoint (struct target_ops *self, int arg1, int arg2, int arg3, int arg4, int *arg5)
+int
+target_ops::set_syscall_catchpoint (int arg0, int arg1, int arg2, int arg3, int *arg4)
{
- self = self->beneath;
- return self->to_set_syscall_catchpoint (self, arg1, arg2, arg3, arg4, arg5);
+ return this->beneath->set_syscall_catchpoint (arg0, arg1, arg2, arg3, arg4);
}
-static int
-tdefault_set_syscall_catchpoint (struct target_ops *self, int arg1, int arg2, int arg3, int arg4, int *arg5)
+int
+dummy_target::set_syscall_catchpoint (int arg0, int arg1, int arg2, int arg3, int *arg4)
{
return 1;
}
-static int
-debug_set_syscall_catchpoint (struct target_ops *self, int arg1, int arg2, int arg3, int arg4, int *arg5)
+int
+debug_target::set_syscall_catchpoint (int arg0, int arg1, int arg2, int arg3, int *arg4)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_set_syscall_catchpoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_set_syscall_catchpoint (&debug_target, arg1, arg2, arg3, arg4, arg5);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_set_syscall_catchpoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->set_syscall_catchpoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->set_syscall_catchpoint (arg0, arg1, arg2, arg3, arg4);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->set_syscall_catchpoint (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
@@ -1291,3431 +1617,2661 @@ debug_set_syscall_catchpoint (struct target_ops *self, int arg1, int arg2, int a
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg3);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg4);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int_p (arg5);
+ target_debug_print_int_p (arg4);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_has_exited (struct target_ops *self, int arg1, int arg2, int *arg3)
+int
+target_ops::has_exited (int arg0, int arg1, int *arg2)
{
- self = self->beneath;
- return self->to_has_exited (self, arg1, arg2, arg3);
+ return this->beneath->has_exited (arg0, arg1, arg2);
}
-static int
-tdefault_has_exited (struct target_ops *self, int arg1, int arg2, int *arg3)
+int
+dummy_target::has_exited (int arg0, int arg1, int *arg2)
{
return 0;
}
-static int
-debug_has_exited (struct target_ops *self, int arg1, int arg2, int *arg3)
+int
+debug_target::has_exited (int arg0, int arg1, int *arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_has_exited (...)\n", debug_target.to_shortname);
- result = debug_target.to_has_exited (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_has_exited (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->has_exited (...)\n", this->beneath->shortname ());
+ result = this->beneath->has_exited (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->has_exited (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int_p (arg3);
+ target_debug_print_int_p (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_mourn_inferior (struct target_ops *self)
-{
- self = self->beneath;
- self->to_mourn_inferior (self);
-}
-
-static void
-debug_mourn_inferior (struct target_ops *self)
-{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_mourn_inferior (...)\n", debug_target.to_shortname);
- debug_target.to_mourn_inferior (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_mourn_inferior (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (")\n", gdb_stdlog);
-}
-
-static int
-delegate_can_run (struct target_ops *self)
+void
+target_ops::mourn_inferior ()
{
- self = self->beneath;
- return self->to_can_run (self);
+ this->beneath->mourn_inferior ();
}
-static int
-tdefault_can_run (struct target_ops *self)
+void
+dummy_target::mourn_inferior ()
{
- return 0;
+ default_mourn_inferior (this);
}
-static int
-debug_can_run (struct target_ops *self)
+void
+debug_target::mourn_inferior ()
{
- int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_run (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_run (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_run (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (") = ", gdb_stdlog);
- target_debug_print_int (result);
- fputs_unfiltered ("\n", gdb_stdlog);
- return result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->mourn_inferior (...)\n", this->beneath->shortname ());
+ this->beneath->mourn_inferior ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->mourn_inferior (", this->beneath->shortname ());
+ fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_pass_signals (struct target_ops *self, int arg1, unsigned char * arg2)
+void
+target_ops::pass_signals (int arg0, unsigned char * arg1)
{
- self = self->beneath;
- self->to_pass_signals (self, arg1, arg2);
+ this->beneath->pass_signals (arg0, arg1);
}
-static void
-tdefault_pass_signals (struct target_ops *self, int arg1, unsigned char * arg2)
+void
+dummy_target::pass_signals (int arg0, unsigned char * arg1)
{
}
-static void
-debug_pass_signals (struct target_ops *self, int arg1, unsigned char * arg2)
+void
+debug_target::pass_signals (int arg0, unsigned char * arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_pass_signals (...)\n", debug_target.to_shortname);
- debug_target.to_pass_signals (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_pass_signals (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->pass_signals (...)\n", this->beneath->shortname ());
+ this->beneath->pass_signals (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->pass_signals (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_signals (arg2);
+ target_debug_print_signals (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_program_signals (struct target_ops *self, int arg1, unsigned char * arg2)
+void
+target_ops::program_signals (int arg0, unsigned char * arg1)
{
- self = self->beneath;
- self->to_program_signals (self, arg1, arg2);
+ this->beneath->program_signals (arg0, arg1);
}
-static void
-tdefault_program_signals (struct target_ops *self, int arg1, unsigned char * arg2)
+void
+dummy_target::program_signals (int arg0, unsigned char * arg1)
{
}
-static void
-debug_program_signals (struct target_ops *self, int arg1, unsigned char * arg2)
+void
+debug_target::program_signals (int arg0, unsigned char * arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_program_signals (...)\n", debug_target.to_shortname);
- debug_target.to_program_signals (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_program_signals (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->program_signals (...)\n", this->beneath->shortname ());
+ this->beneath->program_signals (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->program_signals (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_signals (arg2);
+ target_debug_print_signals (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_thread_alive (struct target_ops *self, ptid_t arg1)
+int
+target_ops::thread_alive (ptid_t arg0)
{
- self = self->beneath;
- return self->to_thread_alive (self, arg1);
+ return this->beneath->thread_alive (arg0);
}
-static int
-tdefault_thread_alive (struct target_ops *self, ptid_t arg1)
+int
+dummy_target::thread_alive (ptid_t arg0)
{
return 0;
}
-static int
-debug_thread_alive (struct target_ops *self, ptid_t arg1)
+int
+debug_target::thread_alive (ptid_t arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_thread_alive (...)\n", debug_target.to_shortname);
- result = debug_target.to_thread_alive (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_thread_alive (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->thread_alive (...)\n", this->beneath->shortname ());
+ result = this->beneath->thread_alive (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->thread_alive (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_update_thread_list (struct target_ops *self)
+void
+target_ops::update_thread_list ()
{
- self = self->beneath;
- self->to_update_thread_list (self);
+ this->beneath->update_thread_list ();
}
-static void
-tdefault_update_thread_list (struct target_ops *self)
+void
+dummy_target::update_thread_list ()
{
}
-static void
-debug_update_thread_list (struct target_ops *self)
+void
+debug_target::update_thread_list ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_update_thread_list (...)\n", debug_target.to_shortname);
- debug_target.to_update_thread_list (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_update_thread_list (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->update_thread_list (...)\n", this->beneath->shortname ());
+ this->beneath->update_thread_list ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->update_thread_list (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static char *
-delegate_pid_to_str (struct target_ops *self, ptid_t arg1)
+char *
+target_ops::pid_to_str (ptid_t arg0)
+{
+ return this->beneath->pid_to_str (arg0);
+}
+
+char *
+dummy_target::pid_to_str (ptid_t arg0)
{
- self = self->beneath;
- return self->to_pid_to_str (self, arg1);
+ return default_pid_to_str (this, arg0);
}
-static char *
-debug_pid_to_str (struct target_ops *self, ptid_t arg1)
+char *
+debug_target::pid_to_str (ptid_t arg0)
{
char * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_pid_to_str (...)\n", debug_target.to_shortname);
- result = debug_target.to_pid_to_str (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_pid_to_str (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->pid_to_str (...)\n", this->beneath->shortname ());
+ result = this->beneath->pid_to_str (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->pid_to_str (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_char_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static char *
-delegate_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
+char *
+target_ops::extra_thread_info (struct thread_info *arg0)
{
- self = self->beneath;
- return self->to_extra_thread_info (self, arg1);
+ return this->beneath->extra_thread_info (arg0);
}
-static char *
-tdefault_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
+char *
+dummy_target::extra_thread_info (struct thread_info *arg0)
{
return NULL;
}
-static char *
-debug_extra_thread_info (struct target_ops *self, struct thread_info *arg1)
+char *
+debug_target::extra_thread_info (struct thread_info *arg0)
{
char * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_extra_thread_info (...)\n", debug_target.to_shortname);
- result = debug_target.to_extra_thread_info (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_extra_thread_info (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_thread_info_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->extra_thread_info (...)\n", this->beneath->shortname ());
+ result = this->beneath->extra_thread_info (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->extra_thread_info (", this->beneath->shortname ());
+ target_debug_print_struct_thread_info_p (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_char_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static const char *
-delegate_thread_name (struct target_ops *self, struct thread_info *arg1)
+const char *
+target_ops::thread_name (struct thread_info *arg0)
{
- self = self->beneath;
- return self->to_thread_name (self, arg1);
+ return this->beneath->thread_name (arg0);
}
-static const char *
-tdefault_thread_name (struct target_ops *self, struct thread_info *arg1)
+const char *
+dummy_target::thread_name (struct thread_info *arg0)
{
return NULL;
}
-static const char *
-debug_thread_name (struct target_ops *self, struct thread_info *arg1)
+const char *
+debug_target::thread_name (struct thread_info *arg0)
{
const char * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_thread_name (...)\n", debug_target.to_shortname);
- result = debug_target.to_thread_name (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_thread_name (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_thread_info_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->thread_name (...)\n", this->beneath->shortname ());
+ result = this->beneath->thread_name (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->thread_name (", this->beneath->shortname ());
+ target_debug_print_struct_thread_info_p (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_const_char_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_stop (struct target_ops *self, ptid_t arg1)
+void
+target_ops::stop (ptid_t arg0)
{
- self = self->beneath;
- self->to_stop (self, arg1);
+ this->beneath->stop (arg0);
}
-static void
-tdefault_stop (struct target_ops *self, ptid_t arg1)
+void
+dummy_target::stop (ptid_t arg0)
{
}
-static void
-debug_stop (struct target_ops *self, ptid_t arg1)
+void
+debug_target::stop (ptid_t arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_stop (...)\n", debug_target.to_shortname);
- debug_target.to_stop (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_stop (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->stop (...)\n", this->beneath->shortname ());
+ this->beneath->stop (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->stop (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_interrupt (struct target_ops *self, ptid_t arg1)
+void
+target_ops::interrupt (ptid_t arg0)
{
- self = self->beneath;
- self->to_interrupt (self, arg1);
+ this->beneath->interrupt (arg0);
}
-static void
-tdefault_interrupt (struct target_ops *self, ptid_t arg1)
+void
+dummy_target::interrupt (ptid_t arg0)
{
}
-static void
-debug_interrupt (struct target_ops *self, ptid_t arg1)
+void
+debug_target::interrupt (ptid_t arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_interrupt (...)\n", debug_target.to_shortname);
- debug_target.to_interrupt (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_interrupt (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->interrupt (...)\n", this->beneath->shortname ());
+ this->beneath->interrupt (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->interrupt (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_pass_ctrlc (struct target_ops *self)
+void
+target_ops::pass_ctrlc ()
{
- self = self->beneath;
- self->to_pass_ctrlc (self);
+ this->beneath->pass_ctrlc ();
}
-static void
-debug_pass_ctrlc (struct target_ops *self)
+void
+dummy_target::pass_ctrlc ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_pass_ctrlc (...)\n", debug_target.to_shortname);
- debug_target.to_pass_ctrlc (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_pass_ctrlc (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ default_target_pass_ctrlc (this);
+}
+
+void
+debug_target::pass_ctrlc ()
+{
+ fprintf_unfiltered (gdb_stdlog, "-> %s->pass_ctrlc (...)\n", this->beneath->shortname ());
+ this->beneath->pass_ctrlc ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->pass_ctrlc (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_rcmd (struct target_ops *self, const char *arg1, struct ui_file *arg2)
+void
+target_ops::rcmd (const char *arg0, struct ui_file *arg1)
{
- self = self->beneath;
- self->to_rcmd (self, arg1, arg2);
+ this->beneath->rcmd (arg0, arg1);
}
-static void
-debug_rcmd (struct target_ops *self, const char *arg1, struct ui_file *arg2)
+void
+dummy_target::rcmd (const char *arg0, struct ui_file *arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_rcmd (...)\n", debug_target.to_shortname);
- debug_target.to_rcmd (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_rcmd (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ default_rcmd (this, arg0, arg1);
+}
+
+void
+debug_target::rcmd (const char *arg0, struct ui_file *arg1)
+{
+ fprintf_unfiltered (gdb_stdlog, "-> %s->rcmd (...)\n", this->beneath->shortname ());
+ this->beneath->rcmd (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->rcmd (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_ui_file_p (arg2);
+ target_debug_print_struct_ui_file_p (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static char *
-delegate_pid_to_exec_file (struct target_ops *self, int arg1)
+char *
+target_ops::pid_to_exec_file (int arg0)
{
- self = self->beneath;
- return self->to_pid_to_exec_file (self, arg1);
+ return this->beneath->pid_to_exec_file (arg0);
}
-static char *
-tdefault_pid_to_exec_file (struct target_ops *self, int arg1)
+char *
+dummy_target::pid_to_exec_file (int arg0)
{
return NULL;
}
-static char *
-debug_pid_to_exec_file (struct target_ops *self, int arg1)
+char *
+debug_target::pid_to_exec_file (int arg0)
{
char * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_pid_to_exec_file (...)\n", debug_target.to_shortname);
- result = debug_target.to_pid_to_exec_file (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_pid_to_exec_file (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->pid_to_exec_file (...)\n", this->beneath->shortname ());
+ result = this->beneath->pid_to_exec_file (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->pid_to_exec_file (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_char_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_log_command (struct target_ops *self, const char *arg1)
+void
+target_ops::log_command (const char *arg0)
{
- self = self->beneath;
- self->to_log_command (self, arg1);
+ this->beneath->log_command (arg0);
}
-static void
-tdefault_log_command (struct target_ops *self, const char *arg1)
+void
+dummy_target::log_command (const char *arg0)
{
}
-static void
-debug_log_command (struct target_ops *self, const char *arg1)
+void
+debug_target::log_command (const char *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_log_command (...)\n", debug_target.to_shortname);
- debug_target.to_log_command (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_log_command (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->log_command (...)\n", this->beneath->shortname ());
+ this->beneath->log_command (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->log_command (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static struct target_section_table *
-delegate_get_section_table (struct target_ops *self)
+struct target_section_table *
+target_ops::get_section_table ()
{
- self = self->beneath;
- return self->to_get_section_table (self);
+ return this->beneath->get_section_table ();
}
-static struct target_section_table *
-tdefault_get_section_table (struct target_ops *self)
+struct target_section_table *
+dummy_target::get_section_table ()
{
return NULL;
}
-static struct target_section_table *
-debug_get_section_table (struct target_ops *self)
+struct target_section_table *
+debug_target::get_section_table ()
{
struct target_section_table * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_section_table (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_section_table (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_section_table (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_section_table (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_section_table ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_section_table (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_struct_target_section_table_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_can_async_p (struct target_ops *self)
+thread_control_capabilities
+target_ops::get_thread_control_capabilities ()
{
- self = self->beneath;
- return self->to_can_async_p (self);
+ return this->beneath->get_thread_control_capabilities ();
}
-static int
-tdefault_can_async_p (struct target_ops *self)
+thread_control_capabilities
+dummy_target::get_thread_control_capabilities ()
+{
+ return tc_none;
+}
+
+thread_control_capabilities
+debug_target::get_thread_control_capabilities ()
+{
+ thread_control_capabilities result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_thread_control_capabilities (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_thread_control_capabilities ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_thread_control_capabilities (", this->beneath->shortname ());
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_thread_control_capabilities (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
+bool
+target_ops::attach_no_wait ()
+{
+ return this->beneath->attach_no_wait ();
+}
+
+bool
+dummy_target::attach_no_wait ()
+{
+ return 0;
+}
+
+bool
+debug_target::attach_no_wait ()
+{
+ bool result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->attach_no_wait (...)\n", this->beneath->shortname ());
+ result = this->beneath->attach_no_wait ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->attach_no_wait (", this->beneath->shortname ());
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_bool (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
+int
+target_ops::can_async_p ()
+{
+ return this->beneath->can_async_p ();
+}
+
+int
+dummy_target::can_async_p ()
{
return 0;
}
-static int
-debug_can_async_p (struct target_ops *self)
+int
+debug_target::can_async_p ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_async_p (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_async_p (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_async_p (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_async_p (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_async_p ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_async_p (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_is_async_p (struct target_ops *self)
+int
+target_ops::is_async_p ()
{
- self = self->beneath;
- return self->to_is_async_p (self);
+ return this->beneath->is_async_p ();
}
-static int
-tdefault_is_async_p (struct target_ops *self)
+int
+dummy_target::is_async_p ()
{
return 0;
}
-static int
-debug_is_async_p (struct target_ops *self)
+int
+debug_target::is_async_p ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_is_async_p (...)\n", debug_target.to_shortname);
- result = debug_target.to_is_async_p (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_is_async_p (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->is_async_p (...)\n", this->beneath->shortname ());
+ result = this->beneath->is_async_p ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->is_async_p (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_async (struct target_ops *self, int arg1)
+void
+target_ops::async (int arg0)
{
- self = self->beneath;
- self->to_async (self, arg1);
+ this->beneath->async (arg0);
}
-static void
-tdefault_async (struct target_ops *self, int arg1)
+void
+dummy_target::async (int arg0)
{
tcomplain ();
}
-static void
-debug_async (struct target_ops *self, int arg1)
+void
+debug_target::async (int arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_async (...)\n", debug_target.to_shortname);
- debug_target.to_async (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_async (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->async (...)\n", this->beneath->shortname ());
+ this->beneath->async (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->async (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_thread_events (struct target_ops *self, int arg1)
+void
+target_ops::thread_events (int arg0)
{
- self = self->beneath;
- self->to_thread_events (self, arg1);
+ this->beneath->thread_events (arg0);
}
-static void
-tdefault_thread_events (struct target_ops *self, int arg1)
+void
+dummy_target::thread_events (int arg0)
{
}
-static void
-debug_thread_events (struct target_ops *self, int arg1)
+void
+debug_target::thread_events (int arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_thread_events (...)\n", debug_target.to_shortname);
- debug_target.to_thread_events (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_thread_events (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->thread_events (...)\n", this->beneath->shortname ());
+ this->beneath->thread_events (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->thread_events (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_supports_non_stop (struct target_ops *self)
+int
+target_ops::supports_non_stop ()
{
- self = self->beneath;
- return self->to_supports_non_stop (self);
+ return this->beneath->supports_non_stop ();
}
-static int
-tdefault_supports_non_stop (struct target_ops *self)
+int
+dummy_target::supports_non_stop ()
{
return 0;
}
-static int
-debug_supports_non_stop (struct target_ops *self)
+int
+debug_target::supports_non_stop ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_non_stop (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_non_stop (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_non_stop (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_non_stop (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_non_stop ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_non_stop (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_always_non_stop_p (struct target_ops *self)
+int
+target_ops::always_non_stop_p ()
{
- self = self->beneath;
- return self->to_always_non_stop_p (self);
+ return this->beneath->always_non_stop_p ();
}
-static int
-tdefault_always_non_stop_p (struct target_ops *self)
+int
+dummy_target::always_non_stop_p ()
{
return 0;
}
-static int
-debug_always_non_stop_p (struct target_ops *self)
+int
+debug_target::always_non_stop_p ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_always_non_stop_p (...)\n", debug_target.to_shortname);
- result = debug_target.to_always_non_stop_p (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_always_non_stop_p (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->always_non_stop_p (...)\n", this->beneath->shortname ());
+ result = this->beneath->always_non_stop_p ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->always_non_stop_p (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_find_memory_regions (struct target_ops *self, find_memory_region_ftype arg1, void *arg2)
+int
+target_ops::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
+{
+ return this->beneath->find_memory_regions (arg0, arg1);
+}
+
+int
+dummy_target::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
{
- self = self->beneath;
- return self->to_find_memory_regions (self, arg1, arg2);
+ return dummy_find_memory_regions (this, arg0, arg1);
}
-static int
-debug_find_memory_regions (struct target_ops *self, find_memory_region_ftype arg1, void *arg2)
+int
+debug_target::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_find_memory_regions (...)\n", debug_target.to_shortname);
- result = debug_target.to_find_memory_regions (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_find_memory_regions (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_find_memory_region_ftype (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->find_memory_regions (...)\n", this->beneath->shortname ());
+ result = this->beneath->find_memory_regions (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->find_memory_regions (", this->beneath->shortname ());
+ target_debug_print_find_memory_region_ftype (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_void_p (arg2);
+ target_debug_print_void_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static char *
-delegate_make_corefile_notes (struct target_ops *self, bfd *arg1, int *arg2)
+char *
+target_ops::make_corefile_notes (bfd *arg0, int *arg1)
+{
+ return this->beneath->make_corefile_notes (arg0, arg1);
+}
+
+char *
+dummy_target::make_corefile_notes (bfd *arg0, int *arg1)
{
- self = self->beneath;
- return self->to_make_corefile_notes (self, arg1, arg2);
+ return dummy_make_corefile_notes (this, arg0, arg1);
}
-static char *
-debug_make_corefile_notes (struct target_ops *self, bfd *arg1, int *arg2)
+char *
+debug_target::make_corefile_notes (bfd *arg0, int *arg1)
{
char * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_make_corefile_notes (...)\n", debug_target.to_shortname);
- result = debug_target.to_make_corefile_notes (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_make_corefile_notes (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->make_corefile_notes (...)\n", this->beneath->shortname ());
+ result = this->beneath->make_corefile_notes (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->make_corefile_notes (", this->beneath->shortname ());
+ target_debug_print_bfd_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_bfd_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int_p (arg2);
+ target_debug_print_int_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_char_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static gdb_byte *
-delegate_get_bookmark (struct target_ops *self, const char *arg1, int arg2)
+gdb_byte *
+target_ops::get_bookmark (const char *arg0, int arg1)
{
- self = self->beneath;
- return self->to_get_bookmark (self, arg1, arg2);
+ return this->beneath->get_bookmark (arg0, arg1);
}
-static gdb_byte *
-tdefault_get_bookmark (struct target_ops *self, const char *arg1, int arg2)
+gdb_byte *
+dummy_target::get_bookmark (const char *arg0, int arg1)
{
tcomplain ();
}
-static gdb_byte *
-debug_get_bookmark (struct target_ops *self, const char *arg1, int arg2)
+gdb_byte *
+debug_target::get_bookmark (const char *arg0, int arg1)
{
gdb_byte * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_bookmark (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_bookmark (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_bookmark (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_bookmark (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_bookmark (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_bookmark (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_gdb_byte_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_goto_bookmark (struct target_ops *self, const gdb_byte *arg1, int arg2)
+void
+target_ops::goto_bookmark (const gdb_byte *arg0, int arg1)
{
- self = self->beneath;
- self->to_goto_bookmark (self, arg1, arg2);
+ this->beneath->goto_bookmark (arg0, arg1);
}
-static void
-tdefault_goto_bookmark (struct target_ops *self, const gdb_byte *arg1, int arg2)
+void
+dummy_target::goto_bookmark (const gdb_byte *arg0, int arg1)
{
tcomplain ();
}
-static void
-debug_goto_bookmark (struct target_ops *self, const gdb_byte *arg1, int arg2)
+void
+debug_target::goto_bookmark (const gdb_byte *arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_goto_bookmark (...)\n", debug_target.to_shortname);
- debug_target.to_goto_bookmark (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_goto_bookmark (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->goto_bookmark (...)\n", this->beneath->shortname ());
+ this->beneath->goto_bookmark (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->goto_bookmark (", this->beneath->shortname ());
+ target_debug_print_const_gdb_byte_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_gdb_byte_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static CORE_ADDR
-delegate_get_thread_local_address (struct target_ops *self, ptid_t arg1, CORE_ADDR arg2, CORE_ADDR arg3)
+CORE_ADDR
+target_ops::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2)
{
- self = self->beneath;
- return self->to_get_thread_local_address (self, arg1, arg2, arg3);
+ return this->beneath->get_thread_local_address (arg0, arg1, arg2);
}
-static CORE_ADDR
-tdefault_get_thread_local_address (struct target_ops *self, ptid_t arg1, CORE_ADDR arg2, CORE_ADDR arg3)
+CORE_ADDR
+dummy_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2)
{
generic_tls_error ();
}
-static CORE_ADDR
-debug_get_thread_local_address (struct target_ops *self, ptid_t arg1, CORE_ADDR arg2, CORE_ADDR arg3)
+CORE_ADDR
+debug_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2)
{
CORE_ADDR result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_thread_local_address (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_thread_local_address (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_thread_local_address (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_thread_local_address (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_thread_local_address (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_thread_local_address (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ target_debug_print_CORE_ADDR (arg1);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg3);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_CORE_ADDR (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static enum target_xfer_status
-delegate_xfer_partial (struct target_ops *self, enum target_object arg1, const char *arg2, gdb_byte *arg3, const gdb_byte *arg4, ULONGEST arg5, ULONGEST arg6, ULONGEST *arg7)
+enum target_xfer_status
+target_ops::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
{
- self = self->beneath;
- return self->to_xfer_partial (self, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ return this->beneath->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5, arg6);
}
-static enum target_xfer_status
-tdefault_xfer_partial (struct target_ops *self, enum target_object arg1, const char *arg2, gdb_byte *arg3, const gdb_byte *arg4, ULONGEST arg5, ULONGEST arg6, ULONGEST *arg7)
+enum target_xfer_status
+dummy_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
{
return TARGET_XFER_E_IO;
}
-static enum target_xfer_status
-debug_xfer_partial (struct target_ops *self, enum target_object arg1, const char *arg2, gdb_byte *arg3, const gdb_byte *arg4, ULONGEST arg5, ULONGEST arg6, ULONGEST *arg7)
+enum target_xfer_status
+debug_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
{
enum target_xfer_status result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_xfer_partial (...)\n", debug_target.to_shortname);
- result = debug_target.to_xfer_partial (&debug_target, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_xfer_partial (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->xfer_partial (...)\n", this->beneath->shortname ());
+ result = this->beneath->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->xfer_partial (", this->beneath->shortname ());
+ target_debug_print_enum_target_object (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_target_object (arg1);
+ target_debug_print_const_char_p (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg2);
+ target_debug_print_gdb_byte_p (arg2);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_gdb_byte_p (arg3);
+ target_debug_print_const_gdb_byte_p (arg3);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_gdb_byte_p (arg4);
+ target_debug_print_ULONGEST (arg4);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg5);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg6);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST_p (arg7);
+ target_debug_print_ULONGEST_p (arg6);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_enum_target_xfer_status (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static ULONGEST
-delegate_get_memory_xfer_limit (struct target_ops *self)
+ULONGEST
+target_ops::get_memory_xfer_limit ()
{
- self = self->beneath;
- return self->to_get_memory_xfer_limit (self);
+ return this->beneath->get_memory_xfer_limit ();
}
-static ULONGEST
-tdefault_get_memory_xfer_limit (struct target_ops *self)
+ULONGEST
+dummy_target::get_memory_xfer_limit ()
{
return ULONGEST_MAX;
}
-static ULONGEST
-debug_get_memory_xfer_limit (struct target_ops *self)
+ULONGEST
+debug_target::get_memory_xfer_limit ()
{
ULONGEST result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_memory_xfer_limit (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_memory_xfer_limit (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_memory_xfer_limit (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_memory_xfer_limit (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_memory_xfer_limit ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_memory_xfer_limit (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_ULONGEST (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static VEC(mem_region_s) *
-delegate_memory_map (struct target_ops *self)
+VEC(mem_region_s) *
+target_ops::memory_map ()
{
- self = self->beneath;
- return self->to_memory_map (self);
+ return this->beneath->memory_map ();
}
-static VEC(mem_region_s) *
-tdefault_memory_map (struct target_ops *self)
+VEC(mem_region_s) *
+dummy_target::memory_map ()
{
return NULL;
}
-static VEC(mem_region_s) *
-debug_memory_map (struct target_ops *self)
+VEC(mem_region_s) *
+debug_target::memory_map ()
{
VEC(mem_region_s) * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_memory_map (...)\n", debug_target.to_shortname);
- result = debug_target.to_memory_map (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_memory_map (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->memory_map (...)\n", this->beneath->shortname ());
+ result = this->beneath->memory_map ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->memory_map (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_VEC_mem_region_s__p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_flash_erase (struct target_ops *self, ULONGEST arg1, LONGEST arg2)
+void
+target_ops::flash_erase (ULONGEST arg0, LONGEST arg1)
{
- self = self->beneath;
- self->to_flash_erase (self, arg1, arg2);
+ this->beneath->flash_erase (arg0, arg1);
}
-static void
-tdefault_flash_erase (struct target_ops *self, ULONGEST arg1, LONGEST arg2)
+void
+dummy_target::flash_erase (ULONGEST arg0, LONGEST arg1)
{
tcomplain ();
}
-static void
-debug_flash_erase (struct target_ops *self, ULONGEST arg1, LONGEST arg2)
+void
+debug_target::flash_erase (ULONGEST arg0, LONGEST arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_flash_erase (...)\n", debug_target.to_shortname);
- debug_target.to_flash_erase (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_flash_erase (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->flash_erase (...)\n", this->beneath->shortname ());
+ this->beneath->flash_erase (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->flash_erase (", this->beneath->shortname ());
+ target_debug_print_ULONGEST (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_LONGEST (arg2);
+ target_debug_print_LONGEST (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_flash_done (struct target_ops *self)
+void
+target_ops::flash_done ()
{
- self = self->beneath;
- self->to_flash_done (self);
+ this->beneath->flash_done ();
}
-static void
-tdefault_flash_done (struct target_ops *self)
+void
+dummy_target::flash_done ()
{
tcomplain ();
}
-static void
-debug_flash_done (struct target_ops *self)
+void
+debug_target::flash_done ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_flash_done (...)\n", debug_target.to_shortname);
- debug_target.to_flash_done (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_flash_done (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->flash_done (...)\n", this->beneath->shortname ());
+ this->beneath->flash_done ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->flash_done (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static const struct target_desc *
-delegate_read_description (struct target_ops *self)
+const struct target_desc *
+target_ops::read_description ()
{
- self = self->beneath;
- return self->to_read_description (self);
+ return this->beneath->read_description ();
}
-static const struct target_desc *
-tdefault_read_description (struct target_ops *self)
+const struct target_desc *
+dummy_target::read_description ()
{
return NULL;
}
-static const struct target_desc *
-debug_read_description (struct target_ops *self)
+const struct target_desc *
+debug_target::read_description ()
{
const struct target_desc * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_read_description (...)\n", debug_target.to_shortname);
- result = debug_target.to_read_description (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_read_description (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->read_description (...)\n", this->beneath->shortname ());
+ result = this->beneath->read_description ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->read_description (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_const_struct_target_desc_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static ptid_t
-delegate_get_ada_task_ptid (struct target_ops *self, long arg1, long arg2)
+ptid_t
+target_ops::get_ada_task_ptid (long arg0, long arg1)
+{
+ return this->beneath->get_ada_task_ptid (arg0, arg1);
+}
+
+ptid_t
+dummy_target::get_ada_task_ptid (long arg0, long arg1)
{
- self = self->beneath;
- return self->to_get_ada_task_ptid (self, arg1, arg2);
+ return default_get_ada_task_ptid (this, arg0, arg1);
}
-static ptid_t
-debug_get_ada_task_ptid (struct target_ops *self, long arg1, long arg2)
+ptid_t
+debug_target::get_ada_task_ptid (long arg0, long arg1)
{
ptid_t result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_ada_task_ptid (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_ada_task_ptid (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_ada_task_ptid (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_ada_task_ptid (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_ada_task_ptid (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_ada_task_ptid (", this->beneath->shortname ());
+ target_debug_print_long (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_long (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_long (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_ptid_t (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_auxv_parse (struct target_ops *self, gdb_byte **arg1, gdb_byte *arg2, CORE_ADDR *arg3, CORE_ADDR *arg4)
+int
+target_ops::auxv_parse (gdb_byte **arg0, gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3)
+{
+ return this->beneath->auxv_parse (arg0, arg1, arg2, arg3);
+}
+
+int
+dummy_target::auxv_parse (gdb_byte **arg0, gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3)
{
- self = self->beneath;
- return self->to_auxv_parse (self, arg1, arg2, arg3, arg4);
+ return default_auxv_parse (this, arg0, arg1, arg2, arg3);
}
-static int
-debug_auxv_parse (struct target_ops *self, gdb_byte **arg1, gdb_byte *arg2, CORE_ADDR *arg3, CORE_ADDR *arg4)
+int
+debug_target::auxv_parse (gdb_byte **arg0, gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_auxv_parse (...)\n", debug_target.to_shortname);
- result = debug_target.to_auxv_parse (&debug_target, arg1, arg2, arg3, arg4);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_auxv_parse (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->auxv_parse (...)\n", this->beneath->shortname ());
+ result = this->beneath->auxv_parse (arg0, arg1, arg2, arg3);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->auxv_parse (", this->beneath->shortname ());
+ target_debug_print_gdb_byte_pp (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_gdb_byte_pp (arg1);
+ target_debug_print_gdb_byte_p (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_gdb_byte_p (arg2);
+ target_debug_print_CORE_ADDR_p (arg2);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR_p (arg3);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR_p (arg4);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_search_memory (struct target_ops *self, CORE_ADDR arg1, ULONGEST arg2, const gdb_byte *arg3, ULONGEST arg4, CORE_ADDR *arg5)
+int
+target_ops::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4)
{
- self = self->beneath;
- return self->to_search_memory (self, arg1, arg2, arg3, arg4, arg5);
+ return this->beneath->search_memory (arg0, arg1, arg2, arg3, arg4);
}
-static int
-debug_search_memory (struct target_ops *self, CORE_ADDR arg1, ULONGEST arg2, const gdb_byte *arg3, ULONGEST arg4, CORE_ADDR *arg5)
+int
+dummy_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4)
+{
+ return default_search_memory (this, arg0, arg1, arg2, arg3, arg4);
+}
+
+int
+debug_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_search_memory (...)\n", debug_target.to_shortname);
- result = debug_target.to_search_memory (&debug_target, arg1, arg2, arg3, arg4, arg5);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_search_memory (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->search_memory (...)\n", this->beneath->shortname ());
+ result = this->beneath->search_memory (arg0, arg1, arg2, arg3, arg4);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->search_memory (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg2);
+ target_debug_print_ULONGEST (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_gdb_byte_p (arg3);
+ target_debug_print_const_gdb_byte_p (arg2);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg4);
+ target_debug_print_ULONGEST (arg3);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR_p (arg5);
+ target_debug_print_CORE_ADDR_p (arg4);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_can_execute_reverse (struct target_ops *self)
+int
+target_ops::can_execute_reverse ()
{
- self = self->beneath;
- return self->to_can_execute_reverse (self);
+ return this->beneath->can_execute_reverse ();
}
-static int
-tdefault_can_execute_reverse (struct target_ops *self)
+int
+dummy_target::can_execute_reverse ()
{
return 0;
}
-static int
-debug_can_execute_reverse (struct target_ops *self)
+int
+debug_target::can_execute_reverse ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_execute_reverse (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_execute_reverse (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_execute_reverse (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_execute_reverse (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_execute_reverse ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_execute_reverse (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static enum exec_direction_kind
-delegate_execution_direction (struct target_ops *self)
+enum exec_direction_kind
+target_ops::execution_direction ()
+{
+ return this->beneath->execution_direction ();
+}
+
+enum exec_direction_kind
+dummy_target::execution_direction ()
{
- self = self->beneath;
- return self->to_execution_direction (self);
+ return default_execution_direction (this);
}
-static enum exec_direction_kind
-debug_execution_direction (struct target_ops *self)
+enum exec_direction_kind
+debug_target::execution_direction ()
{
enum exec_direction_kind result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_execution_direction (...)\n", debug_target.to_shortname);
- result = debug_target.to_execution_direction (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_execution_direction (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->execution_direction (...)\n", this->beneath->shortname ());
+ result = this->beneath->execution_direction ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->execution_direction (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_enum_exec_direction_kind (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_supports_multi_process (struct target_ops *self)
+int
+target_ops::supports_multi_process ()
{
- self = self->beneath;
- return self->to_supports_multi_process (self);
+ return this->beneath->supports_multi_process ();
}
-static int
-tdefault_supports_multi_process (struct target_ops *self)
+int
+dummy_target::supports_multi_process ()
{
return 0;
}
-static int
-debug_supports_multi_process (struct target_ops *self)
+int
+debug_target::supports_multi_process ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_multi_process (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_multi_process (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_multi_process (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_multi_process (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_multi_process ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_multi_process (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_supports_enable_disable_tracepoint (struct target_ops *self)
+int
+target_ops::supports_enable_disable_tracepoint ()
{
- self = self->beneath;
- return self->to_supports_enable_disable_tracepoint (self);
+ return this->beneath->supports_enable_disable_tracepoint ();
}
-static int
-tdefault_supports_enable_disable_tracepoint (struct target_ops *self)
+int
+dummy_target::supports_enable_disable_tracepoint ()
{
return 0;
}
-static int
-debug_supports_enable_disable_tracepoint (struct target_ops *self)
+int
+debug_target::supports_enable_disable_tracepoint ()
+{
+ int result;
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_enable_disable_tracepoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_enable_disable_tracepoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_enable_disable_tracepoint (", this->beneath->shortname ());
+ fputs_unfiltered (") = ", gdb_stdlog);
+ target_debug_print_int (result);
+ fputs_unfiltered ("\n", gdb_stdlog);
+ return result;
+}
+
+int
+target_ops::supports_disable_randomization ()
+{
+ return this->beneath->supports_disable_randomization ();
+}
+
+int
+dummy_target::supports_disable_randomization ()
+{
+ return find_default_supports_disable_randomization (this);
+}
+
+int
+debug_target::supports_disable_randomization ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_enable_disable_tracepoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_enable_disable_tracepoint (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_enable_disable_tracepoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_disable_randomization (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_disable_randomization ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_disable_randomization (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_supports_string_tracing (struct target_ops *self)
+int
+target_ops::supports_string_tracing ()
{
- self = self->beneath;
- return self->to_supports_string_tracing (self);
+ return this->beneath->supports_string_tracing ();
}
-static int
-tdefault_supports_string_tracing (struct target_ops *self)
+int
+dummy_target::supports_string_tracing ()
{
return 0;
}
-static int
-debug_supports_string_tracing (struct target_ops *self)
+int
+debug_target::supports_string_tracing ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_string_tracing (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_string_tracing (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_string_tracing (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_string_tracing (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_string_tracing ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_string_tracing (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_supports_evaluation_of_breakpoint_conditions (struct target_ops *self)
+int
+target_ops::supports_evaluation_of_breakpoint_conditions ()
{
- self = self->beneath;
- return self->to_supports_evaluation_of_breakpoint_conditions (self);
+ return this->beneath->supports_evaluation_of_breakpoint_conditions ();
}
-static int
-tdefault_supports_evaluation_of_breakpoint_conditions (struct target_ops *self)
+int
+dummy_target::supports_evaluation_of_breakpoint_conditions ()
{
return 0;
}
-static int
-debug_supports_evaluation_of_breakpoint_conditions (struct target_ops *self)
+int
+debug_target::supports_evaluation_of_breakpoint_conditions ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_evaluation_of_breakpoint_conditions (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_evaluation_of_breakpoint_conditions (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_evaluation_of_breakpoint_conditions (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_evaluation_of_breakpoint_conditions (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_evaluation_of_breakpoint_conditions ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_evaluation_of_breakpoint_conditions (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_can_run_breakpoint_commands (struct target_ops *self)
+int
+target_ops::can_run_breakpoint_commands ()
{
- self = self->beneath;
- return self->to_can_run_breakpoint_commands (self);
+ return this->beneath->can_run_breakpoint_commands ();
}
-static int
-tdefault_can_run_breakpoint_commands (struct target_ops *self)
+int
+dummy_target::can_run_breakpoint_commands ()
{
return 0;
}
-static int
-debug_can_run_breakpoint_commands (struct target_ops *self)
+int
+debug_target::can_run_breakpoint_commands ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_run_breakpoint_commands (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_run_breakpoint_commands (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_run_breakpoint_commands (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_run_breakpoint_commands (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_run_breakpoint_commands ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_run_breakpoint_commands (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static struct gdbarch *
-delegate_thread_architecture (struct target_ops *self, ptid_t arg1)
+struct gdbarch *
+target_ops::thread_architecture (ptid_t arg0)
+{
+ return this->beneath->thread_architecture (arg0);
+}
+
+struct gdbarch *
+dummy_target::thread_architecture (ptid_t arg0)
{
- self = self->beneath;
- return self->to_thread_architecture (self, arg1);
+ return default_thread_architecture (this, arg0);
}
-static struct gdbarch *
-debug_thread_architecture (struct target_ops *self, ptid_t arg1)
+struct gdbarch *
+debug_target::thread_architecture (ptid_t arg0)
{
struct gdbarch * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_thread_architecture (...)\n", debug_target.to_shortname);
- result = debug_target.to_thread_architecture (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_thread_architecture (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->thread_architecture (...)\n", this->beneath->shortname ());
+ result = this->beneath->thread_architecture (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->thread_architecture (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_struct_gdbarch_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static struct address_space *
-delegate_thread_address_space (struct target_ops *self, ptid_t arg1)
+struct address_space *
+target_ops::thread_address_space (ptid_t arg0)
+{
+ return this->beneath->thread_address_space (arg0);
+}
+
+struct address_space *
+dummy_target::thread_address_space (ptid_t arg0)
{
- self = self->beneath;
- return self->to_thread_address_space (self, arg1);
+ return default_thread_address_space (this, arg0);
}
-static struct address_space *
-debug_thread_address_space (struct target_ops *self, ptid_t arg1)
+struct address_space *
+debug_target::thread_address_space (ptid_t arg0)
{
struct address_space * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_thread_address_space (...)\n", debug_target.to_shortname);
- result = debug_target.to_thread_address_space (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_thread_address_space (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->thread_address_space (...)\n", this->beneath->shortname ());
+ result = this->beneath->thread_address_space (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->thread_address_space (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_struct_address_space_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_filesystem_is_local (struct target_ops *self)
+int
+target_ops::filesystem_is_local ()
{
- self = self->beneath;
- return self->to_filesystem_is_local (self);
+ return this->beneath->filesystem_is_local ();
}
-static int
-tdefault_filesystem_is_local (struct target_ops *self)
+int
+dummy_target::filesystem_is_local ()
{
return 1;
}
-static int
-debug_filesystem_is_local (struct target_ops *self)
+int
+debug_target::filesystem_is_local ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_filesystem_is_local (...)\n", debug_target.to_shortname);
- result = debug_target.to_filesystem_is_local (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_filesystem_is_local (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->filesystem_is_local (...)\n", this->beneath->shortname ());
+ result = this->beneath->filesystem_is_local ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->filesystem_is_local (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_trace_init (struct target_ops *self)
+void
+target_ops::trace_init ()
{
- self = self->beneath;
- self->to_trace_init (self);
+ this->beneath->trace_init ();
}
-static void
-tdefault_trace_init (struct target_ops *self)
+void
+dummy_target::trace_init ()
{
tcomplain ();
}
-static void
-debug_trace_init (struct target_ops *self)
+void
+debug_target::trace_init ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_trace_init (...)\n", debug_target.to_shortname);
- debug_target.to_trace_init (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_trace_init (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->trace_init (...)\n", this->beneath->shortname ());
+ this->beneath->trace_init ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->trace_init (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_download_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+target_ops::download_tracepoint (struct bp_location *arg0)
{
- self = self->beneath;
- self->to_download_tracepoint (self, arg1);
+ this->beneath->download_tracepoint (arg0);
}
-static void
-tdefault_download_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+dummy_target::download_tracepoint (struct bp_location *arg0)
{
tcomplain ();
}
-static void
-debug_download_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+debug_target::download_tracepoint (struct bp_location *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_download_tracepoint (...)\n", debug_target.to_shortname);
- debug_target.to_download_tracepoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_download_tracepoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_bp_location_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->download_tracepoint (...)\n", this->beneath->shortname ());
+ this->beneath->download_tracepoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->download_tracepoint (", this->beneath->shortname ());
+ target_debug_print_struct_bp_location_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_can_download_tracepoint (struct target_ops *self)
+int
+target_ops::can_download_tracepoint ()
{
- self = self->beneath;
- return self->to_can_download_tracepoint (self);
+ return this->beneath->can_download_tracepoint ();
}
-static int
-tdefault_can_download_tracepoint (struct target_ops *self)
+int
+dummy_target::can_download_tracepoint ()
{
return 0;
}
-static int
-debug_can_download_tracepoint (struct target_ops *self)
+int
+debug_target::can_download_tracepoint ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_download_tracepoint (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_download_tracepoint (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_download_tracepoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_download_tracepoint (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_download_tracepoint ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_download_tracepoint (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_download_trace_state_variable (struct target_ops *self, struct trace_state_variable *arg1)
+void
+target_ops::download_trace_state_variable (struct trace_state_variable *arg0)
{
- self = self->beneath;
- self->to_download_trace_state_variable (self, arg1);
+ this->beneath->download_trace_state_variable (arg0);
}
-static void
-tdefault_download_trace_state_variable (struct target_ops *self, struct trace_state_variable *arg1)
+void
+dummy_target::download_trace_state_variable (struct trace_state_variable *arg0)
{
tcomplain ();
}
-static void
-debug_download_trace_state_variable (struct target_ops *self, struct trace_state_variable *arg1)
+void
+debug_target::download_trace_state_variable (struct trace_state_variable *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_download_trace_state_variable (...)\n", debug_target.to_shortname);
- debug_target.to_download_trace_state_variable (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_download_trace_state_variable (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_trace_state_variable_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->download_trace_state_variable (...)\n", this->beneath->shortname ());
+ this->beneath->download_trace_state_variable (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->download_trace_state_variable (", this->beneath->shortname ());
+ target_debug_print_struct_trace_state_variable_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+target_ops::enable_tracepoint (struct bp_location *arg0)
{
- self = self->beneath;
- self->to_enable_tracepoint (self, arg1);
+ this->beneath->enable_tracepoint (arg0);
}
-static void
-tdefault_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+dummy_target::enable_tracepoint (struct bp_location *arg0)
{
tcomplain ();
}
-static void
-debug_enable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+debug_target::enable_tracepoint (struct bp_location *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_enable_tracepoint (...)\n", debug_target.to_shortname);
- debug_target.to_enable_tracepoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_enable_tracepoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_bp_location_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->enable_tracepoint (...)\n", this->beneath->shortname ());
+ this->beneath->enable_tracepoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->enable_tracepoint (", this->beneath->shortname ());
+ target_debug_print_struct_bp_location_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_disable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+target_ops::disable_tracepoint (struct bp_location *arg0)
{
- self = self->beneath;
- self->to_disable_tracepoint (self, arg1);
+ this->beneath->disable_tracepoint (arg0);
}
-static void
-tdefault_disable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+dummy_target::disable_tracepoint (struct bp_location *arg0)
{
tcomplain ();
}
-static void
-debug_disable_tracepoint (struct target_ops *self, struct bp_location *arg1)
+void
+debug_target::disable_tracepoint (struct bp_location *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_disable_tracepoint (...)\n", debug_target.to_shortname);
- debug_target.to_disable_tracepoint (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_disable_tracepoint (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_bp_location_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->disable_tracepoint (...)\n", this->beneath->shortname ());
+ this->beneath->disable_tracepoint (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->disable_tracepoint (", this->beneath->shortname ());
+ target_debug_print_struct_bp_location_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_trace_set_readonly_regions (struct target_ops *self)
+void
+target_ops::trace_set_readonly_regions ()
{
- self = self->beneath;
- self->to_trace_set_readonly_regions (self);
+ this->beneath->trace_set_readonly_regions ();
}
-static void
-tdefault_trace_set_readonly_regions (struct target_ops *self)
+void
+dummy_target::trace_set_readonly_regions ()
{
tcomplain ();
}
-static void
-debug_trace_set_readonly_regions (struct target_ops *self)
+void
+debug_target::trace_set_readonly_regions ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_trace_set_readonly_regions (...)\n", debug_target.to_shortname);
- debug_target.to_trace_set_readonly_regions (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_trace_set_readonly_regions (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->trace_set_readonly_regions (...)\n", this->beneath->shortname ());
+ this->beneath->trace_set_readonly_regions ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->trace_set_readonly_regions (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_trace_start (struct target_ops *self)
+void
+target_ops::trace_start ()
{
- self = self->beneath;
- self->to_trace_start (self);
+ this->beneath->trace_start ();
}
-static void
-tdefault_trace_start (struct target_ops *self)
+void
+dummy_target::trace_start ()
{
tcomplain ();
}
-static void
-debug_trace_start (struct target_ops *self)
+void
+debug_target::trace_start ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_trace_start (...)\n", debug_target.to_shortname);
- debug_target.to_trace_start (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_trace_start (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->trace_start (...)\n", this->beneath->shortname ());
+ this->beneath->trace_start ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->trace_start (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_get_trace_status (struct target_ops *self, struct trace_status *arg1)
+int
+target_ops::get_trace_status (struct trace_status *arg0)
{
- self = self->beneath;
- return self->to_get_trace_status (self, arg1);
+ return this->beneath->get_trace_status (arg0);
}
-static int
-tdefault_get_trace_status (struct target_ops *self, struct trace_status *arg1)
+int
+dummy_target::get_trace_status (struct trace_status *arg0)
{
return -1;
}
-static int
-debug_get_trace_status (struct target_ops *self, struct trace_status *arg1)
+int
+debug_target::get_trace_status (struct trace_status *arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_trace_status (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_trace_status (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_trace_status (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_trace_status_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_trace_status (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_trace_status (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_trace_status (", this->beneath->shortname ());
+ target_debug_print_struct_trace_status_p (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_get_tracepoint_status (struct target_ops *self, struct breakpoint *arg1, struct uploaded_tp *arg2)
+void
+target_ops::get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1)
{
- self = self->beneath;
- self->to_get_tracepoint_status (self, arg1, arg2);
+ this->beneath->get_tracepoint_status (arg0, arg1);
}
-static void
-tdefault_get_tracepoint_status (struct target_ops *self, struct breakpoint *arg1, struct uploaded_tp *arg2)
+void
+dummy_target::get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1)
{
tcomplain ();
}
-static void
-debug_get_tracepoint_status (struct target_ops *self, struct breakpoint *arg1, struct uploaded_tp *arg2)
+void
+debug_target::get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_tracepoint_status (...)\n", debug_target.to_shortname);
- debug_target.to_get_tracepoint_status (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_tracepoint_status (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_breakpoint_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_tracepoint_status (...)\n", this->beneath->shortname ());
+ this->beneath->get_tracepoint_status (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_tracepoint_status (", this->beneath->shortname ());
+ target_debug_print_struct_breakpoint_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_uploaded_tp_p (arg2);
+ target_debug_print_struct_uploaded_tp_p (arg1);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_trace_stop (struct target_ops *self)
+void
+target_ops::trace_stop ()
{
- self = self->beneath;
- self->to_trace_stop (self);
+ this->beneath->trace_stop ();
}
-static void
-tdefault_trace_stop (struct target_ops *self)
+void
+dummy_target::trace_stop ()
{
tcomplain ();
}
-static void
-debug_trace_stop (struct target_ops *self)
+void
+debug_target::trace_stop ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_trace_stop (...)\n", debug_target.to_shortname);
- debug_target.to_trace_stop (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_trace_stop (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->trace_stop (...)\n", this->beneath->shortname ());
+ this->beneath->trace_stop ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->trace_stop (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_trace_find (struct target_ops *self, enum trace_find_type arg1, int arg2, CORE_ADDR arg3, CORE_ADDR arg4, int *arg5)
+int
+target_ops::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4)
{
- self = self->beneath;
- return self->to_trace_find (self, arg1, arg2, arg3, arg4, arg5);
+ return this->beneath->trace_find (arg0, arg1, arg2, arg3, arg4);
}
-static int
-tdefault_trace_find (struct target_ops *self, enum trace_find_type arg1, int arg2, CORE_ADDR arg3, CORE_ADDR arg4, int *arg5)
+int
+dummy_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4)
{
return -1;
}
-static int
-debug_trace_find (struct target_ops *self, enum trace_find_type arg1, int arg2, CORE_ADDR arg3, CORE_ADDR arg4, int *arg5)
+int
+debug_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_trace_find (...)\n", debug_target.to_shortname);
- result = debug_target.to_trace_find (&debug_target, arg1, arg2, arg3, arg4, arg5);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_trace_find (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->trace_find (...)\n", this->beneath->shortname ());
+ result = this->beneath->trace_find (arg0, arg1, arg2, arg3, arg4);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->trace_find (", this->beneath->shortname ());
+ target_debug_print_enum_trace_find_type (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_trace_find_type (arg1);
+ target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_CORE_ADDR (arg2);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg3);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg4);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int_p (arg5);
+ target_debug_print_int_p (arg4);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_get_trace_state_variable_value (struct target_ops *self, int arg1, LONGEST *arg2)
+int
+target_ops::get_trace_state_variable_value (int arg0, LONGEST *arg1)
{
- self = self->beneath;
- return self->to_get_trace_state_variable_value (self, arg1, arg2);
+ return this->beneath->get_trace_state_variable_value (arg0, arg1);
}
-static int
-tdefault_get_trace_state_variable_value (struct target_ops *self, int arg1, LONGEST *arg2)
+int
+dummy_target::get_trace_state_variable_value (int arg0, LONGEST *arg1)
{
return 0;
}
-static int
-debug_get_trace_state_variable_value (struct target_ops *self, int arg1, LONGEST *arg2)
+int
+debug_target::get_trace_state_variable_value (int arg0, LONGEST *arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_trace_state_variable_value (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_trace_state_variable_value (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_trace_state_variable_value (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_trace_state_variable_value (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_trace_state_variable_value (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_trace_state_variable_value (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_LONGEST_p (arg2);
+ target_debug_print_LONGEST_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_save_trace_data (struct target_ops *self, const char *arg1)
+int
+target_ops::save_trace_data (const char *arg0)
{
- self = self->beneath;
- return self->to_save_trace_data (self, arg1);
+ return this->beneath->save_trace_data (arg0);
}
-static int
-tdefault_save_trace_data (struct target_ops *self, const char *arg1)
+int
+dummy_target::save_trace_data (const char *arg0)
{
tcomplain ();
}
-static int
-debug_save_trace_data (struct target_ops *self, const char *arg1)
+int
+debug_target::save_trace_data (const char *arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_save_trace_data (...)\n", debug_target.to_shortname);
- result = debug_target.to_save_trace_data (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_save_trace_data (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->save_trace_data (...)\n", this->beneath->shortname ());
+ result = this->beneath->save_trace_data (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->save_trace_data (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_upload_tracepoints (struct target_ops *self, struct uploaded_tp **arg1)
+int
+target_ops::upload_tracepoints (struct uploaded_tp **arg0)
{
- self = self->beneath;
- return self->to_upload_tracepoints (self, arg1);
+ return this->beneath->upload_tracepoints (arg0);
}
-static int
-tdefault_upload_tracepoints (struct target_ops *self, struct uploaded_tp **arg1)
+int
+dummy_target::upload_tracepoints (struct uploaded_tp **arg0)
{
return 0;
}
-static int
-debug_upload_tracepoints (struct target_ops *self, struct uploaded_tp **arg1)
+int
+debug_target::upload_tracepoints (struct uploaded_tp **arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_upload_tracepoints (...)\n", debug_target.to_shortname);
- result = debug_target.to_upload_tracepoints (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_upload_tracepoints (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_uploaded_tp_pp (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->upload_tracepoints (...)\n", this->beneath->shortname ());
+ result = this->beneath->upload_tracepoints (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->upload_tracepoints (", this->beneath->shortname ());
+ target_debug_print_struct_uploaded_tp_pp (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_upload_trace_state_variables (struct target_ops *self, struct uploaded_tsv **arg1)
+int
+target_ops::upload_trace_state_variables (struct uploaded_tsv **arg0)
{
- self = self->beneath;
- return self->to_upload_trace_state_variables (self, arg1);
+ return this->beneath->upload_trace_state_variables (arg0);
}
-static int
-tdefault_upload_trace_state_variables (struct target_ops *self, struct uploaded_tsv **arg1)
+int
+dummy_target::upload_trace_state_variables (struct uploaded_tsv **arg0)
{
return 0;
}
-static int
-debug_upload_trace_state_variables (struct target_ops *self, struct uploaded_tsv **arg1)
+int
+debug_target::upload_trace_state_variables (struct uploaded_tsv **arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_upload_trace_state_variables (...)\n", debug_target.to_shortname);
- result = debug_target.to_upload_trace_state_variables (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_upload_trace_state_variables (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_uploaded_tsv_pp (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->upload_trace_state_variables (...)\n", this->beneath->shortname ());
+ result = this->beneath->upload_trace_state_variables (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->upload_trace_state_variables (", this->beneath->shortname ());
+ target_debug_print_struct_uploaded_tsv_pp (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static LONGEST
-delegate_get_raw_trace_data (struct target_ops *self, gdb_byte *arg1, ULONGEST arg2, LONGEST arg3)
+LONGEST
+target_ops::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
{
- self = self->beneath;
- return self->to_get_raw_trace_data (self, arg1, arg2, arg3);
+ return this->beneath->get_raw_trace_data (arg0, arg1, arg2);
}
-static LONGEST
-tdefault_get_raw_trace_data (struct target_ops *self, gdb_byte *arg1, ULONGEST arg2, LONGEST arg3)
+LONGEST
+dummy_target::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
{
tcomplain ();
}
-static LONGEST
-debug_get_raw_trace_data (struct target_ops *self, gdb_byte *arg1, ULONGEST arg2, LONGEST arg3)
+LONGEST
+debug_target::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
{
LONGEST result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_raw_trace_data (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_raw_trace_data (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_raw_trace_data (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_raw_trace_data (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_raw_trace_data (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_raw_trace_data (", this->beneath->shortname ());
+ target_debug_print_gdb_byte_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_gdb_byte_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg2);
+ target_debug_print_ULONGEST (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_LONGEST (arg3);
+ target_debug_print_LONGEST (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_LONGEST (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_get_min_fast_tracepoint_insn_len (struct target_ops *self)
+int
+target_ops::get_min_fast_tracepoint_insn_len ()
{
- self = self->beneath;
- return self->to_get_min_fast_tracepoint_insn_len (self);
+ return this->beneath->get_min_fast_tracepoint_insn_len ();
}
-static int
-tdefault_get_min_fast_tracepoint_insn_len (struct target_ops *self)
+int
+dummy_target::get_min_fast_tracepoint_insn_len ()
{
return -1;
}
-static int
-debug_get_min_fast_tracepoint_insn_len (struct target_ops *self)
+int
+debug_target::get_min_fast_tracepoint_insn_len ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_min_fast_tracepoint_insn_len (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_min_fast_tracepoint_insn_len (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_min_fast_tracepoint_insn_len (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_min_fast_tracepoint_insn_len (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_min_fast_tracepoint_insn_len ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_min_fast_tracepoint_insn_len (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_set_disconnected_tracing (struct target_ops *self, int arg1)
+void
+target_ops::set_disconnected_tracing (int arg0)
{
- self = self->beneath;
- self->to_set_disconnected_tracing (self, arg1);
+ this->beneath->set_disconnected_tracing (arg0);
}
-static void
-tdefault_set_disconnected_tracing (struct target_ops *self, int arg1)
+void
+dummy_target::set_disconnected_tracing (int arg0)
{
}
-static void
-debug_set_disconnected_tracing (struct target_ops *self, int arg1)
+void
+debug_target::set_disconnected_tracing (int arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_set_disconnected_tracing (...)\n", debug_target.to_shortname);
- debug_target.to_set_disconnected_tracing (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_set_disconnected_tracing (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->set_disconnected_tracing (...)\n", this->beneath->shortname ());
+ this->beneath->set_disconnected_tracing (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->set_disconnected_tracing (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_set_circular_trace_buffer (struct target_ops *self, int arg1)
+void
+target_ops::set_circular_trace_buffer (int arg0)
{
- self = self->beneath;
- self->to_set_circular_trace_buffer (self, arg1);
+ this->beneath->set_circular_trace_buffer (arg0);
}
-static void
-tdefault_set_circular_trace_buffer (struct target_ops *self, int arg1)
+void
+dummy_target::set_circular_trace_buffer (int arg0)
{
}
-static void
-debug_set_circular_trace_buffer (struct target_ops *self, int arg1)
+void
+debug_target::set_circular_trace_buffer (int arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_set_circular_trace_buffer (...)\n", debug_target.to_shortname);
- debug_target.to_set_circular_trace_buffer (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_set_circular_trace_buffer (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->set_circular_trace_buffer (...)\n", this->beneath->shortname ());
+ this->beneath->set_circular_trace_buffer (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->set_circular_trace_buffer (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_set_trace_buffer_size (struct target_ops *self, LONGEST arg1)
+void
+target_ops::set_trace_buffer_size (LONGEST arg0)
{
- self = self->beneath;
- self->to_set_trace_buffer_size (self, arg1);
+ this->beneath->set_trace_buffer_size (arg0);
}
-static void
-tdefault_set_trace_buffer_size (struct target_ops *self, LONGEST arg1)
+void
+dummy_target::set_trace_buffer_size (LONGEST arg0)
{
}
-static void
-debug_set_trace_buffer_size (struct target_ops *self, LONGEST arg1)
+void
+debug_target::set_trace_buffer_size (LONGEST arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_set_trace_buffer_size (...)\n", debug_target.to_shortname);
- debug_target.to_set_trace_buffer_size (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_set_trace_buffer_size (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_LONGEST (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->set_trace_buffer_size (...)\n", this->beneath->shortname ());
+ this->beneath->set_trace_buffer_size (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->set_trace_buffer_size (", this->beneath->shortname ());
+ target_debug_print_LONGEST (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_set_trace_notes (struct target_ops *self, const char *arg1, const char *arg2, const char *arg3)
+int
+target_ops::set_trace_notes (const char *arg0, const char *arg1, const char *arg2)
{
- self = self->beneath;
- return self->to_set_trace_notes (self, arg1, arg2, arg3);
+ return this->beneath->set_trace_notes (arg0, arg1, arg2);
}
-static int
-tdefault_set_trace_notes (struct target_ops *self, const char *arg1, const char *arg2, const char *arg3)
+int
+dummy_target::set_trace_notes (const char *arg0, const char *arg1, const char *arg2)
{
return 0;
}
-static int
-debug_set_trace_notes (struct target_ops *self, const char *arg1, const char *arg2, const char *arg3)
+int
+debug_target::set_trace_notes (const char *arg0, const char *arg1, const char *arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_set_trace_notes (...)\n", debug_target.to_shortname);
- result = debug_target.to_set_trace_notes (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_set_trace_notes (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->set_trace_notes (...)\n", this->beneath->shortname ());
+ result = this->beneath->set_trace_notes (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->set_trace_notes (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_const_char_p (arg1);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_const_char_p (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg3);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_core_of_thread (struct target_ops *self, ptid_t arg1)
+int
+target_ops::core_of_thread (ptid_t arg0)
{
- self = self->beneath;
- return self->to_core_of_thread (self, arg1);
+ return this->beneath->core_of_thread (arg0);
}
-static int
-tdefault_core_of_thread (struct target_ops *self, ptid_t arg1)
+int
+dummy_target::core_of_thread (ptid_t arg0)
{
return -1;
}
-static int
-debug_core_of_thread (struct target_ops *self, ptid_t arg1)
+int
+debug_target::core_of_thread (ptid_t arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_core_of_thread (...)\n", debug_target.to_shortname);
- result = debug_target.to_core_of_thread (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_core_of_thread (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->core_of_thread (...)\n", this->beneath->shortname ());
+ result = this->beneath->core_of_thread (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->core_of_thread (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_verify_memory (struct target_ops *self, const gdb_byte *arg1, CORE_ADDR arg2, ULONGEST arg3)
+int
+target_ops::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2)
+{
+ return this->beneath->verify_memory (arg0, arg1, arg2);
+}
+
+int
+dummy_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2)
{
- self = self->beneath;
- return self->to_verify_memory (self, arg1, arg2, arg3);
+ return default_verify_memory (this, arg0, arg1, arg2);
}
-static int
-debug_verify_memory (struct target_ops *self, const gdb_byte *arg1, CORE_ADDR arg2, ULONGEST arg3)
+int
+debug_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_verify_memory (...)\n", debug_target.to_shortname);
- result = debug_target.to_verify_memory (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_verify_memory (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_gdb_byte_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->verify_memory (...)\n", this->beneath->shortname ());
+ result = this->beneath->verify_memory (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->verify_memory (", this->beneath->shortname ());
+ target_debug_print_const_gdb_byte_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg2);
+ target_debug_print_CORE_ADDR (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg3);
+ target_debug_print_ULONGEST (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_get_tib_address (struct target_ops *self, ptid_t arg1, CORE_ADDR *arg2)
+int
+target_ops::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
{
- self = self->beneath;
- return self->to_get_tib_address (self, arg1, arg2);
+ return this->beneath->get_tib_address (arg0, arg1);
}
-static int
-tdefault_get_tib_address (struct target_ops *self, ptid_t arg1, CORE_ADDR *arg2)
+int
+dummy_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
{
tcomplain ();
}
-static int
-debug_get_tib_address (struct target_ops *self, ptid_t arg1, CORE_ADDR *arg2)
+int
+debug_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_tib_address (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_tib_address (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_tib_address (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_tib_address (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_tib_address (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_tib_address (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR_p (arg2);
+ target_debug_print_CORE_ADDR_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_set_permissions (struct target_ops *self)
+void
+target_ops::set_permissions ()
{
- self = self->beneath;
- self->to_set_permissions (self);
+ this->beneath->set_permissions ();
}
-static void
-tdefault_set_permissions (struct target_ops *self)
+void
+dummy_target::set_permissions ()
{
}
-static void
-debug_set_permissions (struct target_ops *self)
+void
+debug_target::set_permissions ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_set_permissions (...)\n", debug_target.to_shortname);
- debug_target.to_set_permissions (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_set_permissions (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->set_permissions (...)\n", this->beneath->shortname ());
+ this->beneath->set_permissions ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->set_permissions (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
+int
+target_ops::static_tracepoint_marker_at (CORE_ADDR arg0, struct static_tracepoint_marker *arg1)
{
- self = self->beneath;
- return self->to_static_tracepoint_marker_at (self, arg1, arg2);
+ return this->beneath->static_tracepoint_marker_at (arg0, arg1);
}
-static int
-tdefault_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
+int
+dummy_target::static_tracepoint_marker_at (CORE_ADDR arg0, struct static_tracepoint_marker *arg1)
{
return 0;
}
-static int
-debug_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
+int
+debug_target::static_tracepoint_marker_at (CORE_ADDR arg0, struct static_tracepoint_marker *arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_static_tracepoint_marker_at (...)\n", debug_target.to_shortname);
- result = debug_target.to_static_tracepoint_marker_at (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_static_tracepoint_marker_at (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->static_tracepoint_marker_at (...)\n", this->beneath->shortname ());
+ result = this->beneath->static_tracepoint_marker_at (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->static_tracepoint_marker_at (", this->beneath->shortname ());
+ target_debug_print_CORE_ADDR (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_CORE_ADDR (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_static_tracepoint_marker_p (arg2);
+ target_debug_print_struct_static_tracepoint_marker_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static VEC(static_tracepoint_marker_p) *
-delegate_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
+VEC(static_tracepoint_marker_p) *
+target_ops::static_tracepoint_markers_by_strid (const char *arg0)
{
- self = self->beneath;
- return self->to_static_tracepoint_markers_by_strid (self, arg1);
+ return this->beneath->static_tracepoint_markers_by_strid (arg0);
}
-static VEC(static_tracepoint_marker_p) *
-tdefault_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
+VEC(static_tracepoint_marker_p) *
+dummy_target::static_tracepoint_markers_by_strid (const char *arg0)
{
tcomplain ();
}
-static VEC(static_tracepoint_marker_p) *
-debug_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
+VEC(static_tracepoint_marker_p) *
+debug_target::static_tracepoint_markers_by_strid (const char *arg0)
{
VEC(static_tracepoint_marker_p) * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_static_tracepoint_markers_by_strid (...)\n", debug_target.to_shortname);
- result = debug_target.to_static_tracepoint_markers_by_strid (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_static_tracepoint_markers_by_strid (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->static_tracepoint_markers_by_strid (...)\n", this->beneath->shortname ());
+ result = this->beneath->static_tracepoint_markers_by_strid (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->static_tracepoint_markers_by_strid (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_VEC_static_tracepoint_marker_p__p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static struct traceframe_info *
-delegate_traceframe_info (struct target_ops *self)
+struct traceframe_info *
+target_ops::traceframe_info ()
{
- self = self->beneath;
- return self->to_traceframe_info (self);
+ return this->beneath->traceframe_info ();
}
-static struct traceframe_info *
-tdefault_traceframe_info (struct target_ops *self)
+struct traceframe_info *
+dummy_target::traceframe_info ()
{
tcomplain ();
}
-static struct traceframe_info *
-debug_traceframe_info (struct target_ops *self)
+struct traceframe_info *
+debug_target::traceframe_info ()
{
struct traceframe_info * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_traceframe_info (...)\n", debug_target.to_shortname);
- result = debug_target.to_traceframe_info (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_traceframe_info (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->traceframe_info (...)\n", this->beneath->shortname ());
+ result = this->beneath->traceframe_info ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->traceframe_info (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_struct_traceframe_info_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_use_agent (struct target_ops *self, int arg1)
+int
+target_ops::use_agent (int arg0)
{
- self = self->beneath;
- return self->to_use_agent (self, arg1);
+ return this->beneath->use_agent (arg0);
}
-static int
-tdefault_use_agent (struct target_ops *self, int arg1)
+int
+dummy_target::use_agent (int arg0)
{
tcomplain ();
}
-static int
-debug_use_agent (struct target_ops *self, int arg1)
+int
+debug_target::use_agent (int arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_use_agent (...)\n", debug_target.to_shortname);
- result = debug_target.to_use_agent (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_use_agent (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->use_agent (...)\n", this->beneath->shortname ());
+ result = this->beneath->use_agent (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->use_agent (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_can_use_agent (struct target_ops *self)
+int
+target_ops::can_use_agent ()
{
- self = self->beneath;
- return self->to_can_use_agent (self);
+ return this->beneath->can_use_agent ();
}
-static int
-tdefault_can_use_agent (struct target_ops *self)
+int
+dummy_target::can_use_agent ()
{
return 0;
}
-static int
-debug_can_use_agent (struct target_ops *self)
+int
+debug_target::can_use_agent ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_can_use_agent (...)\n", debug_target.to_shortname);
- result = debug_target.to_can_use_agent (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_can_use_agent (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->can_use_agent (...)\n", this->beneath->shortname ());
+ result = this->beneath->can_use_agent ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->can_use_agent (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_supports_btrace (struct target_ops *self, enum btrace_format arg1)
+int
+target_ops::supports_btrace (enum btrace_format arg0)
{
- self = self->beneath;
- return self->to_supports_btrace (self, arg1);
+ return this->beneath->supports_btrace (arg0);
}
-static int
-tdefault_supports_btrace (struct target_ops *self, enum btrace_format arg1)
+int
+dummy_target::supports_btrace (enum btrace_format arg0)
{
return 0;
}
-static int
-debug_supports_btrace (struct target_ops *self, enum btrace_format arg1)
+int
+debug_target::supports_btrace (enum btrace_format arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_supports_btrace (...)\n", debug_target.to_shortname);
- result = debug_target.to_supports_btrace (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_supports_btrace (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_btrace_format (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->supports_btrace (...)\n", this->beneath->shortname ());
+ result = this->beneath->supports_btrace (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->supports_btrace (", this->beneath->shortname ());
+ target_debug_print_enum_btrace_format (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static struct btrace_target_info *
-delegate_enable_btrace (struct target_ops *self, ptid_t arg1, const struct btrace_config *arg2)
+struct btrace_target_info *
+target_ops::enable_btrace (ptid_t arg0, const struct btrace_config *arg1)
{
- self = self->beneath;
- return self->to_enable_btrace (self, arg1, arg2);
+ return this->beneath->enable_btrace (arg0, arg1);
}
-static struct btrace_target_info *
-tdefault_enable_btrace (struct target_ops *self, ptid_t arg1, const struct btrace_config *arg2)
+struct btrace_target_info *
+dummy_target::enable_btrace (ptid_t arg0, const struct btrace_config *arg1)
{
tcomplain ();
}
-static struct btrace_target_info *
-debug_enable_btrace (struct target_ops *self, ptid_t arg1, const struct btrace_config *arg2)
+struct btrace_target_info *
+debug_target::enable_btrace (ptid_t arg0, const struct btrace_config *arg1)
{
struct btrace_target_info * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_enable_btrace (...)\n", debug_target.to_shortname);
- result = debug_target.to_enable_btrace (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_enable_btrace (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->enable_btrace (...)\n", this->beneath->shortname ());
+ result = this->beneath->enable_btrace (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->enable_btrace (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_struct_btrace_config_p (arg2);
+ target_debug_print_const_struct_btrace_config_p (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_struct_btrace_target_info_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_disable_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+void
+target_ops::disable_btrace (struct btrace_target_info *arg0)
{
- self = self->beneath;
- self->to_disable_btrace (self, arg1);
+ this->beneath->disable_btrace (arg0);
}
-static void
-tdefault_disable_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+void
+dummy_target::disable_btrace (struct btrace_target_info *arg0)
{
tcomplain ();
}
-static void
-debug_disable_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+void
+debug_target::disable_btrace (struct btrace_target_info *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_disable_btrace (...)\n", debug_target.to_shortname);
- debug_target.to_disable_btrace (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_disable_btrace (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_btrace_target_info_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->disable_btrace (...)\n", this->beneath->shortname ());
+ this->beneath->disable_btrace (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->disable_btrace (", this->beneath->shortname ());
+ target_debug_print_struct_btrace_target_info_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_teardown_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+void
+target_ops::teardown_btrace (struct btrace_target_info *arg0)
{
- self = self->beneath;
- self->to_teardown_btrace (self, arg1);
+ this->beneath->teardown_btrace (arg0);
}
-static void
-tdefault_teardown_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+void
+dummy_target::teardown_btrace (struct btrace_target_info *arg0)
{
tcomplain ();
}
-static void
-debug_teardown_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+void
+debug_target::teardown_btrace (struct btrace_target_info *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_teardown_btrace (...)\n", debug_target.to_shortname);
- debug_target.to_teardown_btrace (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_teardown_btrace (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_btrace_target_info_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->teardown_btrace (...)\n", this->beneath->shortname ());
+ this->beneath->teardown_btrace (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->teardown_btrace (", this->beneath->shortname ());
+ target_debug_print_struct_btrace_target_info_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static enum btrace_error
-delegate_read_btrace (struct target_ops *self, struct btrace_data *arg1, struct btrace_target_info *arg2, enum btrace_read_type arg3)
+enum btrace_error
+target_ops::read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2)
{
- self = self->beneath;
- return self->to_read_btrace (self, arg1, arg2, arg3);
+ return this->beneath->read_btrace (arg0, arg1, arg2);
}
-static enum btrace_error
-tdefault_read_btrace (struct target_ops *self, struct btrace_data *arg1, struct btrace_target_info *arg2, enum btrace_read_type arg3)
+enum btrace_error
+dummy_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2)
{
tcomplain ();
}
-static enum btrace_error
-debug_read_btrace (struct target_ops *self, struct btrace_data *arg1, struct btrace_target_info *arg2, enum btrace_read_type arg3)
+enum btrace_error
+debug_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2)
{
enum btrace_error result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_read_btrace (...)\n", debug_target.to_shortname);
- result = debug_target.to_read_btrace (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_read_btrace (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->read_btrace (...)\n", this->beneath->shortname ());
+ result = this->beneath->read_btrace (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->read_btrace (", this->beneath->shortname ());
+ target_debug_print_struct_btrace_data_p (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_btrace_data_p (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_struct_btrace_target_info_p (arg2);
+ target_debug_print_struct_btrace_target_info_p (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_enum_btrace_read_type (arg3);
+ target_debug_print_enum_btrace_read_type (arg2);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_enum_btrace_error (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static const struct btrace_config *
-delegate_btrace_conf (struct target_ops *self, const struct btrace_target_info *arg1)
+const struct btrace_config *
+target_ops::btrace_conf (const struct btrace_target_info *arg0)
{
- self = self->beneath;
- return self->to_btrace_conf (self, arg1);
+ return this->beneath->btrace_conf (arg0);
}
-static const struct btrace_config *
-tdefault_btrace_conf (struct target_ops *self, const struct btrace_target_info *arg1)
+const struct btrace_config *
+dummy_target::btrace_conf (const struct btrace_target_info *arg0)
{
return NULL;
}
-static const struct btrace_config *
-debug_btrace_conf (struct target_ops *self, const struct btrace_target_info *arg1)
+const struct btrace_config *
+debug_target::btrace_conf (const struct btrace_target_info *arg0)
{
const struct btrace_config * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_btrace_conf (...)\n", debug_target.to_shortname);
- result = debug_target.to_btrace_conf (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_btrace_conf (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_struct_btrace_target_info_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->btrace_conf (...)\n", this->beneath->shortname ());
+ result = this->beneath->btrace_conf (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->btrace_conf (", this->beneath->shortname ());
+ target_debug_print_const_struct_btrace_target_info_p (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_const_struct_btrace_config_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_stop_recording (struct target_ops *self)
+void
+target_ops::stop_recording ()
{
- self = self->beneath;
- self->to_stop_recording (self);
+ this->beneath->stop_recording ();
}
-static void
-tdefault_stop_recording (struct target_ops *self)
+void
+dummy_target::stop_recording ()
{
}
-static void
-debug_stop_recording (struct target_ops *self)
+void
+debug_target::stop_recording ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_stop_recording (...)\n", debug_target.to_shortname);
- debug_target.to_stop_recording (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_stop_recording (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->stop_recording (...)\n", this->beneath->shortname ());
+ this->beneath->stop_recording ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->stop_recording (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_info_record (struct target_ops *self)
+void
+target_ops::info_record ()
{
- self = self->beneath;
- self->to_info_record (self);
+ this->beneath->info_record ();
}
-static void
-tdefault_info_record (struct target_ops *self)
+void
+dummy_target::info_record ()
{
}
-static void
-debug_info_record (struct target_ops *self)
+void
+debug_target::info_record ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_info_record (...)\n", debug_target.to_shortname);
- debug_target.to_info_record (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_info_record (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->info_record (...)\n", this->beneath->shortname ());
+ this->beneath->info_record ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->info_record (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_save_record (struct target_ops *self, const char *arg1)
+void
+target_ops::save_record (const char *arg0)
{
- self = self->beneath;
- self->to_save_record (self, arg1);
+ this->beneath->save_record (arg0);
}
-static void
-tdefault_save_record (struct target_ops *self, const char *arg1)
+void
+dummy_target::save_record (const char *arg0)
{
tcomplain ();
}
-static void
-debug_save_record (struct target_ops *self, const char *arg1)
+void
+debug_target::save_record (const char *arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_save_record (...)\n", debug_target.to_shortname);
- debug_target.to_save_record (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_save_record (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_const_char_p (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->save_record (...)\n", this->beneath->shortname ());
+ this->beneath->save_record (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->save_record (", this->beneath->shortname ());
+ target_debug_print_const_char_p (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_delete_record (struct target_ops *self)
+void
+target_ops::delete_record ()
{
- self = self->beneath;
- self->to_delete_record (self);
+ this->beneath->delete_record ();
}
-static void
-tdefault_delete_record (struct target_ops *self)
+void
+dummy_target::delete_record ()
{
tcomplain ();
}
-static void
-debug_delete_record (struct target_ops *self)
+void
+debug_target::delete_record ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_delete_record (...)\n", debug_target.to_shortname);
- debug_target.to_delete_record (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_delete_record (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->delete_record (...)\n", this->beneath->shortname ());
+ this->beneath->delete_record ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->delete_record (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_record_is_replaying (struct target_ops *self, ptid_t arg1)
+int
+target_ops::record_is_replaying (ptid_t arg0)
{
- self = self->beneath;
- return self->to_record_is_replaying (self, arg1);
+ return this->beneath->record_is_replaying (arg0);
}
-static int
-tdefault_record_is_replaying (struct target_ops *self, ptid_t arg1)
+int
+dummy_target::record_is_replaying (ptid_t arg0)
{
return 0;
}
-static int
-debug_record_is_replaying (struct target_ops *self, ptid_t arg1)
+int
+debug_target::record_is_replaying (ptid_t arg0)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_record_is_replaying (...)\n", debug_target.to_shortname);
- result = debug_target.to_record_is_replaying (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_record_is_replaying (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->record_is_replaying (...)\n", this->beneath->shortname ());
+ result = this->beneath->record_is_replaying (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->record_is_replaying (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static int
-delegate_record_will_replay (struct target_ops *self, ptid_t arg1, int arg2)
+int
+target_ops::record_will_replay (ptid_t arg0, int arg1)
{
- self = self->beneath;
- return self->to_record_will_replay (self, arg1, arg2);
+ return this->beneath->record_will_replay (arg0, arg1);
}
-static int
-tdefault_record_will_replay (struct target_ops *self, ptid_t arg1, int arg2)
+int
+dummy_target::record_will_replay (ptid_t arg0, int arg1)
{
return 0;
}
-static int
-debug_record_will_replay (struct target_ops *self, ptid_t arg1, int arg2)
+int
+debug_target::record_will_replay (ptid_t arg0, int arg1)
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_record_will_replay (...)\n", debug_target.to_shortname);
- result = debug_target.to_record_will_replay (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_record_will_replay (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->record_will_replay (...)\n", this->beneath->shortname ());
+ result = this->beneath->record_will_replay (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->record_will_replay (", this->beneath->shortname ());
+ target_debug_print_ptid_t (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ptid_t (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
+ target_debug_print_int (arg1);
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_record_stop_replaying (struct target_ops *self)
+void
+target_ops::record_stop_replaying ()
{
- self = self->beneath;
- self->to_record_stop_replaying (self);
+ this->beneath->record_stop_replaying ();
}
-static void
-tdefault_record_stop_replaying (struct target_ops *self)
+void
+dummy_target::record_stop_replaying ()
{
}
-static void
-debug_record_stop_replaying (struct target_ops *self)
+void
+debug_target::record_stop_replaying ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_record_stop_replaying (...)\n", debug_target.to_shortname);
- debug_target.to_record_stop_replaying (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_record_stop_replaying (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->record_stop_replaying (...)\n", this->beneath->shortname ());
+ this->beneath->record_stop_replaying ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->record_stop_replaying (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_goto_record_begin (struct target_ops *self)
+void
+target_ops::goto_record_begin ()
{
- self = self->beneath;
- self->to_goto_record_begin (self);
+ this->beneath->goto_record_begin ();
}
-static void
-tdefault_goto_record_begin (struct target_ops *self)
+void
+dummy_target::goto_record_begin ()
{
tcomplain ();
}
-static void
-debug_goto_record_begin (struct target_ops *self)
+void
+debug_target::goto_record_begin ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_goto_record_begin (...)\n", debug_target.to_shortname);
- debug_target.to_goto_record_begin (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_goto_record_begin (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->goto_record_begin (...)\n", this->beneath->shortname ());
+ this->beneath->goto_record_begin ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->goto_record_begin (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_goto_record_end (struct target_ops *self)
+void
+target_ops::goto_record_end ()
{
- self = self->beneath;
- self->to_goto_record_end (self);
+ this->beneath->goto_record_end ();
}
-static void
-tdefault_goto_record_end (struct target_ops *self)
+void
+dummy_target::goto_record_end ()
{
tcomplain ();
}
-static void
-debug_goto_record_end (struct target_ops *self)
+void
+debug_target::goto_record_end ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_goto_record_end (...)\n", debug_target.to_shortname);
- debug_target.to_goto_record_end (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_goto_record_end (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->goto_record_end (...)\n", this->beneath->shortname ());
+ this->beneath->goto_record_end ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->goto_record_end (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_goto_record (struct target_ops *self, ULONGEST arg1)
+void
+target_ops::goto_record (ULONGEST arg0)
{
- self = self->beneath;
- self->to_goto_record (self, arg1);
+ this->beneath->goto_record (arg0);
}
-static void
-tdefault_goto_record (struct target_ops *self, ULONGEST arg1)
+void
+dummy_target::goto_record (ULONGEST arg0)
{
tcomplain ();
}
-static void
-debug_goto_record (struct target_ops *self, ULONGEST arg1)
+void
+debug_target::goto_record (ULONGEST arg0)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_goto_record (...)\n", debug_target.to_shortname);
- debug_target.to_goto_record (&debug_target, arg1);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_goto_record (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg1);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->goto_record (...)\n", this->beneath->shortname ());
+ this->beneath->goto_record (arg0);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->goto_record (", this->beneath->shortname ());
+ target_debug_print_ULONGEST (arg0);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_insn_history (struct target_ops *self, int arg1, int arg2)
+void
+target_ops::insn_history (int arg0, int arg1)
{
- self = self->beneath;
- self->to_insn_history (self, arg1, arg2);
+ this->beneath->insn_history (arg0, arg1);
}
-static void
-tdefault_insn_history (struct target_ops *self, int arg1, int arg2)
+void
+dummy_target::insn_history (int arg0, int arg1)
{
tcomplain ();
}
-static void
-debug_insn_history (struct target_ops *self, int arg1, int arg2)
+void
+debug_target::insn_history (int arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insn_history (...)\n", debug_target.to_shortname);
- debug_target.to_insn_history (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insn_history (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insn_history (...)\n", this->beneath->shortname ());
+ this->beneath->insn_history (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insn_history (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+void
+target_ops::insn_history_from (ULONGEST arg0, int arg1, int arg2)
{
- self = self->beneath;
- self->to_insn_history_from (self, arg1, arg2, arg3);
+ this->beneath->insn_history_from (arg0, arg1, arg2);
}
-static void
-tdefault_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+void
+dummy_target::insn_history_from (ULONGEST arg0, int arg1, int arg2)
{
tcomplain ();
}
-static void
-debug_insn_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+void
+debug_target::insn_history_from (ULONGEST arg0, int arg1, int arg2)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insn_history_from (...)\n", debug_target.to_shortname);
- debug_target.to_insn_history_from (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insn_history_from (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insn_history_from (...)\n", this->beneath->shortname ());
+ this->beneath->insn_history_from (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insn_history_from (", this->beneath->shortname ());
+ target_debug_print_ULONGEST (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg1);
+ target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+void
+target_ops::insn_history_range (ULONGEST arg0, ULONGEST arg1, int arg2)
{
- self = self->beneath;
- self->to_insn_history_range (self, arg1, arg2, arg3);
+ this->beneath->insn_history_range (arg0, arg1, arg2);
}
-static void
-tdefault_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+void
+dummy_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, int arg2)
{
tcomplain ();
}
-static void
-debug_insn_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+void
+debug_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, int arg2)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_insn_history_range (...)\n", debug_target.to_shortname);
- debug_target.to_insn_history_range (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_insn_history_range (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->insn_history_range (...)\n", this->beneath->shortname ());
+ this->beneath->insn_history_range (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->insn_history_range (", this->beneath->shortname ());
+ target_debug_print_ULONGEST (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
+ target_debug_print_int (arg2);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_call_history (struct target_ops *self, int arg1, int arg2)
+void
+target_ops::call_history (int arg0, int arg1)
{
- self = self->beneath;
- self->to_call_history (self, arg1, arg2);
+ this->beneath->call_history (arg0, arg1);
}
-static void
-tdefault_call_history (struct target_ops *self, int arg1, int arg2)
+void
+dummy_target::call_history (int arg0, int arg1)
{
tcomplain ();
}
-static void
-debug_call_history (struct target_ops *self, int arg1, int arg2)
+void
+debug_target::call_history (int arg0, int arg1)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_call_history (...)\n", debug_target.to_shortname);
- debug_target.to_call_history (&debug_target, arg1, arg2);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_call_history (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->call_history (...)\n", this->beneath->shortname ());
+ this->beneath->call_history (arg0, arg1);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->call_history (", this->beneath->shortname ());
+ target_debug_print_int (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg1);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg2);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+void
+target_ops::call_history_from (ULONGEST arg0, int arg1, int arg2)
{
- self = self->beneath;
- self->to_call_history_from (self, arg1, arg2, arg3);
+ this->beneath->call_history_from (arg0, arg1, arg2);
}
-static void
-tdefault_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+void
+dummy_target::call_history_from (ULONGEST arg0, int arg1, int arg2)
{
tcomplain ();
}
-static void
-debug_call_history_from (struct target_ops *self, ULONGEST arg1, int arg2, int arg3)
+void
+debug_target::call_history_from (ULONGEST arg0, int arg1, int arg2)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_call_history_from (...)\n", debug_target.to_shortname);
- debug_target.to_call_history_from (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_call_history_from (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->call_history_from (...)\n", this->beneath->shortname ());
+ this->beneath->call_history_from (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->call_history_from (", this->beneath->shortname ());
+ target_debug_print_ULONGEST (arg0);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg1);
+ target_debug_print_int (arg1);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_int (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+void
+target_ops::call_history_range (ULONGEST arg0, ULONGEST arg1, int arg2)
{
- self = self->beneath;
- self->to_call_history_range (self, arg1, arg2, arg3);
+ this->beneath->call_history_range (arg0, arg1, arg2);
}
-static void
-tdefault_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+void
+dummy_target::call_history_range (ULONGEST arg0, ULONGEST arg1, int arg2)
{
tcomplain ();
}
-static void
-debug_call_history_range (struct target_ops *self, ULONGEST arg1, ULONGEST arg2, int arg3)
+void
+debug_target::call_history_range (ULONGEST arg0, ULONGEST arg1, int arg2)
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_call_history_range (...)\n", debug_target.to_shortname);
- debug_target.to_call_history_range (&debug_target, arg1, arg2, arg3);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_call_history_range (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->call_history_range (...)\n", this->beneath->shortname ());
+ this->beneath->call_history_range (arg0, arg1, arg2);
+ fprintf_unfiltered (gdb_stdlog, "<- %s->call_history_range (", this->beneath->shortname ());
+ target_debug_print_ULONGEST (arg0);
fputs_unfiltered (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg1);
fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_ULONGEST (arg2);
- fputs_unfiltered (", ", gdb_stdlog);
- target_debug_print_int (arg3);
+ target_debug_print_int (arg2);
fputs_unfiltered (")\n", gdb_stdlog);
}
-static int
-delegate_augmented_libraries_svr4_read (struct target_ops *self)
+int
+target_ops::augmented_libraries_svr4_read ()
{
- self = self->beneath;
- return self->to_augmented_libraries_svr4_read (self);
+ return this->beneath->augmented_libraries_svr4_read ();
}
-static int
-tdefault_augmented_libraries_svr4_read (struct target_ops *self)
+int
+dummy_target::augmented_libraries_svr4_read ()
{
return 0;
}
-static int
-debug_augmented_libraries_svr4_read (struct target_ops *self)
+int
+debug_target::augmented_libraries_svr4_read ()
{
int result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_augmented_libraries_svr4_read (...)\n", debug_target.to_shortname);
- result = debug_target.to_augmented_libraries_svr4_read (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_augmented_libraries_svr4_read (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->augmented_libraries_svr4_read (...)\n", this->beneath->shortname ());
+ result = this->beneath->augmented_libraries_svr4_read ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->augmented_libraries_svr4_read (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_int (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static const struct frame_unwind *
-delegate_get_unwinder (struct target_ops *self)
+const struct frame_unwind *
+target_ops::get_unwinder ()
{
- self = self->beneath;
- return self->to_get_unwinder (self);
+ return this->beneath->get_unwinder ();
}
-static const struct frame_unwind *
-tdefault_get_unwinder (struct target_ops *self)
+const struct frame_unwind *
+dummy_target::get_unwinder ()
{
return NULL;
}
-static const struct frame_unwind *
-debug_get_unwinder (struct target_ops *self)
+const struct frame_unwind *
+debug_target::get_unwinder ()
{
const struct frame_unwind * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_unwinder (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_unwinder (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_unwinder (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_unwinder (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_unwinder ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_unwinder (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_const_struct_frame_unwind_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static const struct frame_unwind *
-delegate_get_tailcall_unwinder (struct target_ops *self)
+const struct frame_unwind *
+target_ops::get_tailcall_unwinder ()
{
- self = self->beneath;
- return self->to_get_tailcall_unwinder (self);
+ return this->beneath->get_tailcall_unwinder ();
}
-static const struct frame_unwind *
-tdefault_get_tailcall_unwinder (struct target_ops *self)
+const struct frame_unwind *
+dummy_target::get_tailcall_unwinder ()
{
return NULL;
}
-static const struct frame_unwind *
-debug_get_tailcall_unwinder (struct target_ops *self)
+const struct frame_unwind *
+debug_target::get_tailcall_unwinder ()
{
const struct frame_unwind * result;
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_tailcall_unwinder (...)\n", debug_target.to_shortname);
- result = debug_target.to_get_tailcall_unwinder (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_tailcall_unwinder (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->get_tailcall_unwinder (...)\n", this->beneath->shortname ());
+ result = this->beneath->get_tailcall_unwinder ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->get_tailcall_unwinder (", this->beneath->shortname ());
fputs_unfiltered (") = ", gdb_stdlog);
target_debug_print_const_struct_frame_unwind_p (result);
fputs_unfiltered ("\n", gdb_stdlog);
return result;
}
-static void
-delegate_prepare_to_generate_core (struct target_ops *self)
+void
+target_ops::prepare_to_generate_core ()
{
- self = self->beneath;
- self->to_prepare_to_generate_core (self);
+ this->beneath->prepare_to_generate_core ();
}
-static void
-tdefault_prepare_to_generate_core (struct target_ops *self)
+void
+dummy_target::prepare_to_generate_core ()
{
}
-static void
-debug_prepare_to_generate_core (struct target_ops *self)
+void
+debug_target::prepare_to_generate_core ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_prepare_to_generate_core (...)\n", debug_target.to_shortname);
- debug_target.to_prepare_to_generate_core (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_prepare_to_generate_core (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->prepare_to_generate_core (...)\n", this->beneath->shortname ());
+ this->beneath->prepare_to_generate_core ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->prepare_to_generate_core (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-delegate_done_generating_core (struct target_ops *self)
+void
+target_ops::done_generating_core ()
{
- self = self->beneath;
- self->to_done_generating_core (self);
+ this->beneath->done_generating_core ();
}
-static void
-tdefault_done_generating_core (struct target_ops *self)
+void
+dummy_target::done_generating_core ()
{
}
-static void
-debug_done_generating_core (struct target_ops *self)
+void
+debug_target::done_generating_core ()
{
- fprintf_unfiltered (gdb_stdlog, "-> %s->to_done_generating_core (...)\n", debug_target.to_shortname);
- debug_target.to_done_generating_core (&debug_target);
- fprintf_unfiltered (gdb_stdlog, "<- %s->to_done_generating_core (", debug_target.to_shortname);
- target_debug_print_struct_target_ops_p (&debug_target);
+ fprintf_unfiltered (gdb_stdlog, "-> %s->done_generating_core (...)\n", this->beneath->shortname ());
+ this->beneath->done_generating_core ();
+ fprintf_unfiltered (gdb_stdlog, "<- %s->done_generating_core (", this->beneath->shortname ());
fputs_unfiltered (")\n", gdb_stdlog);
}
-static void
-install_delegators (struct target_ops *ops)
-{
- if (ops->to_post_attach == NULL)
- ops->to_post_attach = delegate_post_attach;
- if (ops->to_detach == NULL)
- ops->to_detach = delegate_detach;
- if (ops->to_disconnect == NULL)
- ops->to_disconnect = delegate_disconnect;
- if (ops->to_resume == NULL)
- ops->to_resume = delegate_resume;
- if (ops->to_wait == NULL)
- ops->to_wait = delegate_wait;
- if (ops->to_fetch_registers == NULL)
- ops->to_fetch_registers = delegate_fetch_registers;
- if (ops->to_store_registers == NULL)
- ops->to_store_registers = delegate_store_registers;
- if (ops->to_prepare_to_store == NULL)
- ops->to_prepare_to_store = delegate_prepare_to_store;
- if (ops->to_files_info == NULL)
- ops->to_files_info = delegate_files_info;
- if (ops->to_insert_breakpoint == NULL)
- ops->to_insert_breakpoint = delegate_insert_breakpoint;
- if (ops->to_remove_breakpoint == NULL)
- ops->to_remove_breakpoint = delegate_remove_breakpoint;
- if (ops->to_stopped_by_sw_breakpoint == NULL)
- ops->to_stopped_by_sw_breakpoint = delegate_stopped_by_sw_breakpoint;
- if (ops->to_supports_stopped_by_sw_breakpoint == NULL)
- ops->to_supports_stopped_by_sw_breakpoint = delegate_supports_stopped_by_sw_breakpoint;
- if (ops->to_stopped_by_hw_breakpoint == NULL)
- ops->to_stopped_by_hw_breakpoint = delegate_stopped_by_hw_breakpoint;
- if (ops->to_supports_stopped_by_hw_breakpoint == NULL)
- ops->to_supports_stopped_by_hw_breakpoint = delegate_supports_stopped_by_hw_breakpoint;
- if (ops->to_can_use_hw_breakpoint == NULL)
- ops->to_can_use_hw_breakpoint = delegate_can_use_hw_breakpoint;
- if (ops->to_ranged_break_num_registers == NULL)
- ops->to_ranged_break_num_registers = delegate_ranged_break_num_registers;
- if (ops->to_insert_hw_breakpoint == NULL)
- ops->to_insert_hw_breakpoint = delegate_insert_hw_breakpoint;
- if (ops->to_remove_hw_breakpoint == NULL)
- ops->to_remove_hw_breakpoint = delegate_remove_hw_breakpoint;
- if (ops->to_remove_watchpoint == NULL)
- ops->to_remove_watchpoint = delegate_remove_watchpoint;
- if (ops->to_insert_watchpoint == NULL)
- ops->to_insert_watchpoint = delegate_insert_watchpoint;
- if (ops->to_insert_mask_watchpoint == NULL)
- ops->to_insert_mask_watchpoint = delegate_insert_mask_watchpoint;
- if (ops->to_remove_mask_watchpoint == NULL)
- ops->to_remove_mask_watchpoint = delegate_remove_mask_watchpoint;
- if (ops->to_stopped_by_watchpoint == NULL)
- ops->to_stopped_by_watchpoint = delegate_stopped_by_watchpoint;
- if (ops->to_stopped_data_address == NULL)
- ops->to_stopped_data_address = delegate_stopped_data_address;
- if (ops->to_watchpoint_addr_within_range == NULL)
- ops->to_watchpoint_addr_within_range = delegate_watchpoint_addr_within_range;
- if (ops->to_region_ok_for_hw_watchpoint == NULL)
- ops->to_region_ok_for_hw_watchpoint = delegate_region_ok_for_hw_watchpoint;
- if (ops->to_can_accel_watchpoint_condition == NULL)
- ops->to_can_accel_watchpoint_condition = delegate_can_accel_watchpoint_condition;
- if (ops->to_masked_watch_num_registers == NULL)
- ops->to_masked_watch_num_registers = delegate_masked_watch_num_registers;
- if (ops->to_can_do_single_step == NULL)
- ops->to_can_do_single_step = delegate_can_do_single_step;
- if (ops->to_terminal_init == NULL)
- ops->to_terminal_init = delegate_terminal_init;
- if (ops->to_terminal_inferior == NULL)
- ops->to_terminal_inferior = delegate_terminal_inferior;
- if (ops->to_terminal_ours_for_output == NULL)
- ops->to_terminal_ours_for_output = delegate_terminal_ours_for_output;
- if (ops->to_terminal_ours == NULL)
- ops->to_terminal_ours = delegate_terminal_ours;
- if (ops->to_terminal_info == NULL)
- ops->to_terminal_info = delegate_terminal_info;
- if (ops->to_kill == NULL)
- ops->to_kill = delegate_kill;
- if (ops->to_load == NULL)
- ops->to_load = delegate_load;
- if (ops->to_post_startup_inferior == NULL)
- ops->to_post_startup_inferior = delegate_post_startup_inferior;
- if (ops->to_insert_fork_catchpoint == NULL)
- ops->to_insert_fork_catchpoint = delegate_insert_fork_catchpoint;
- if (ops->to_remove_fork_catchpoint == NULL)
- ops->to_remove_fork_catchpoint = delegate_remove_fork_catchpoint;
- if (ops->to_insert_vfork_catchpoint == NULL)
- ops->to_insert_vfork_catchpoint = delegate_insert_vfork_catchpoint;
- if (ops->to_remove_vfork_catchpoint == NULL)
- ops->to_remove_vfork_catchpoint = delegate_remove_vfork_catchpoint;
- if (ops->to_follow_fork == NULL)
- ops->to_follow_fork = delegate_follow_fork;
- if (ops->to_insert_exec_catchpoint == NULL)
- ops->to_insert_exec_catchpoint = delegate_insert_exec_catchpoint;
- if (ops->to_remove_exec_catchpoint == NULL)
- ops->to_remove_exec_catchpoint = delegate_remove_exec_catchpoint;
- if (ops->to_follow_exec == NULL)
- ops->to_follow_exec = delegate_follow_exec;
- if (ops->to_set_syscall_catchpoint == NULL)
- ops->to_set_syscall_catchpoint = delegate_set_syscall_catchpoint;
- if (ops->to_has_exited == NULL)
- ops->to_has_exited = delegate_has_exited;
- if (ops->to_mourn_inferior == NULL)
- ops->to_mourn_inferior = delegate_mourn_inferior;
- if (ops->to_can_run == NULL)
- ops->to_can_run = delegate_can_run;
- if (ops->to_pass_signals == NULL)
- ops->to_pass_signals = delegate_pass_signals;
- if (ops->to_program_signals == NULL)
- ops->to_program_signals = delegate_program_signals;
- if (ops->to_thread_alive == NULL)
- ops->to_thread_alive = delegate_thread_alive;
- if (ops->to_update_thread_list == NULL)
- ops->to_update_thread_list = delegate_update_thread_list;
- if (ops->to_pid_to_str == NULL)
- ops->to_pid_to_str = delegate_pid_to_str;
- if (ops->to_extra_thread_info == NULL)
- ops->to_extra_thread_info = delegate_extra_thread_info;
- if (ops->to_thread_name == NULL)
- ops->to_thread_name = delegate_thread_name;
- if (ops->to_stop == NULL)
- ops->to_stop = delegate_stop;
- if (ops->to_interrupt == NULL)
- ops->to_interrupt = delegate_interrupt;
- if (ops->to_pass_ctrlc == NULL)
- ops->to_pass_ctrlc = delegate_pass_ctrlc;
- if (ops->to_rcmd == NULL)
- ops->to_rcmd = delegate_rcmd;
- if (ops->to_pid_to_exec_file == NULL)
- ops->to_pid_to_exec_file = delegate_pid_to_exec_file;
- if (ops->to_log_command == NULL)
- ops->to_log_command = delegate_log_command;
- if (ops->to_get_section_table == NULL)
- ops->to_get_section_table = delegate_get_section_table;
- if (ops->to_can_async_p == NULL)
- ops->to_can_async_p = delegate_can_async_p;
- if (ops->to_is_async_p == NULL)
- ops->to_is_async_p = delegate_is_async_p;
- if (ops->to_async == NULL)
- ops->to_async = delegate_async;
- if (ops->to_thread_events == NULL)
- ops->to_thread_events = delegate_thread_events;
- if (ops->to_supports_non_stop == NULL)
- ops->to_supports_non_stop = delegate_supports_non_stop;
- if (ops->to_always_non_stop_p == NULL)
- ops->to_always_non_stop_p = delegate_always_non_stop_p;
- if (ops->to_find_memory_regions == NULL)
- ops->to_find_memory_regions = delegate_find_memory_regions;
- if (ops->to_make_corefile_notes == NULL)
- ops->to_make_corefile_notes = delegate_make_corefile_notes;
- if (ops->to_get_bookmark == NULL)
- ops->to_get_bookmark = delegate_get_bookmark;
- if (ops->to_goto_bookmark == NULL)
- ops->to_goto_bookmark = delegate_goto_bookmark;
- if (ops->to_get_thread_local_address == NULL)
- ops->to_get_thread_local_address = delegate_get_thread_local_address;
- if (ops->to_xfer_partial == NULL)
- ops->to_xfer_partial = delegate_xfer_partial;
- if (ops->to_get_memory_xfer_limit == NULL)
- ops->to_get_memory_xfer_limit = delegate_get_memory_xfer_limit;
- if (ops->to_memory_map == NULL)
- ops->to_memory_map = delegate_memory_map;
- if (ops->to_flash_erase == NULL)
- ops->to_flash_erase = delegate_flash_erase;
- if (ops->to_flash_done == NULL)
- ops->to_flash_done = delegate_flash_done;
- if (ops->to_read_description == NULL)
- ops->to_read_description = delegate_read_description;
- if (ops->to_get_ada_task_ptid == NULL)
- ops->to_get_ada_task_ptid = delegate_get_ada_task_ptid;
- if (ops->to_auxv_parse == NULL)
- ops->to_auxv_parse = delegate_auxv_parse;
- if (ops->to_search_memory == NULL)
- ops->to_search_memory = delegate_search_memory;
- if (ops->to_can_execute_reverse == NULL)
- ops->to_can_execute_reverse = delegate_can_execute_reverse;
- if (ops->to_execution_direction == NULL)
- ops->to_execution_direction = delegate_execution_direction;
- if (ops->to_supports_multi_process == NULL)
- ops->to_supports_multi_process = delegate_supports_multi_process;
- if (ops->to_supports_enable_disable_tracepoint == NULL)
- ops->to_supports_enable_disable_tracepoint = delegate_supports_enable_disable_tracepoint;
- if (ops->to_supports_string_tracing == NULL)
- ops->to_supports_string_tracing = delegate_supports_string_tracing;
- if (ops->to_supports_evaluation_of_breakpoint_conditions == NULL)
- ops->to_supports_evaluation_of_breakpoint_conditions = delegate_supports_evaluation_of_breakpoint_conditions;
- if (ops->to_can_run_breakpoint_commands == NULL)
- ops->to_can_run_breakpoint_commands = delegate_can_run_breakpoint_commands;
- if (ops->to_thread_architecture == NULL)
- ops->to_thread_architecture = delegate_thread_architecture;
- if (ops->to_thread_address_space == NULL)
- ops->to_thread_address_space = delegate_thread_address_space;
- if (ops->to_filesystem_is_local == NULL)
- ops->to_filesystem_is_local = delegate_filesystem_is_local;
- if (ops->to_trace_init == NULL)
- ops->to_trace_init = delegate_trace_init;
- if (ops->to_download_tracepoint == NULL)
- ops->to_download_tracepoint = delegate_download_tracepoint;
- if (ops->to_can_download_tracepoint == NULL)
- ops->to_can_download_tracepoint = delegate_can_download_tracepoint;
- if (ops->to_download_trace_state_variable == NULL)
- ops->to_download_trace_state_variable = delegate_download_trace_state_variable;
- if (ops->to_enable_tracepoint == NULL)
- ops->to_enable_tracepoint = delegate_enable_tracepoint;
- if (ops->to_disable_tracepoint == NULL)
- ops->to_disable_tracepoint = delegate_disable_tracepoint;
- if (ops->to_trace_set_readonly_regions == NULL)
- ops->to_trace_set_readonly_regions = delegate_trace_set_readonly_regions;
- if (ops->to_trace_start == NULL)
- ops->to_trace_start = delegate_trace_start;
- if (ops->to_get_trace_status == NULL)
- ops->to_get_trace_status = delegate_get_trace_status;
- if (ops->to_get_tracepoint_status == NULL)
- ops->to_get_tracepoint_status = delegate_get_tracepoint_status;
- if (ops->to_trace_stop == NULL)
- ops->to_trace_stop = delegate_trace_stop;
- if (ops->to_trace_find == NULL)
- ops->to_trace_find = delegate_trace_find;
- if (ops->to_get_trace_state_variable_value == NULL)
- ops->to_get_trace_state_variable_value = delegate_get_trace_state_variable_value;
- if (ops->to_save_trace_data == NULL)
- ops->to_save_trace_data = delegate_save_trace_data;
- if (ops->to_upload_tracepoints == NULL)
- ops->to_upload_tracepoints = delegate_upload_tracepoints;
- if (ops->to_upload_trace_state_variables == NULL)
- ops->to_upload_trace_state_variables = delegate_upload_trace_state_variables;
- if (ops->to_get_raw_trace_data == NULL)
- ops->to_get_raw_trace_data = delegate_get_raw_trace_data;
- if (ops->to_get_min_fast_tracepoint_insn_len == NULL)
- ops->to_get_min_fast_tracepoint_insn_len = delegate_get_min_fast_tracepoint_insn_len;
- if (ops->to_set_disconnected_tracing == NULL)
- ops->to_set_disconnected_tracing = delegate_set_disconnected_tracing;
- if (ops->to_set_circular_trace_buffer == NULL)
- ops->to_set_circular_trace_buffer = delegate_set_circular_trace_buffer;
- if (ops->to_set_trace_buffer_size == NULL)
- ops->to_set_trace_buffer_size = delegate_set_trace_buffer_size;
- if (ops->to_set_trace_notes == NULL)
- ops->to_set_trace_notes = delegate_set_trace_notes;
- if (ops->to_core_of_thread == NULL)
- ops->to_core_of_thread = delegate_core_of_thread;
- if (ops->to_verify_memory == NULL)
- ops->to_verify_memory = delegate_verify_memory;
- if (ops->to_get_tib_address == NULL)
- ops->to_get_tib_address = delegate_get_tib_address;
- if (ops->to_set_permissions == NULL)
- ops->to_set_permissions = delegate_set_permissions;
- if (ops->to_static_tracepoint_marker_at == NULL)
- ops->to_static_tracepoint_marker_at = delegate_static_tracepoint_marker_at;
- if (ops->to_static_tracepoint_markers_by_strid == NULL)
- ops->to_static_tracepoint_markers_by_strid = delegate_static_tracepoint_markers_by_strid;
- if (ops->to_traceframe_info == NULL)
- ops->to_traceframe_info = delegate_traceframe_info;
- if (ops->to_use_agent == NULL)
- ops->to_use_agent = delegate_use_agent;
- if (ops->to_can_use_agent == NULL)
- ops->to_can_use_agent = delegate_can_use_agent;
- if (ops->to_supports_btrace == NULL)
- ops->to_supports_btrace = delegate_supports_btrace;
- if (ops->to_enable_btrace == NULL)
- ops->to_enable_btrace = delegate_enable_btrace;
- if (ops->to_disable_btrace == NULL)
- ops->to_disable_btrace = delegate_disable_btrace;
- if (ops->to_teardown_btrace == NULL)
- ops->to_teardown_btrace = delegate_teardown_btrace;
- if (ops->to_read_btrace == NULL)
- ops->to_read_btrace = delegate_read_btrace;
- if (ops->to_btrace_conf == NULL)
- ops->to_btrace_conf = delegate_btrace_conf;
- if (ops->to_stop_recording == NULL)
- ops->to_stop_recording = delegate_stop_recording;
- if (ops->to_info_record == NULL)
- ops->to_info_record = delegate_info_record;
- if (ops->to_save_record == NULL)
- ops->to_save_record = delegate_save_record;
- if (ops->to_delete_record == NULL)
- ops->to_delete_record = delegate_delete_record;
- if (ops->to_record_is_replaying == NULL)
- ops->to_record_is_replaying = delegate_record_is_replaying;
- if (ops->to_record_will_replay == NULL)
- ops->to_record_will_replay = delegate_record_will_replay;
- if (ops->to_record_stop_replaying == NULL)
- ops->to_record_stop_replaying = delegate_record_stop_replaying;
- if (ops->to_goto_record_begin == NULL)
- ops->to_goto_record_begin = delegate_goto_record_begin;
- if (ops->to_goto_record_end == NULL)
- ops->to_goto_record_end = delegate_goto_record_end;
- if (ops->to_goto_record == NULL)
- ops->to_goto_record = delegate_goto_record;
- if (ops->to_insn_history == NULL)
- ops->to_insn_history = delegate_insn_history;
- if (ops->to_insn_history_from == NULL)
- ops->to_insn_history_from = delegate_insn_history_from;
- if (ops->to_insn_history_range == NULL)
- ops->to_insn_history_range = delegate_insn_history_range;
- if (ops->to_call_history == NULL)
- ops->to_call_history = delegate_call_history;
- if (ops->to_call_history_from == NULL)
- ops->to_call_history_from = delegate_call_history_from;
- if (ops->to_call_history_range == NULL)
- ops->to_call_history_range = delegate_call_history_range;
- if (ops->to_augmented_libraries_svr4_read == NULL)
- ops->to_augmented_libraries_svr4_read = delegate_augmented_libraries_svr4_read;
- if (ops->to_get_unwinder == NULL)
- ops->to_get_unwinder = delegate_get_unwinder;
- if (ops->to_get_tailcall_unwinder == NULL)
- ops->to_get_tailcall_unwinder = delegate_get_tailcall_unwinder;
- if (ops->to_prepare_to_generate_core == NULL)
- ops->to_prepare_to_generate_core = delegate_prepare_to_generate_core;
- if (ops->to_done_generating_core == NULL)
- ops->to_done_generating_core = delegate_done_generating_core;
-}
-
-static void
-install_dummy_methods (struct target_ops *ops)
-{
- ops->to_post_attach = tdefault_post_attach;
- ops->to_detach = tdefault_detach;
- ops->to_disconnect = tdefault_disconnect;
- ops->to_resume = tdefault_resume;
- ops->to_wait = default_target_wait;
- ops->to_fetch_registers = tdefault_fetch_registers;
- ops->to_store_registers = tdefault_store_registers;
- ops->to_prepare_to_store = tdefault_prepare_to_store;
- ops->to_files_info = tdefault_files_info;
- ops->to_insert_breakpoint = memory_insert_breakpoint;
- ops->to_remove_breakpoint = memory_remove_breakpoint;
- ops->to_stopped_by_sw_breakpoint = tdefault_stopped_by_sw_breakpoint;
- ops->to_supports_stopped_by_sw_breakpoint = tdefault_supports_stopped_by_sw_breakpoint;
- ops->to_stopped_by_hw_breakpoint = tdefault_stopped_by_hw_breakpoint;
- ops->to_supports_stopped_by_hw_breakpoint = tdefault_supports_stopped_by_hw_breakpoint;
- ops->to_can_use_hw_breakpoint = tdefault_can_use_hw_breakpoint;
- ops->to_ranged_break_num_registers = tdefault_ranged_break_num_registers;
- ops->to_insert_hw_breakpoint = tdefault_insert_hw_breakpoint;
- ops->to_remove_hw_breakpoint = tdefault_remove_hw_breakpoint;
- ops->to_remove_watchpoint = tdefault_remove_watchpoint;
- ops->to_insert_watchpoint = tdefault_insert_watchpoint;
- ops->to_insert_mask_watchpoint = tdefault_insert_mask_watchpoint;
- ops->to_remove_mask_watchpoint = tdefault_remove_mask_watchpoint;
- ops->to_stopped_by_watchpoint = tdefault_stopped_by_watchpoint;
- ops->to_stopped_data_address = tdefault_stopped_data_address;
- ops->to_watchpoint_addr_within_range = default_watchpoint_addr_within_range;
- ops->to_region_ok_for_hw_watchpoint = default_region_ok_for_hw_watchpoint;
- ops->to_can_accel_watchpoint_condition = tdefault_can_accel_watchpoint_condition;
- ops->to_masked_watch_num_registers = tdefault_masked_watch_num_registers;
- ops->to_can_do_single_step = tdefault_can_do_single_step;
- ops->to_terminal_init = tdefault_terminal_init;
- ops->to_terminal_inferior = tdefault_terminal_inferior;
- ops->to_terminal_ours_for_output = tdefault_terminal_ours_for_output;
- ops->to_terminal_ours = tdefault_terminal_ours;
- ops->to_terminal_info = default_terminal_info;
- ops->to_kill = tdefault_kill;
- ops->to_load = tdefault_load;
- ops->to_post_startup_inferior = tdefault_post_startup_inferior;
- ops->to_insert_fork_catchpoint = tdefault_insert_fork_catchpoint;
- ops->to_remove_fork_catchpoint = tdefault_remove_fork_catchpoint;
- ops->to_insert_vfork_catchpoint = tdefault_insert_vfork_catchpoint;
- ops->to_remove_vfork_catchpoint = tdefault_remove_vfork_catchpoint;
- ops->to_follow_fork = default_follow_fork;
- ops->to_insert_exec_catchpoint = tdefault_insert_exec_catchpoint;
- ops->to_remove_exec_catchpoint = tdefault_remove_exec_catchpoint;
- ops->to_follow_exec = tdefault_follow_exec;
- ops->to_set_syscall_catchpoint = tdefault_set_syscall_catchpoint;
- ops->to_has_exited = tdefault_has_exited;
- ops->to_mourn_inferior = default_mourn_inferior;
- ops->to_can_run = tdefault_can_run;
- ops->to_pass_signals = tdefault_pass_signals;
- ops->to_program_signals = tdefault_program_signals;
- ops->to_thread_alive = tdefault_thread_alive;
- ops->to_update_thread_list = tdefault_update_thread_list;
- ops->to_pid_to_str = default_pid_to_str;
- ops->to_extra_thread_info = tdefault_extra_thread_info;
- ops->to_thread_name = tdefault_thread_name;
- ops->to_stop = tdefault_stop;
- ops->to_interrupt = tdefault_interrupt;
- ops->to_pass_ctrlc = default_target_pass_ctrlc;
- ops->to_rcmd = default_rcmd;
- ops->to_pid_to_exec_file = tdefault_pid_to_exec_file;
- ops->to_log_command = tdefault_log_command;
- ops->to_get_section_table = tdefault_get_section_table;
- ops->to_can_async_p = tdefault_can_async_p;
- ops->to_is_async_p = tdefault_is_async_p;
- ops->to_async = tdefault_async;
- ops->to_thread_events = tdefault_thread_events;
- ops->to_supports_non_stop = tdefault_supports_non_stop;
- ops->to_always_non_stop_p = tdefault_always_non_stop_p;
- ops->to_find_memory_regions = dummy_find_memory_regions;
- ops->to_make_corefile_notes = dummy_make_corefile_notes;
- ops->to_get_bookmark = tdefault_get_bookmark;
- ops->to_goto_bookmark = tdefault_goto_bookmark;
- ops->to_get_thread_local_address = tdefault_get_thread_local_address;
- ops->to_xfer_partial = tdefault_xfer_partial;
- ops->to_get_memory_xfer_limit = tdefault_get_memory_xfer_limit;
- ops->to_memory_map = tdefault_memory_map;
- ops->to_flash_erase = tdefault_flash_erase;
- ops->to_flash_done = tdefault_flash_done;
- ops->to_read_description = tdefault_read_description;
- ops->to_get_ada_task_ptid = default_get_ada_task_ptid;
- ops->to_auxv_parse = default_auxv_parse;
- ops->to_search_memory = default_search_memory;
- ops->to_can_execute_reverse = tdefault_can_execute_reverse;
- ops->to_execution_direction = default_execution_direction;
- ops->to_supports_multi_process = tdefault_supports_multi_process;
- ops->to_supports_enable_disable_tracepoint = tdefault_supports_enable_disable_tracepoint;
- ops->to_supports_string_tracing = tdefault_supports_string_tracing;
- ops->to_supports_evaluation_of_breakpoint_conditions = tdefault_supports_evaluation_of_breakpoint_conditions;
- ops->to_can_run_breakpoint_commands = tdefault_can_run_breakpoint_commands;
- ops->to_thread_architecture = default_thread_architecture;
- ops->to_thread_address_space = default_thread_address_space;
- ops->to_filesystem_is_local = tdefault_filesystem_is_local;
- ops->to_trace_init = tdefault_trace_init;
- ops->to_download_tracepoint = tdefault_download_tracepoint;
- ops->to_can_download_tracepoint = tdefault_can_download_tracepoint;
- ops->to_download_trace_state_variable = tdefault_download_trace_state_variable;
- ops->to_enable_tracepoint = tdefault_enable_tracepoint;
- ops->to_disable_tracepoint = tdefault_disable_tracepoint;
- ops->to_trace_set_readonly_regions = tdefault_trace_set_readonly_regions;
- ops->to_trace_start = tdefault_trace_start;
- ops->to_get_trace_status = tdefault_get_trace_status;
- ops->to_get_tracepoint_status = tdefault_get_tracepoint_status;
- ops->to_trace_stop = tdefault_trace_stop;
- ops->to_trace_find = tdefault_trace_find;
- ops->to_get_trace_state_variable_value = tdefault_get_trace_state_variable_value;
- ops->to_save_trace_data = tdefault_save_trace_data;
- ops->to_upload_tracepoints = tdefault_upload_tracepoints;
- ops->to_upload_trace_state_variables = tdefault_upload_trace_state_variables;
- ops->to_get_raw_trace_data = tdefault_get_raw_trace_data;
- ops->to_get_min_fast_tracepoint_insn_len = tdefault_get_min_fast_tracepoint_insn_len;
- ops->to_set_disconnected_tracing = tdefault_set_disconnected_tracing;
- ops->to_set_circular_trace_buffer = tdefault_set_circular_trace_buffer;
- ops->to_set_trace_buffer_size = tdefault_set_trace_buffer_size;
- ops->to_set_trace_notes = tdefault_set_trace_notes;
- ops->to_core_of_thread = tdefault_core_of_thread;
- ops->to_verify_memory = default_verify_memory;
- ops->to_get_tib_address = tdefault_get_tib_address;
- ops->to_set_permissions = tdefault_set_permissions;
- ops->to_static_tracepoint_marker_at = tdefault_static_tracepoint_marker_at;
- ops->to_static_tracepoint_markers_by_strid = tdefault_static_tracepoint_markers_by_strid;
- ops->to_traceframe_info = tdefault_traceframe_info;
- ops->to_use_agent = tdefault_use_agent;
- ops->to_can_use_agent = tdefault_can_use_agent;
- ops->to_supports_btrace = tdefault_supports_btrace;
- ops->to_enable_btrace = tdefault_enable_btrace;
- ops->to_disable_btrace = tdefault_disable_btrace;
- ops->to_teardown_btrace = tdefault_teardown_btrace;
- ops->to_read_btrace = tdefault_read_btrace;
- ops->to_btrace_conf = tdefault_btrace_conf;
- ops->to_stop_recording = tdefault_stop_recording;
- ops->to_info_record = tdefault_info_record;
- ops->to_save_record = tdefault_save_record;
- ops->to_delete_record = tdefault_delete_record;
- ops->to_record_is_replaying = tdefault_record_is_replaying;
- ops->to_record_will_replay = tdefault_record_will_replay;
- ops->to_record_stop_replaying = tdefault_record_stop_replaying;
- ops->to_goto_record_begin = tdefault_goto_record_begin;
- ops->to_goto_record_end = tdefault_goto_record_end;
- ops->to_goto_record = tdefault_goto_record;
- ops->to_insn_history = tdefault_insn_history;
- ops->to_insn_history_from = tdefault_insn_history_from;
- ops->to_insn_history_range = tdefault_insn_history_range;
- ops->to_call_history = tdefault_call_history;
- ops->to_call_history_from = tdefault_call_history_from;
- ops->to_call_history_range = tdefault_call_history_range;
- ops->to_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read;
- ops->to_get_unwinder = tdefault_get_unwinder;
- ops->to_get_tailcall_unwinder = tdefault_get_tailcall_unwinder;
- ops->to_prepare_to_generate_core = tdefault_prepare_to_generate_core;
- ops->to_done_generating_core = tdefault_done_generating_core;
-}
-
-static void
-init_debug_target (struct target_ops *ops)
-{
- ops->to_post_attach = debug_post_attach;
- ops->to_detach = debug_detach;
- ops->to_disconnect = debug_disconnect;
- ops->to_resume = debug_resume;
- ops->to_wait = debug_wait;
- ops->to_fetch_registers = debug_fetch_registers;
- ops->to_store_registers = debug_store_registers;
- ops->to_prepare_to_store = debug_prepare_to_store;
- ops->to_files_info = debug_files_info;
- ops->to_insert_breakpoint = debug_insert_breakpoint;
- ops->to_remove_breakpoint = debug_remove_breakpoint;
- ops->to_stopped_by_sw_breakpoint = debug_stopped_by_sw_breakpoint;
- ops->to_supports_stopped_by_sw_breakpoint = debug_supports_stopped_by_sw_breakpoint;
- ops->to_stopped_by_hw_breakpoint = debug_stopped_by_hw_breakpoint;
- ops->to_supports_stopped_by_hw_breakpoint = debug_supports_stopped_by_hw_breakpoint;
- ops->to_can_use_hw_breakpoint = debug_can_use_hw_breakpoint;
- ops->to_ranged_break_num_registers = debug_ranged_break_num_registers;
- ops->to_insert_hw_breakpoint = debug_insert_hw_breakpoint;
- ops->to_remove_hw_breakpoint = debug_remove_hw_breakpoint;
- ops->to_remove_watchpoint = debug_remove_watchpoint;
- ops->to_insert_watchpoint = debug_insert_watchpoint;
- ops->to_insert_mask_watchpoint = debug_insert_mask_watchpoint;
- ops->to_remove_mask_watchpoint = debug_remove_mask_watchpoint;
- ops->to_stopped_by_watchpoint = debug_stopped_by_watchpoint;
- ops->to_stopped_data_address = debug_stopped_data_address;
- ops->to_watchpoint_addr_within_range = debug_watchpoint_addr_within_range;
- ops->to_region_ok_for_hw_watchpoint = debug_region_ok_for_hw_watchpoint;
- ops->to_can_accel_watchpoint_condition = debug_can_accel_watchpoint_condition;
- ops->to_masked_watch_num_registers = debug_masked_watch_num_registers;
- ops->to_can_do_single_step = debug_can_do_single_step;
- ops->to_terminal_init = debug_terminal_init;
- ops->to_terminal_inferior = debug_terminal_inferior;
- ops->to_terminal_ours_for_output = debug_terminal_ours_for_output;
- ops->to_terminal_ours = debug_terminal_ours;
- ops->to_terminal_info = debug_terminal_info;
- ops->to_kill = debug_kill;
- ops->to_load = debug_load;
- ops->to_post_startup_inferior = debug_post_startup_inferior;
- ops->to_insert_fork_catchpoint = debug_insert_fork_catchpoint;
- ops->to_remove_fork_catchpoint = debug_remove_fork_catchpoint;
- ops->to_insert_vfork_catchpoint = debug_insert_vfork_catchpoint;
- ops->to_remove_vfork_catchpoint = debug_remove_vfork_catchpoint;
- ops->to_follow_fork = debug_follow_fork;
- ops->to_insert_exec_catchpoint = debug_insert_exec_catchpoint;
- ops->to_remove_exec_catchpoint = debug_remove_exec_catchpoint;
- ops->to_follow_exec = debug_follow_exec;
- ops->to_set_syscall_catchpoint = debug_set_syscall_catchpoint;
- ops->to_has_exited = debug_has_exited;
- ops->to_mourn_inferior = debug_mourn_inferior;
- ops->to_can_run = debug_can_run;
- ops->to_pass_signals = debug_pass_signals;
- ops->to_program_signals = debug_program_signals;
- ops->to_thread_alive = debug_thread_alive;
- ops->to_update_thread_list = debug_update_thread_list;
- ops->to_pid_to_str = debug_pid_to_str;
- ops->to_extra_thread_info = debug_extra_thread_info;
- ops->to_thread_name = debug_thread_name;
- ops->to_stop = debug_stop;
- ops->to_interrupt = debug_interrupt;
- ops->to_pass_ctrlc = debug_pass_ctrlc;
- ops->to_rcmd = debug_rcmd;
- ops->to_pid_to_exec_file = debug_pid_to_exec_file;
- ops->to_log_command = debug_log_command;
- ops->to_get_section_table = debug_get_section_table;
- ops->to_can_async_p = debug_can_async_p;
- ops->to_is_async_p = debug_is_async_p;
- ops->to_async = debug_async;
- ops->to_thread_events = debug_thread_events;
- ops->to_supports_non_stop = debug_supports_non_stop;
- ops->to_always_non_stop_p = debug_always_non_stop_p;
- ops->to_find_memory_regions = debug_find_memory_regions;
- ops->to_make_corefile_notes = debug_make_corefile_notes;
- ops->to_get_bookmark = debug_get_bookmark;
- ops->to_goto_bookmark = debug_goto_bookmark;
- ops->to_get_thread_local_address = debug_get_thread_local_address;
- ops->to_xfer_partial = debug_xfer_partial;
- ops->to_get_memory_xfer_limit = debug_get_memory_xfer_limit;
- ops->to_memory_map = debug_memory_map;
- ops->to_flash_erase = debug_flash_erase;
- ops->to_flash_done = debug_flash_done;
- ops->to_read_description = debug_read_description;
- ops->to_get_ada_task_ptid = debug_get_ada_task_ptid;
- ops->to_auxv_parse = debug_auxv_parse;
- ops->to_search_memory = debug_search_memory;
- ops->to_can_execute_reverse = debug_can_execute_reverse;
- ops->to_execution_direction = debug_execution_direction;
- ops->to_supports_multi_process = debug_supports_multi_process;
- ops->to_supports_enable_disable_tracepoint = debug_supports_enable_disable_tracepoint;
- ops->to_supports_string_tracing = debug_supports_string_tracing;
- ops->to_supports_evaluation_of_breakpoint_conditions = debug_supports_evaluation_of_breakpoint_conditions;
- ops->to_can_run_breakpoint_commands = debug_can_run_breakpoint_commands;
- ops->to_thread_architecture = debug_thread_architecture;
- ops->to_thread_address_space = debug_thread_address_space;
- ops->to_filesystem_is_local = debug_filesystem_is_local;
- ops->to_trace_init = debug_trace_init;
- ops->to_download_tracepoint = debug_download_tracepoint;
- ops->to_can_download_tracepoint = debug_can_download_tracepoint;
- ops->to_download_trace_state_variable = debug_download_trace_state_variable;
- ops->to_enable_tracepoint = debug_enable_tracepoint;
- ops->to_disable_tracepoint = debug_disable_tracepoint;
- ops->to_trace_set_readonly_regions = debug_trace_set_readonly_regions;
- ops->to_trace_start = debug_trace_start;
- ops->to_get_trace_status = debug_get_trace_status;
- ops->to_get_tracepoint_status = debug_get_tracepoint_status;
- ops->to_trace_stop = debug_trace_stop;
- ops->to_trace_find = debug_trace_find;
- ops->to_get_trace_state_variable_value = debug_get_trace_state_variable_value;
- ops->to_save_trace_data = debug_save_trace_data;
- ops->to_upload_tracepoints = debug_upload_tracepoints;
- ops->to_upload_trace_state_variables = debug_upload_trace_state_variables;
- ops->to_get_raw_trace_data = debug_get_raw_trace_data;
- ops->to_get_min_fast_tracepoint_insn_len = debug_get_min_fast_tracepoint_insn_len;
- ops->to_set_disconnected_tracing = debug_set_disconnected_tracing;
- ops->to_set_circular_trace_buffer = debug_set_circular_trace_buffer;
- ops->to_set_trace_buffer_size = debug_set_trace_buffer_size;
- ops->to_set_trace_notes = debug_set_trace_notes;
- ops->to_core_of_thread = debug_core_of_thread;
- ops->to_verify_memory = debug_verify_memory;
- ops->to_get_tib_address = debug_get_tib_address;
- ops->to_set_permissions = debug_set_permissions;
- ops->to_static_tracepoint_marker_at = debug_static_tracepoint_marker_at;
- ops->to_static_tracepoint_markers_by_strid = debug_static_tracepoint_markers_by_strid;
- ops->to_traceframe_info = debug_traceframe_info;
- ops->to_use_agent = debug_use_agent;
- ops->to_can_use_agent = debug_can_use_agent;
- ops->to_supports_btrace = debug_supports_btrace;
- ops->to_enable_btrace = debug_enable_btrace;
- ops->to_disable_btrace = debug_disable_btrace;
- ops->to_teardown_btrace = debug_teardown_btrace;
- ops->to_read_btrace = debug_read_btrace;
- ops->to_btrace_conf = debug_btrace_conf;
- ops->to_stop_recording = debug_stop_recording;
- ops->to_info_record = debug_info_record;
- ops->to_save_record = debug_save_record;
- ops->to_delete_record = debug_delete_record;
- ops->to_record_is_replaying = debug_record_is_replaying;
- ops->to_record_will_replay = debug_record_will_replay;
- ops->to_record_stop_replaying = debug_record_stop_replaying;
- ops->to_goto_record_begin = debug_goto_record_begin;
- ops->to_goto_record_end = debug_goto_record_end;
- ops->to_goto_record = debug_goto_record;
- ops->to_insn_history = debug_insn_history;
- ops->to_insn_history_from = debug_insn_history_from;
- ops->to_insn_history_range = debug_insn_history_range;
- ops->to_call_history = debug_call_history;
- ops->to_call_history_from = debug_call_history_from;
- ops->to_call_history_range = debug_call_history_range;
- ops->to_augmented_libraries_svr4_read = debug_augmented_libraries_svr4_read;
- ops->to_get_unwinder = debug_get_unwinder;
- ops->to_get_tailcall_unwinder = debug_get_tailcall_unwinder;
- ops->to_prepare_to_generate_core = debug_prepare_to_generate_core;
- ops->to_done_generating_core = debug_done_generating_core;
-}
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 40f04786b08..fa85d74278c 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -339,11 +339,11 @@ target_find_description (void)
/* Next try to read the description from the current target using
target objects. */
if (current_target_desc == NULL)
- current_target_desc = target_read_description_xml (&current_target);
+ current_target_desc = target_read_description_xml (target_stack);
/* If that failed try a target-specific hook. */
if (current_target_desc == NULL)
- current_target_desc = target_read_description (&current_target);
+ current_target_desc = target_read_description (target_stack);
/* If a non-NULL description was returned, then update the current
architecture. */
diff --git a/gdb/target-memory.c b/gdb/target-memory.c
index 39d022b90dd..0c881a57d9d 100644
--- a/gdb/target-memory.c
+++ b/gdb/target-memory.c
@@ -397,7 +397,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
{
LONGEST len;
- len = target_write_with_progress (current_target.beneath,
+ len = target_write_with_progress (target_stack,
TARGET_OBJECT_MEMORY, NULL,
r->data, r->begin, r->end - r->begin,
progress_cb, r->baton);
@@ -420,7 +420,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
{
LONGEST len;
- len = target_write_with_progress (&current_target,
+ len = target_write_with_progress (target_stack,
TARGET_OBJECT_FLASH, NULL,
r->data, r->begin,
r->end - r->begin,
diff --git a/gdb/target.c b/gdb/target.c
index 13e3cdb50d3..072b0097bfb 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -84,13 +84,9 @@ static struct address_space *default_thread_address_space
static void tcomplain (void) ATTRIBUTE_NORETURN;
-static int return_zero (struct target_ops *);
-
-static int return_zero_has_execution (struct target_ops *, ptid_t);
-
static void target_command (char *, int);
-static struct target_ops *find_default_run_target (char *);
+static struct target_ops *find_default_run_target (const char *);
static struct gdbarch *default_thread_architecture (struct target_ops *ops,
ptid_t ptid);
@@ -107,14 +103,6 @@ static char *default_pid_to_str (struct target_ops *ops, ptid_t ptid);
static enum exec_direction_kind default_execution_direction
(struct target_ops *self);
-static struct target_ops debug_target;
-
-#include "target-delegates.c"
-
-static void init_dummy_target (void);
-
-static void update_current_target (void);
-
/* Vector of existing target structures. */
typedef struct target_ops *target_ops_p;
DEF_VEC_P (target_ops_p);
@@ -123,16 +111,14 @@ static VEC (target_ops_p) *target_structs;
/* The initial current target, so that there is always a semi-valid
current target. */
-static struct target_ops dummy_target;
+static struct target_ops *the_dummy_target;
+static struct target_ops *the_debug_target;
/* Top of target stack. */
-
-static struct target_ops *target_stack;
-
/* The target structure we are currently using to talk to a process
or file or whatever "inferior" we have. */
-struct target_ops current_target;
+struct target_ops *target_stack;
/* Command list for target. */
@@ -171,7 +157,10 @@ static unsigned int targetdebug = 0;
static void
set_targetdebug (char *args, int from_tty, struct cmd_list_element *c)
{
- update_current_target ();
+ if (targetdebug)
+ push_target (the_debug_target);
+ else
+ unpush_target (the_debug_target);
}
static void
@@ -181,8 +170,6 @@ show_targetdebug (struct ui_file *file, int from_tty,
fprintf_filtered (file, _("Target debugging is %s.\n"), value);
}
-static void setup_target_debug (void);
-
/* The user just typed 'target' without the name of a target. */
static void
@@ -195,7 +182,7 @@ target_command (char *arg, int from_tty)
/* Default target_has_* methods for process_stratum targets. */
int
-default_child_has_all_memory (struct target_ops *ops)
+default_child_has_all_memory ()
{
/* If no inferior selected, then we can't read memory here. */
if (ptid_equal (inferior_ptid, null_ptid))
@@ -205,7 +192,7 @@ default_child_has_all_memory (struct target_ops *ops)
}
int
-default_child_has_memory (struct target_ops *ops)
+default_child_has_memory ()
{
/* If no inferior selected, then we can't read memory here. */
if (ptid_equal (inferior_ptid, null_ptid))
@@ -215,7 +202,7 @@ default_child_has_memory (struct target_ops *ops)
}
int
-default_child_has_stack (struct target_ops *ops)
+default_child_has_stack ()
{
/* If no inferior selected, there's no stack. */
if (ptid_equal (inferior_ptid, null_ptid))
@@ -225,7 +212,7 @@ default_child_has_stack (struct target_ops *ops)
}
int
-default_child_has_registers (struct target_ops *ops)
+default_child_has_registers ()
{
/* Can't read registers from no inferior. */
if (ptid_equal (inferior_ptid, null_ptid))
@@ -235,7 +222,7 @@ default_child_has_registers (struct target_ops *ops)
}
int
-default_child_has_execution (struct target_ops *ops, ptid_t the_ptid)
+default_child_has_execution (ptid_t the_ptid)
{
/* If there's no thread selected, then we can't make it run through
hoops. */
@@ -251,8 +238,8 @@ target_has_all_memory_1 (void)
{
struct target_ops *t;
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_has_all_memory (t))
+ for (t = target_stack; t != NULL; t = t->beneath)
+ if (t->has_all_memory ())
return 1;
return 0;
@@ -263,8 +250,8 @@ target_has_memory_1 (void)
{
struct target_ops *t;
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_has_memory (t))
+ for (t = target_stack; t != NULL; t = t->beneath)
+ if (t->has_memory ())
return 1;
return 0;
@@ -275,8 +262,8 @@ target_has_stack_1 (void)
{
struct target_ops *t;
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_has_stack (t))
+ for (t = target_stack; t != NULL; t = t->beneath)
+ if (t->has_stack ())
return 1;
return 0;
@@ -287,8 +274,8 @@ target_has_registers_1 (void)
{
struct target_ops *t;
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_has_registers (t))
+ for (t = target_stack; t != NULL; t = t->beneath)
+ if (t->has_registers ())
return 1;
return 0;
@@ -299,8 +286,8 @@ target_has_execution_1 (ptid_t the_ptid)
{
struct target_ops *t;
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- if (t->to_has_execution (t, the_ptid))
+ for (t = target_stack; t != NULL; t = t->beneath)
+ if (t->has_execution (the_ptid))
return 1;
return 0;
@@ -312,38 +299,6 @@ target_has_execution_current (void)
return target_has_execution_1 (inferior_ptid);
}
-/* Complete initialization of T. This ensures that various fields in
- T are set, if needed by the target implementation. */
-
-void
-complete_target_initialization (struct target_ops *t)
-{
- /* Provide default values for all "must have" methods. */
-
- if (t->to_has_all_memory == NULL)
- t->to_has_all_memory = return_zero;
-
- if (t->to_has_memory == NULL)
- t->to_has_memory = return_zero;
-
- if (t->to_has_stack == NULL)
- t->to_has_stack = return_zero;
-
- if (t->to_has_registers == NULL)
- t->to_has_registers = return_zero;
-
- if (t->to_has_execution == NULL)
- t->to_has_execution = return_zero_has_execution;
-
- /* These methods can be called on an unpushed target and so require
- a default implementation if the target might plausibly be the
- default run target. */
- gdb_assert (t->to_can_run == NULL || (t->to_can_async_p != NULL
- && t->to_supports_non_stop != NULL));
-
- install_delegators (t);
-}
-
/* This is used to implement the various target commands. */
static void
@@ -353,17 +308,17 @@ open_target (char *args, int from_tty, struct cmd_list_element *command)
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "-> %s->to_open (...)\n",
- ops->to_shortname);
+ ops->shortname ());
- ops->to_open (args, from_tty);
+ ops->open (args, from_tty);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "<- %s->to_open (%s, %d)\n",
- ops->to_shortname, args, from_tty);
+ ops->shortname (), args, from_tty);
}
/* Add possible target architecture T to the list and add a new
- command 'target T->to_shortname'. Set COMPLETER as the command's
+ command 'target T->shortname ()'. Set COMPLETER as the command's
completer if not NULL. */
void
@@ -372,8 +327,6 @@ add_target_with_completer (struct target_ops *t,
{
struct cmd_list_element *c;
- complete_target_initialization (t);
-
VEC_safe_push (target_ops_p, target_structs, t);
if (targetlist == NULL)
@@ -384,7 +337,7 @@ Remaining arguments are interpreted by the target protocol. For more\n\
information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name."),
&targetlist, "target ", 0, &cmdlist);
- c = add_cmd (t->to_shortname, no_class, NULL, t->to_doc, &targetlist);
+ c = add_cmd (t->shortname (), no_class, NULL, t->doc (), &targetlist);
set_cmd_sfunc (c, open_target);
set_cmd_context (c, t);
if (completer != NULL)
@@ -409,10 +362,10 @@ add_deprecated_target_alias (struct target_ops *t, char *alias)
/* If we use add_alias_cmd, here, we do not get the deprecated warning,
see PR cli/15104. */
- c = add_cmd (alias, no_class, NULL, t->to_doc, &targetlist);
+ c = add_cmd (alias, no_class, NULL, t->doc (), &targetlist);
set_cmd_sfunc (c, open_target);
set_cmd_context (c, t);
- alt = xstrprintf ("target %s", t->to_shortname);
+ alt = xstrprintf ("target %s", t->shortname ());
deprecate_cmd (c, alt);
}
@@ -421,14 +374,14 @@ add_deprecated_target_alias (struct target_ops *t, char *alias)
void
target_kill (void)
{
- current_target.to_kill (&current_target);
+ target_stack->kill ();
}
void
target_load (const char *arg, int from_tty)
{
target_dcache_invalidate ();
- (*current_target.to_load) (&current_target, arg, from_tty);
+ target_stack->load (arg, from_tty);
}
/* Possible terminal states. */
@@ -453,7 +406,7 @@ static enum terminal_state terminal_state = terminal_is_ours;
void
target_terminal_init (void)
{
- (*current_target.to_terminal_init) (&current_target);
+ target_stack->terminal_init ();
terminal_state = terminal_is_ours;
}
@@ -498,7 +451,7 @@ target_terminal_inferior (void)
/* If GDB is resuming the inferior in the foreground, install
inferior's terminal modes. */
- (*current_target.to_terminal_inferior) (&current_target);
+ target_stack->terminal_inferior ();
terminal_state = terminal_is_inferior;
/* If the user hit C-c before, pretend that it was hit right
@@ -521,7 +474,7 @@ target_terminal_ours (void)
if (terminal_state == terminal_is_ours)
return;
- (*current_target.to_terminal_ours) (&current_target);
+ target_stack->terminal_ours ();
terminal_state = terminal_is_ours;
}
@@ -538,7 +491,7 @@ target_terminal_ours_for_output (void)
if (terminal_state != terminal_is_inferior)
return;
- (*current_target.to_terminal_ours_for_output) (&current_target);
+ target_stack->terminal_ours_for_output ();
terminal_state = terminal_is_ours_for_output;
}
@@ -547,16 +500,7 @@ target_terminal_ours_for_output (void)
int
target_supports_terminal_ours (void)
{
- struct target_ops *t;
-
- for (t = current_target.beneath; t != NULL; t = t->beneath)
- {
- if (t->to_terminal_ours != delegate_terminal_ours
- && t->to_terminal_ours != tdefault_terminal_ours)
- return 1;
- }
-
- return 0;
+ return target_stack->supports_terminal_ours ();
}
/* Restore the terminal to its previous state (helper for
@@ -597,7 +541,7 @@ static void
tcomplain (void)
{
error (_("You can't do that when your target is `%s'"),
- current_target.to_shortname);
+ target_stack->shortname ());
}
void
@@ -636,57 +580,6 @@ default_execution_direction (struct target_ops *self)
to_execution_direction must be implemented for reverse async");
}
-/* Go through the target stack from top to bottom, copying over zero
- entries in current_target, then filling in still empty entries. In
- effect, we are doing class inheritance through the pushed target
- vectors.
-
- NOTE: cagney/2003-10-17: The problem with this inheritance, as it
- is currently implemented, is that it discards any knowledge of
- which target an inherited method originally belonged to.
- Consequently, new new target methods should instead explicitly and
- locally search the target stack for the target that can handle the
- request. */
-
-static void
-update_current_target (void)
-{
- struct target_ops *t;
-
- /* First, reset current's contents. */
- memset (&current_target, 0, sizeof (current_target));
-
- /* Install the delegators. */
- install_delegators (&current_target);
-
- current_target.to_stratum = target_stack->to_stratum;
-
-#define INHERIT(FIELD, TARGET) \
- if (!current_target.FIELD) \
- current_target.FIELD = (TARGET)->FIELD
-
- /* Do not add any new INHERITs here. Instead, use the delegation
- mechanism provided by make-target-delegates. */
- for (t = target_stack; t; t = t->beneath)
- {
- INHERIT (to_shortname, t);
- INHERIT (to_longname, t);
- INHERIT (to_attach_no_wait, t);
- INHERIT (to_have_steppable_watchpoint, t);
- INHERIT (to_have_continuable_watchpoint, t);
- INHERIT (to_has_thread_control, t);
- }
-#undef INHERIT
-
- /* Finally, position the target-stack beneath the squashed
- "current_target". That way code looking for a non-inherited
- target method can quickly and simply find it. */
- current_target.beneath = target_stack;
-
- if (targetdebug)
- setup_target_debug ();
-}
-
/* Push a new target type into the stack of the existing target accessors,
possibly superseding some of the existing accessors.
@@ -699,17 +592,6 @@ push_target (struct target_ops *t)
{
struct target_ops **cur;
- /* Check magic number. If wrong, it probably means someone changed
- the struct definition, but not all the places that initialize one. */
- if (t->to_magic != OPS_MAGIC)
- {
- fprintf_unfiltered (gdb_stderr,
- "Magic number of %s target struct wrong\n",
- t->to_shortname);
- internal_error (__FILE__, __LINE__,
- _("failed internal consistency check"));
- }
-
/* Find the proper stratum to install this target in. */
for (cur = &target_stack; (*cur) != NULL; cur = &(*cur)->beneath)
{
@@ -734,8 +616,6 @@ push_target (struct target_ops *t)
/* We have removed all targets in our stratum, now add the new one. */
t->beneath = (*cur);
(*cur) = t;
-
- update_current_target ();
}
/* Remove a target_ops vector from the stack, wherever it may be.
@@ -770,8 +650,6 @@ unpush_target (struct target_ops *t)
(*cur) = (*cur)->beneath;
tmp->beneath = NULL;
- update_current_target ();
-
/* Finally close the target. Note we do this after unchaining, so
any target method calls from within the target_close
implementation don't end up in T anymore. */
@@ -789,7 +667,7 @@ unpush_target_and_assert (struct target_ops *target)
{
fprintf_unfiltered (gdb_stderr,
"pop_all_targets couldn't find target %s\n",
- target->to_shortname);
+ target->shortname ());
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
}
@@ -798,7 +676,7 @@ unpush_target_and_assert (struct target_ops *target)
void
pop_all_targets_above (enum strata above_stratum)
{
- while ((int) (current_target.to_stratum) > (int) above_stratum)
+ while ((int) (target_stack->to_stratum) > (int) above_stratum)
unpush_target_and_assert (target_stack);
}
@@ -807,7 +685,7 @@ pop_all_targets_above (enum strata above_stratum)
void
pop_all_targets_at_and_above (enum strata stratum)
{
- while ((int) (current_target.to_stratum) >= (int) stratum)
+ while ((int) (target_stack->to_stratum) >= (int) stratum)
unpush_target_and_assert (target_stack);
}
@@ -824,17 +702,6 @@ target_is_pushed (struct target_ops *t)
{
struct target_ops *cur;
- /* Check magic number. If wrong, it probably means someone changed
- the struct definition, but not all the places that initialize one. */
- if (t->to_magic != OPS_MAGIC)
- {
- fprintf_unfiltered (gdb_stderr,
- "Magic number of %s target struct wrong\n",
- t->to_shortname);
- internal_error (__FILE__, __LINE__,
- _("failed internal consistency check"));
- }
-
for (cur = target_stack; cur != NULL; cur = cur->beneath)
if (cur == t)
return 1;
@@ -857,7 +724,7 @@ CORE_ADDR
target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
{
volatile CORE_ADDR addr = 0;
- struct target_ops *target = &current_target;
+ struct target_ops *target = target_stack;
if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
{
@@ -871,8 +738,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch (),
objfile);
- addr = target->to_get_thread_local_address (target, ptid,
- lm_addr, offset);
+ addr = target->get_thread_local_address (ptid, lm_addr, offset);
}
/* If an error occurred, print TLS related messages here. Otherwise,
throw the error to some higher catcher. */
@@ -1029,7 +895,7 @@ done:
struct target_section_table *
target_get_section_table (struct target_ops *target)
{
- return (*target->to_get_section_table) (target);
+ return target->get_section_table ();
}
/* Find a section containing ADDR. */
@@ -1117,9 +983,9 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
do
{
- res = ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
- readbuf, writebuf, memaddr, len,
- xfered_len);
+ res = ops->xfer_partial (TARGET_OBJECT_MEMORY, NULL,
+ readbuf, writebuf, memaddr, len,
+ xfered_len);
if (res == TARGET_XFER_OK)
break;
@@ -1129,7 +995,7 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
/* We want to continue past core files to executables, but not
past a running target's memory. */
- if (ops->to_has_all_memory (ops))
+ if (ops->has_all_memory ())
break;
ops = ops->beneath;
@@ -1292,7 +1158,7 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
shadow handling even though we only end up writing a small
subset of it. Cap writes to a limit specified by the target
to mitigate this. */
- len = min (ops->to_get_memory_xfer_limit (ops), len);
+ len = min (ops->get_memory_xfer_limit (), len);
buf = (gdb_byte *) xmalloc (len);
old_chain = make_cleanup (xfree, buf);
@@ -1335,8 +1201,6 @@ target_xfer_partial (struct target_ops *ops,
{
enum target_xfer_status retval;
- gdb_assert (ops->to_xfer_partial != NULL);
-
/* Transfer is done when LEN is zero. */
if (len == 0)
return TARGET_XFER_EOF;
@@ -1371,8 +1235,8 @@ target_xfer_partial (struct target_ops *ops,
xfered_len);
}
else
- retval = ops->to_xfer_partial (ops, object, annex, readbuf,
- writebuf, offset, len, xfered_len);
+ retval = ops->xfer_partial (object, annex, readbuf,
+ writebuf, offset, len, xfered_len);
if (targetdebug)
{
@@ -1381,7 +1245,7 @@ target_xfer_partial (struct target_ops *ops,
fprintf_unfiltered (gdb_stdlog,
"%s:target_xfer_partial "
"(%d, %s, %s, %s, %s, %s) = %d, %s",
- ops->to_shortname,
+ ops->shortname (),
(int) object,
(annex ? annex : "(null)"),
host_address_to_string (readbuf),
@@ -1441,10 +1305,7 @@ target_xfer_partial (struct target_ops *ops,
int
target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- /* Dispatch to the topmost target, not the flattened current_target.
- Memory accesses check target->to_has_(all_)memory, and the
- flattened target doesn't inherit those. */
- if (target_read (current_target.beneath, TARGET_OBJECT_MEMORY, NULL,
+ if (target_read (target_stack, TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1474,9 +1335,7 @@ target_read_uint32 (CORE_ADDR memaddr, uint32_t *result)
int
target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- /* See comment in target_read_memory about why the request starts at
- current_target.beneath. */
- if (target_read (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
+ if (target_read (target_stack, TARGET_OBJECT_RAW_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1489,9 +1348,7 @@ target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int
target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- /* See comment in target_read_memory about why the request starts at
- current_target.beneath. */
- if (target_read (current_target.beneath, TARGET_OBJECT_STACK_MEMORY, NULL,
+ if (target_read (target_stack, TARGET_OBJECT_STACK_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1504,9 +1361,7 @@ target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int
target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- /* See comment in target_read_memory about why the request starts at
- current_target.beneath. */
- if (target_read (current_target.beneath, TARGET_OBJECT_CODE_MEMORY, NULL,
+ if (target_read (target_stack, TARGET_OBJECT_CODE_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1522,9 +1377,7 @@ target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int
target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
{
- /* See comment in target_read_memory about why the request starts at
- current_target.beneath. */
- if (target_write (current_target.beneath, TARGET_OBJECT_MEMORY, NULL,
+ if (target_write (target_stack, TARGET_OBJECT_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1540,9 +1393,7 @@ target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
int
target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
{
- /* See comment in target_read_memory about why the request starts at
- current_target.beneath. */
- if (target_write (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
+ if (target_write (target_stack, TARGET_OBJECT_RAW_MEMORY, NULL,
myaddr, memaddr, len) == len)
return 0;
else
@@ -1557,7 +1408,7 @@ target_memory_map (void)
VEC(mem_region_s) *result;
struct mem_region *last_one, *this_one;
int ix;
- result = current_target.to_memory_map (&current_target);
+ result = target_stack->memory_map ();
if (result == NULL)
return NULL;
@@ -1588,13 +1439,13 @@ target_memory_map (void)
void
target_flash_erase (ULONGEST address, LONGEST length)
{
- current_target.to_flash_erase (&current_target, address, length);
+ target_stack->flash_erase (address, length);
}
void
target_flash_done (void)
{
- current_target.to_flash_done (&current_target);
+ target_stack->flash_done ();
}
static void
@@ -2105,8 +1956,7 @@ target_insert_breakpoint (struct gdbarch *gdbarch,
return 1;
}
- return current_target.to_insert_breakpoint (&current_target,
- gdbarch, bp_tgt);
+ return target_stack->insert_breakpoint (gdbarch, bp_tgt);
}
/* See target.h. */
@@ -2126,8 +1976,7 @@ target_remove_breakpoint (struct gdbarch *gdbarch,
return 1;
}
- return current_target.to_remove_breakpoint (&current_target,
- gdbarch, bp_tgt, reason);
+ return target_stack->remove_breakpoint (gdbarch, bp_tgt, reason);
}
static void
@@ -2142,7 +1991,7 @@ target_info (char *args, int from_tty)
for (t = target_stack; t != NULL; t = t->beneath)
{
- if (!(*t->to_has_memory) (t))
+ if (!t->has_memory ())
continue;
if ((int) (t->to_stratum) <= (int) dummy_stratum)
@@ -2150,9 +1999,9 @@ target_info (char *args, int from_tty)
if (has_all_mem)
printf_unfiltered (_("\tWhile running this, "
"GDB does not access memory from...\n"));
- printf_unfiltered ("%s:\n", t->to_longname);
- (t->to_files_info) (t);
- has_all_mem = (*t->to_has_all_memory) (t);
+ printf_unfiltered ("%s:\n", t->longname ());
+ t->files_info ();
+ has_all_mem = t->has_all_memory ();
}
}
@@ -2269,7 +2118,7 @@ target_detach (const char *args, int from_tty)
prepare_for_detach ();
- current_target.to_detach (&current_target, args, from_tty);
+ target_stack->detach (args, from_tty);
}
void
@@ -2280,13 +2129,13 @@ target_disconnect (const char *args, int from_tty)
disconnecting. */
remove_breakpoints ();
- current_target.to_disconnect (&current_target, args, from_tty);
+ target_stack->disconnect (args, from_tty);
}
ptid_t
target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
{
- return (current_target.to_wait) (&current_target, ptid, status, options);
+ return target_stack->wait (ptid, status, options);
}
/* See target.h. */
@@ -2303,13 +2152,13 @@ default_target_wait (struct target_ops *ops,
char *
target_pid_to_str (ptid_t ptid)
{
- return (*current_target.to_pid_to_str) (&current_target, ptid);
+ return target_stack->pid_to_str (ptid);
}
const char *
target_thread_name (struct thread_info *info)
{
- return current_target.to_thread_name (&current_target, info);
+ return target_stack->thread_name (info);
}
void
@@ -2317,7 +2166,7 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
{
target_dcache_invalidate ();
- current_target.to_resume (&current_target, ptid, step, signal);
+ target_stack->resume (ptid, step, signal);
registers_changed_ptid (ptid);
/* We only set the internal executing state here. The user/frontend
@@ -2329,14 +2178,13 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
void
target_pass_signals (int numsigs, unsigned char *pass_signals)
{
- (*current_target.to_pass_signals) (&current_target, numsigs, pass_signals);
+ target_stack->pass_signals (numsigs, pass_signals);
}
void
target_program_signals (int numsigs, unsigned char *program_signals)
{
- (*current_target.to_program_signals) (&current_target,
- numsigs, program_signals);
+ target_stack->program_signals (numsigs, program_signals);
}
static int
@@ -2354,8 +2202,7 @@ default_follow_fork (struct target_ops *self, int follow_child,
int
target_follow_fork (int follow_child, int detach_fork)
{
- return current_target.to_follow_fork (&current_target,
- follow_child, detach_fork);
+ return target_stack->follow_fork (follow_child, detach_fork);
}
/* Target wrapper for follow exec hook. */
@@ -2363,7 +2210,7 @@ target_follow_fork (int follow_child, int detach_fork)
void
target_follow_exec (struct inferior *inf, char *execd_pathname)
{
- current_target.to_follow_exec (&current_target, inf, execd_pathname);
+ target_stack->follow_exec (inf, execd_pathname);
}
static void
@@ -2376,7 +2223,7 @@ default_mourn_inferior (struct target_ops *self)
void
target_mourn_inferior (void)
{
- current_target.to_mourn_inferior (&current_target);
+ target_stack->mourn_inferior ();
/* We no longer need to keep handles on any of the object files.
Make sure to release them to avoid unnecessarily locking any
@@ -2390,7 +2237,7 @@ target_mourn_inferior (void)
const struct target_desc *
target_read_description (struct target_ops *target)
{
- return target->to_read_description (target);
+ return target->read_description ();
}
/* This implements a basic search of memory, reading target memory and
@@ -2509,7 +2356,7 @@ default_search_memory (struct target_ops *self,
CORE_ADDR *found_addrp)
{
/* Start over from the top of the target stack. */
- return simple_search_memory (current_target.beneath,
+ return simple_search_memory (target_stack,
start_addr, search_space_len,
pattern, pattern_len, found_addrp);
}
@@ -2526,9 +2373,8 @@ target_search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
const gdb_byte *pattern, ULONGEST pattern_len,
CORE_ADDR *found_addrp)
{
- return current_target.to_search_memory (&current_target, start_addr,
- search_space_len,
- pattern, pattern_len, found_addrp);
+ return target_stack->search_memory (start_addr, search_space_len,
+ pattern, pattern_len, found_addrp);
}
/* Look through the currently pushed targets. If none of them will
@@ -2546,20 +2392,18 @@ target_require_runnable (void)
assume we will still be able to after killing the current
one. Either killing and mourning will not pop T, or else
find_default_run_target will find it again. */
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
return;
/* Do not worry about targets at certain strata that can not
create inferiors. Assume they will be pushed again if
necessary, and continue to the process_stratum. */
- if (t->to_stratum == thread_stratum
- || t->to_stratum == record_stratum
- || t->to_stratum == arch_stratum)
+ if (t->to_stratum > process_stratum)
continue;
error (_("The \"%s\" target does not support \"run\". "
"Try \"help target\" or \"continue\"."),
- t->to_shortname);
+ t->shortname ());
}
/* This function is only called if the target is running. In that
@@ -2590,7 +2434,7 @@ show_auto_connect_native_target (struct ui_file *file, int from_tty,
called for errors); else, return NULL on error. */
static struct target_ops *
-find_default_run_target (char *do_mesg)
+find_default_run_target (const char *do_mesg)
{
struct target_ops *runable = NULL;
@@ -2602,7 +2446,7 @@ find_default_run_target (char *do_mesg)
for (i = 0; VEC_iterate (target_ops_p, target_structs, i, t); ++i)
{
- if (t->to_can_run != delegate_can_run && target_can_run (t))
+ if (t->can_run ())
{
runable = t;
++count;
@@ -2632,9 +2476,9 @@ find_attach_target (void)
struct target_ops *t;
/* If a target on the current stack can attach, use it. */
- for (t = current_target.beneath; t != NULL; t = t->beneath)
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_attach != NULL)
+ if (t->can_attach ())
break;
}
@@ -2652,10 +2496,10 @@ find_run_target (void)
{
struct target_ops *t;
- /* If a target on the current stack can attach, use it. */
- for (t = current_target.beneath; t != NULL; t = t->beneath)
+ /* If a target on the current stack can run, use it. */
+ for (t = target_stack; t != NULL; t = t->beneath)
{
- if (t->to_create_inferior != NULL)
+ if (t->can_create_inferior ())
break;
}
@@ -2666,6 +2510,12 @@ find_run_target (void)
return t;
}
+int
+target_ops::info_proc (const char *args, enum info_proc_what what)
+{
+ return 0;
+}
+
/* Implement the "info proc" command. */
int
@@ -2676,23 +2526,19 @@ target_info_proc (const char *args, enum info_proc_what what)
/* If we're already connected to something that can get us OS
related data, use it. Otherwise, try using the native
target. */
- if (current_target.to_stratum >= process_stratum)
- t = current_target.beneath;
- else
+ t = find_target_at (process_stratum);
+ if (t == NULL)
t = find_default_run_target (NULL);
for (; t != NULL; t = t->beneath)
{
- if (t->to_info_proc != NULL)
- {
- t->to_info_proc (t, args, what);
+ int res = t->info_proc (args, what);
- if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_info_proc (\"%s\", %d)\n", args, what);
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog,
+ "target_info_proc (\"%s\", %d)\n", args, what);
- return 1;
- }
+ return res;
}
return 0;
@@ -2704,21 +2550,15 @@ find_default_supports_disable_randomization (struct target_ops *self)
struct target_ops *t;
t = find_default_run_target (NULL);
- if (t && t->to_supports_disable_randomization)
- return (t->to_supports_disable_randomization) (t);
+ if (t != NULL)
+ return t->supports_disable_randomization ();
return 0;
}
int
target_supports_disable_randomization (void)
{
- struct target_ops *t;
-
- for (t = &current_target; t != NULL; t = t->beneath)
- if (t->to_supports_disable_randomization)
- return t->to_supports_disable_randomization (t);
-
- return 0;
+ return target_stack->supports_disable_randomization ();
}
char *
@@ -2729,9 +2569,8 @@ target_get_osdata (const char *type)
/* If we're already connected to something that can get us OS
related data, use it. Otherwise, try using the native
target. */
- if (current_target.to_stratum >= process_stratum)
- t = current_target.beneath;
- else
+ t = find_target_at (process_stratum);
+ if (t == NULL)
t = find_default_run_target ("get OS data");
if (!t)
@@ -2764,24 +2603,80 @@ target_thread_address_space (ptid_t ptid)
{
struct address_space *aspace;
- aspace = current_target.to_thread_address_space (&current_target, ptid);
+ aspace = target_stack->thread_address_space (ptid);
gdb_assert (aspace != NULL);
return aspace;
}
+void
+target_ops::open (const char *, int)
+{
+ gdb_assert (0);;
+};
+
+void
+target_ops::close ()
+{
+};
+
+bool
+target_ops::can_attach ()
+{
+ return 0;
+}
+
+void
+target_ops::attach (const char *, int)
+{
+ gdb_assert (0);;
+}
+
+bool
+target_ops::can_create_inferior ()
+{
+ return 0;
+}
+
+void
+target_ops::create_inferior (char *, char *, char **, int)
+{
+ gdb_assert (0);;
+}
+
+int
+target_ops::can_run ()
+{
+ return 0;
+}
+
+int
+target_can_run ()
+{
+ struct target_ops *t;
+
+ for (t = target_stack; t != NULL; t = t->beneath)
+ {
+ if (t->can_run ())
+ return 1;
+ }
+
+ return 0;
+}
/* Target file operations. */
static struct target_ops *
default_fileio_target (void)
{
+ struct target_ops *t;
+
/* If we're already connected to something that can perform
file I/O, use it. Otherwise, try using the native target. */
- if (current_target.to_stratum >= process_stratum)
- return current_target.beneath;
- else
- return find_default_run_target ("file I/O");
+ t = find_target_at (process_stratum);
+ if (t != NULL)
+ return t;
+ return find_default_run_target ("file I/O");
}
/* File handle for target file operations. */
@@ -2856,6 +2751,67 @@ release_fileio_fd (int fd, fileio_fh_t *fh)
#define fileio_fd_to_fh(fd) \
VEC_index (fileio_fh_t, fileio_fhandles, (fd))
+
+/* Default implementations of file i/o methods. We don't want these
+ to delegate automatically, because we need to know which target
+ supported the method, in order to call it directly from within
+ pread/pwrite, etc. */
+
+int
+target_ops::fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+int
+target_ops::fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, int *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+int
+target_ops::fileio_pread (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+int
+target_ops::fileio_fstat (int fd, struct stat *sb, int *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+int
+target_ops::fileio_close (int fd, int *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+int
+target_ops::fileio_unlink (struct inferior *inf, const char *filename,
+ int *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return -1;
+}
+
+char *
+target_ops::fileio_readlink (struct inferior *inf, const char *filename,
+ int *target_errno)
+{
+ *target_errno = FILEIO_ENOSYS;
+ return NULL;
+}
+
/* Helper for target_fileio_open and
target_fileio_open_warn_if_slow. */
@@ -2868,26 +2824,26 @@ target_fileio_open_1 (struct inferior *inf, const char *filename,
for (t = default_fileio_target (); t != NULL; t = t->beneath)
{
- if (t->to_fileio_open != NULL)
- {
- int fd = t->to_fileio_open (t, inf, filename, flags, mode,
- warn_if_slow, target_errno);
+ int fd = t->fileio_open (inf, filename, flags, mode,
+ warn_if_slow, target_errno);
- if (fd < 0)
- fd = -1;
- else
- fd = acquire_fileio_fd (t, fd);
+ if (fd == -1 && *target_errno == FILEIO_ENOSYS)
+ continue;
- if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
+ if (fd < 0)
+ fd = -1;
+ else
+ fd = acquire_fileio_fd (t, fd);
+
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog,
"target_fileio_open (%d,%s,0x%x,0%o,%d)"
" = %d (%d)\n",
inf == NULL ? 0 : inf->num,
filename, flags, mode,
warn_if_slow, fd,
fd != -1 ? 0 : *target_errno);
- return fd;
- }
+ return fd;
}
*target_errno = FILEIO_ENOSYS;
@@ -2927,8 +2883,8 @@ target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
if (is_closed_fileio_fh (fh->fd))
*target_errno = EBADF;
else
- ret = fh->t->to_fileio_pwrite (fh->t, fh->fd, write_buf,
- len, offset, target_errno);
+ ret = fh->t->fileio_pwrite (fh->fd, write_buf,
+ len, offset, target_errno);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog,
@@ -2951,8 +2907,8 @@ target_fileio_pread (int fd, gdb_byte *read_buf, int len,
if (is_closed_fileio_fh (fh->fd))
*target_errno = EBADF;
else
- ret = fh->t->to_fileio_pread (fh->t, fh->fd, read_buf,
- len, offset, target_errno);
+ ret = fh->t->fileio_pread (fh->fd, read_buf,
+ len, offset, target_errno);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog,
@@ -2974,7 +2930,7 @@ target_fileio_fstat (int fd, struct stat *sb, int *target_errno)
if (is_closed_fileio_fh (fh->fd))
*target_errno = EBADF;
else
- ret = fh->t->to_fileio_fstat (fh->t, fh->fd, sb, target_errno);
+ ret = fh->t->fileio_fstat (fh->fd, sb, target_errno);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog,
@@ -2995,7 +2951,7 @@ target_fileio_close (int fd, int *target_errno)
*target_errno = EBADF;
else
{
- ret = fh->t->to_fileio_close (fh->t, fh->fd, target_errno);
+ ret = fh->t->fileio_close (fh->fd, target_errno);
release_fileio_fd (fd, fh);
}
@@ -3016,19 +2972,18 @@ target_fileio_unlink (struct inferior *inf, const char *filename,
for (t = default_fileio_target (); t != NULL; t = t->beneath)
{
- if (t->to_fileio_unlink != NULL)
- {
- int ret = t->to_fileio_unlink (t, inf, filename,
- target_errno);
+ int ret = t->fileio_unlink (inf, filename, target_errno);
- if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_fileio_unlink (%d,%s)"
- " = %d (%d)\n",
- inf == NULL ? 0 : inf->num, filename,
- ret, ret != -1 ? 0 : *target_errno);
- return ret;
- }
+ if (ret == -1 && *target_errno == FILEIO_ENOSYS)
+ continue;
+
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog,
+ "target_fileio_unlink (%d,%s)"
+ " = %d (%d)\n",
+ inf == NULL ? 0 : inf->num, filename,
+ ret, ret != -1 ? 0 : *target_errno);
+ return ret;
}
*target_errno = FILEIO_ENOSYS;
@@ -3045,20 +3000,19 @@ target_fileio_readlink (struct inferior *inf, const char *filename,
for (t = default_fileio_target (); t != NULL; t = t->beneath)
{
- if (t->to_fileio_readlink != NULL)
- {
- char *ret = t->to_fileio_readlink (t, inf, filename,
- target_errno);
+ char *ret = t->fileio_readlink (inf, filename, target_errno);
- if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_fileio_readlink (%d,%s)"
- " = %s (%d)\n",
- inf == NULL ? 0 : inf->num,
- filename, ret? ret : "(nil)",
- ret? 0 : *target_errno);
- return ret;
- }
+ if (ret == NULL && *target_errno == FILEIO_ENOSYS)
+ continue;
+
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog,
+ "target_fileio_readlink (%d,%s)"
+ " = %s (%d)\n",
+ inf == NULL ? 0 : inf->num,
+ filename, ret? ret : "(nil)",
+ ret? 0 : *target_errno);
+ return ret;
}
*target_errno = FILEIO_ENOSYS;
@@ -3205,18 +3159,6 @@ default_thread_architecture (struct target_ops *ops, ptid_t ptid)
return target_gdbarch ();
}
-static int
-return_zero (struct target_ops *ignore)
-{
- return 0;
-}
-
-static int
-return_zero_has_execution (struct target_ops *ignore, ptid_t ignore2)
-{
- return 0;
-}
-
/*
* Find the next target down the stack from the specified target.
*/
@@ -3234,7 +3176,7 @@ find_target_at (enum strata stratum)
{
struct target_ops *t;
- for (t = current_target.beneath; t != NULL; t = t->beneath)
+ for (t = target_stack; t != NULL; t = t->beneath)
if (t->to_stratum == stratum)
return t;
@@ -3335,27 +3277,55 @@ dummy_make_corefile_notes (struct target_ops *self,
return NULL;
}
-/* Set up the handful of non-empty slots needed by the dummy target
- vector. */
+#include "target-delegates.c"
-static void
-init_dummy_target (void)
-{
- dummy_target.to_shortname = "None";
- dummy_target.to_longname = "None";
- dummy_target.to_doc = "";
- dummy_target.to_supports_disable_randomization
- = find_default_supports_disable_randomization;
- dummy_target.to_stratum = dummy_stratum;
- dummy_target.to_has_all_memory = return_zero;
- dummy_target.to_has_memory = return_zero;
- dummy_target.to_has_stack = return_zero;
- dummy_target.to_has_registers = return_zero;
- dummy_target.to_has_execution = return_zero_has_execution;
- dummy_target.to_magic = OPS_MAGIC;
-
- install_dummy_methods (&dummy_target);
+
+dummy_target::dummy_target ()
+{
+ to_stratum = dummy_stratum;
+}
+
+const char *
+dummy_target::shortname ()
+{
+ return "None";
+}
+
+const char *
+dummy_target::longname ()
+{
+ return _("None");
+}
+
+const char *
+dummy_target::doc ()
+{
+ return "";
+}
+
+debug_target::debug_target ()
+{
+ to_stratum = debug_stratum;
+}
+
+const char *
+debug_target::shortname ()
+{
+ return beneath->shortname ();
+}
+
+const char *
+debug_target::longname ()
+{
+ return beneath->longname ();
+}
+
+const char *
+debug_target::doc ()
+{
+ return beneath->doc ();
}
+
void
@@ -3363,10 +3333,7 @@ target_close (struct target_ops *targ)
{
gdb_assert (!target_is_pushed (targ));
- if (targ->to_xclose != NULL)
- targ->to_xclose (targ);
- else if (targ->to_close != NULL)
- targ->to_close (targ);
+ targ->close ();
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_close ()\n");
@@ -3375,13 +3342,13 @@ target_close (struct target_ops *targ)
int
target_thread_alive (ptid_t ptid)
{
- return current_target.to_thread_alive (&current_target, ptid);
+ return target_stack->thread_alive (ptid);
}
void
target_update_thread_list (void)
{
- current_target.to_update_thread_list (&current_target);
+ target_stack->update_thread_list ();
}
void
@@ -3393,7 +3360,7 @@ target_stop (ptid_t ptid)
return;
}
- (*current_target.to_stop) (&current_target, ptid);
+ target_stack->stop (ptid);
}
void
@@ -3405,7 +3372,7 @@ target_interrupt (ptid_t ptid)
return;
}
- (*current_target.to_interrupt) (&current_target, ptid);
+ target_stack->interrupt (ptid);
}
/* See target.h. */
@@ -3413,7 +3380,7 @@ target_interrupt (ptid_t ptid)
void
target_pass_ctrlc (void)
{
- (*current_target.to_pass_ctrlc) (&current_target);
+ target_stack->pass_ctrlc ();
}
/* See target.h. */
@@ -3537,7 +3504,7 @@ debug_print_register (const char * func,
void
target_fetch_registers (struct regcache *regcache, int regno)
{
- current_target.to_fetch_registers (&current_target, regcache, regno);
+ target_stack->fetch_registers (regcache, regno);
if (targetdebug)
debug_print_register ("target_fetch_registers", regcache, regno);
}
@@ -3548,7 +3515,7 @@ target_store_registers (struct regcache *regcache, int regno)
if (!may_write_registers)
error (_("Writing to registers is not allowed (regno %d)"), regno);
- current_target.to_store_registers (&current_target, regcache, regno);
+ target_stack->store_registers (regcache, regno);
if (targetdebug)
{
debug_print_register ("target_store_registers", regcache, regno);
@@ -3558,7 +3525,7 @@ target_store_registers (struct regcache *regcache, int regno)
int
target_core_of_thread (ptid_t ptid)
{
- return current_target.to_core_of_thread (&current_target, ptid);
+ return target_stack->core_of_thread (ptid);
}
int
@@ -3596,15 +3563,14 @@ default_verify_memory (struct target_ops *self,
const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
{
/* Start over from the top of the target stack. */
- return simple_verify_memory (current_target.beneath,
+ return simple_verify_memory (target_stack,
data, memaddr, size);
}
int
target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
{
- return current_target.to_verify_memory (&current_target,
- data, memaddr, size);
+ return target_stack->verify_memory (data, memaddr, size);
}
/* The documentation for this function is in its prototype declaration in
@@ -3614,8 +3580,7 @@ int
target_insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
enum target_hw_bp_type rw)
{
- return current_target.to_insert_mask_watchpoint (&current_target,
- addr, mask, rw);
+ return target_stack->insert_mask_watchpoint (addr, mask, rw);
}
/* The documentation for this function is in its prototype declaration in
@@ -3625,8 +3590,7 @@ int
target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
enum target_hw_bp_type rw)
{
- return current_target.to_remove_mask_watchpoint (&current_target,
- addr, mask, rw);
+ return target_stack->remove_mask_watchpoint (addr, mask, rw);
}
/* The documentation for this function is in its prototype declaration
@@ -3635,8 +3599,7 @@ target_remove_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
int
target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
{
- return current_target.to_masked_watch_num_registers (&current_target,
- addr, mask);
+ return target_stack->masked_watch_num_registers (addr, mask);
}
/* The documentation for this function is in its prototype declaration
@@ -3645,7 +3608,7 @@ target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
int
target_ranged_break_num_registers (void)
{
- return current_target.to_ranged_break_num_registers (&current_target);
+ return target_stack->ranged_break_num_registers ();
}
/* See target.h. */
@@ -3653,7 +3616,7 @@ target_ranged_break_num_registers (void)
int
target_supports_btrace (enum btrace_format format)
{
- return current_target.to_supports_btrace (&current_target, format);
+ return target_stack->supports_btrace (format);
}
/* See target.h. */
@@ -3661,7 +3624,7 @@ target_supports_btrace (enum btrace_format format)
struct btrace_target_info *
target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
{
- return current_target.to_enable_btrace (&current_target, ptid, conf);
+ return target_stack->enable_btrace (ptid, conf);
}
/* See target.h. */
@@ -3669,7 +3632,7 @@ target_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
void
target_disable_btrace (struct btrace_target_info *btinfo)
{
- current_target.to_disable_btrace (&current_target, btinfo);
+ target_stack->disable_btrace (btinfo);
}
/* See target.h. */
@@ -3677,7 +3640,7 @@ target_disable_btrace (struct btrace_target_info *btinfo)
void
target_teardown_btrace (struct btrace_target_info *btinfo)
{
- current_target.to_teardown_btrace (&current_target, btinfo);
+ target_stack->teardown_btrace (btinfo);
}
/* See target.h. */
@@ -3687,7 +3650,7 @@ target_read_btrace (struct btrace_data *btrace,
struct btrace_target_info *btinfo,
enum btrace_read_type type)
{
- return current_target.to_read_btrace (&current_target, btrace, btinfo, type);
+ return target_stack->read_btrace (btrace, btinfo, type);
}
/* See target.h. */
@@ -3695,7 +3658,7 @@ target_read_btrace (struct btrace_data *btrace,
const struct btrace_config *
target_btrace_conf (const struct btrace_target_info *btinfo)
{
- return current_target.to_btrace_conf (&current_target, btinfo);
+ return target_stack->btrace_conf (btinfo);
}
/* See target.h. */
@@ -3703,7 +3666,7 @@ target_btrace_conf (const struct btrace_target_info *btinfo)
void
target_stop_recording (void)
{
- current_target.to_stop_recording (&current_target);
+ target_stack->stop_recording ();
}
/* See target.h. */
@@ -3711,7 +3674,7 @@ target_stop_recording (void)
void
target_save_record (const char *filename)
{
- current_target.to_save_record (&current_target, filename);
+ target_stack->save_record (filename);
}
/* See target.h. */
@@ -3721,10 +3684,13 @@ target_supports_delete_record (void)
{
struct target_ops *t;
- for (t = current_target.beneath; t != NULL; t = t->beneath)
+ gdb_assert (0);
+#if 0
+ for (t = target_stack; t != NULL; t = t->beneath)
if (t->to_delete_record != delegate_delete_record
&& t->to_delete_record != tdefault_delete_record)
return 1;
+#endif
return 0;
}
@@ -3734,7 +3700,7 @@ target_supports_delete_record (void)
void
target_delete_record (void)
{
- current_target.to_delete_record (&current_target);
+ target_stack->delete_record ();
}
/* See target.h. */
@@ -3742,7 +3708,7 @@ target_delete_record (void)
int
target_record_is_replaying (ptid_t ptid)
{
- return current_target.to_record_is_replaying (&current_target, ptid);
+ return target_stack->record_is_replaying (ptid);
}
/* See target.h. */
@@ -3750,7 +3716,7 @@ target_record_is_replaying (ptid_t ptid)
int
target_record_will_replay (ptid_t ptid, int dir)
{
- return current_target.to_record_will_replay (&current_target, ptid, dir);
+ return target_stack->record_will_replay (ptid, dir);
}
/* See target.h. */
@@ -3758,7 +3724,7 @@ target_record_will_replay (ptid_t ptid, int dir)
void
target_record_stop_replaying (void)
{
- current_target.to_record_stop_replaying (&current_target);
+ target_stack->record_stop_replaying ();
}
/* See target.h. */
@@ -3766,7 +3732,7 @@ target_record_stop_replaying (void)
void
target_goto_record_begin (void)
{
- current_target.to_goto_record_begin (&current_target);
+ target_stack->goto_record_begin ();
}
/* See target.h. */
@@ -3774,7 +3740,7 @@ target_goto_record_begin (void)
void
target_goto_record_end (void)
{
- current_target.to_goto_record_end (&current_target);
+ target_stack->goto_record_end ();
}
/* See target.h. */
@@ -3782,7 +3748,7 @@ target_goto_record_end (void)
void
target_goto_record (ULONGEST insn)
{
- current_target.to_goto_record (&current_target, insn);
+ target_stack->goto_record (insn);
}
/* See target.h. */
@@ -3790,7 +3756,7 @@ target_goto_record (ULONGEST insn)
void
target_insn_history (int size, int flags)
{
- current_target.to_insn_history (&current_target, size, flags);
+ target_stack->insn_history (size, flags);
}
/* See target.h. */
@@ -3798,7 +3764,7 @@ target_insn_history (int size, int flags)
void
target_insn_history_from (ULONGEST from, int size, int flags)
{
- current_target.to_insn_history_from (&current_target, from, size, flags);
+ target_stack->insn_history_from (from, size, flags);
}
/* See target.h. */
@@ -3806,7 +3772,7 @@ target_insn_history_from (ULONGEST from, int size, int flags)
void
target_insn_history_range (ULONGEST begin, ULONGEST end, int flags)
{
- current_target.to_insn_history_range (&current_target, begin, end, flags);
+ target_stack->insn_history_range (begin, end, flags);
}
/* See target.h. */
@@ -3814,7 +3780,7 @@ target_insn_history_range (ULONGEST begin, ULONGEST end, int flags)
void
target_call_history (int size, int flags)
{
- current_target.to_call_history (&current_target, size, flags);
+ target_stack->call_history (size, flags);
}
/* See target.h. */
@@ -3822,7 +3788,7 @@ target_call_history (int size, int flags)
void
target_call_history_from (ULONGEST begin, int size, int flags)
{
- current_target.to_call_history_from (&current_target, begin, size, flags);
+ target_stack->call_history_from (begin, size, flags);
}
/* See target.h. */
@@ -3830,7 +3796,7 @@ target_call_history_from (ULONGEST begin, int size, int flags)
void
target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
{
- current_target.to_call_history_range (&current_target, begin, end, flags);
+ target_stack->call_history_range (begin, end, flags);
}
/* See target.h. */
@@ -3838,7 +3804,7 @@ target_call_history_range (ULONGEST begin, ULONGEST end, int flags)
const struct frame_unwind *
target_get_unwinder (void)
{
- return current_target.to_get_unwinder (&current_target);
+ return target_stack->get_unwinder ();
}
/* See target.h. */
@@ -3846,7 +3812,7 @@ target_get_unwinder (void)
const struct frame_unwind *
target_get_tailcall_unwinder (void)
{
- return current_target.to_get_tailcall_unwinder (&current_target);
+ return target_stack->get_tailcall_unwinder ();
}
/* See target.h. */
@@ -3854,7 +3820,7 @@ target_get_tailcall_unwinder (void)
void
target_prepare_to_generate_core (void)
{
- current_target.to_prepare_to_generate_core (&current_target);
+ target_stack->prepare_to_generate_core ();
}
/* See target.h. */
@@ -3862,16 +3828,9 @@ target_prepare_to_generate_core (void)
void
target_done_generating_core (void)
{
- current_target.to_done_generating_core (&current_target);
+ target_stack->done_generating_core ();
}
-static void
-setup_target_debug (void)
-{
- memcpy (&debug_target, &current_target, sizeof debug_target);
-
- init_debug_target (&current_target);
-}
static char targ_desc[] =
@@ -3904,7 +3863,9 @@ maintenance_print_target_stack (char *cmd, int from_tty)
for (t = target_stack; t != NULL; t = t->beneath)
{
- printf_filtered (" - %s (%s)\n", t->to_shortname, t->to_longname);
+ if (t->to_stratum == debug_stratum)
+ continue;
+ printf_filtered (" - %s (%s)\n", t->shortname (), t->longname ());
}
}
@@ -3914,7 +3875,7 @@ void
target_async (int enable)
{
infrun_async (enable);
- current_target.to_async (&current_target, enable);
+ target_stack->async (enable);
}
/* See target.h. */
@@ -3922,7 +3883,7 @@ target_async (int enable)
void
target_thread_events (int enable)
{
- current_target.to_thread_events (&current_target, enable);
+ target_stack->thread_events (enable);
}
/* Controls if targets can report that they can/are async. This is
@@ -3962,7 +3923,7 @@ maint_show_target_async_command (struct ui_file *file, int from_tty,
static int
target_always_non_stop_p (void)
{
- return current_target.to_always_non_stop_p (&current_target);
+ return target_stack->always_non_stop_p ();
}
/* See target.h. */
@@ -4076,8 +4037,10 @@ set_write_memory_permission (char *args, int from_tty,
void
initialize_targets (void)
{
- init_dummy_target ();
- push_target (&dummy_target);
+ the_dummy_target = new dummy_target ();
+ push_target (the_dummy_target);
+
+ the_debug_target = new debug_target ();
add_info ("target", target_info, targ_desc);
add_info ("files", target_info, targ_desc);
diff --git a/gdb/target.h b/gdb/target.h
index 9506e04ec9b..b5eaf4bd0a5 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -83,7 +83,8 @@ enum strata
process_stratum, /* Executing processes or core dump files */
thread_stratum, /* Executing threads */
record_stratum, /* Support record debugging */
- arch_stratum /* Architecture overrides */
+ arch_stratum, /* Architecture overrides */
+ debug_stratum /* Target debug. Must be last. */
};
enum thread_control_capabilities
@@ -424,63 +425,67 @@ typedef void async_callback_ftype (enum inferior_event_type event_type,
struct target_ops
{
+ public:
struct target_ops *beneath; /* To the target under this one. */
- const char *to_shortname; /* Name this target type */
- const char *to_longname; /* Name for printing */
- const char *to_doc; /* Documentation. Does not include trailing
- newline, and starts with a one-line descrip-
- tion (probably similar to to_longname). */
- /* Per-target scratch pad. */
- void *to_data;
+
+ virtual ~target_ops () {}
+
+ /* Name this target type. */
+ virtual const char *shortname () = 0;
+
+ /* Name for printing. */
+ virtual const char *longname () = 0;
+
+ /* Documentation. Does not include trailing newline, and starts
+ ith a one-line description (probably similar to longname). */
+ virtual const char *doc () = 0;
+
/* The open routine takes the rest of the parameters from the
command, and (if successful) pushes a new target onto the
stack. Targets should supply this routine, if only to provide
an error message. */
- void (*to_open) (const char *, int);
- /* Old targets with a static target vector provide "to_close".
- New re-entrant targets provide "to_xclose" and that is expected
- to xfree everything (including the "struct target_ops"). */
- void (*to_xclose) (struct target_ops *targ);
- void (*to_close) (struct target_ops *);
+ virtual void open (const char *, int);
+ virtual void close ();
+
/* Attaches to a process on the target side. Arguments are as
passed to the `attach' command by the user. This routine can
be called when the target is not on the target-stack, if the
- target_can_run routine returns 1; in that case, it must push
+ target_ops::can_run method returns 1; in that case, it must push
itself onto the stack. Upon exit, the target should be ready
for normal operations, and should be ready to deliver the
status of the process immediately (without waiting) to an
upcoming target_wait call. */
- void (*to_attach) (struct target_ops *ops, const char *, int);
- void (*to_post_attach) (struct target_ops *, int)
+ virtual bool can_attach ();
+ virtual void attach (const char *, int);
+ virtual void post_attach (int)
TARGET_DEFAULT_IGNORE ();
- void (*to_detach) (struct target_ops *ops, const char *, int)
+ virtual void detach (const char *, int)
TARGET_DEFAULT_IGNORE ();
- void (*to_disconnect) (struct target_ops *, const char *, int)
+ virtual void disconnect (const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
- void (*to_resume) (struct target_ops *, ptid_t,
- int TARGET_DEBUG_PRINTER (target_debug_print_step),
- enum gdb_signal)
+ virtual void resume (ptid_t,
+ int TARGET_DEBUG_PRINTER (target_debug_print_step),
+ enum gdb_signal)
TARGET_DEFAULT_NORETURN (noprocess ());
- ptid_t (*to_wait) (struct target_ops *,
- ptid_t, struct target_waitstatus *,
- int TARGET_DEBUG_PRINTER (target_debug_print_options))
+ virtual ptid_t wait (ptid_t, struct target_waitstatus *,
+ int TARGET_DEBUG_PRINTER (target_debug_print_options))
TARGET_DEFAULT_FUNC (default_target_wait);
- void (*to_fetch_registers) (struct target_ops *, struct regcache *, int)
+ virtual void fetch_registers (struct regcache *, int)
TARGET_DEFAULT_IGNORE ();
- void (*to_store_registers) (struct target_ops *, struct regcache *, int)
+ virtual void store_registers (struct regcache *, int)
TARGET_DEFAULT_NORETURN (noprocess ());
- void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
+ virtual void prepare_to_store (struct regcache *)
TARGET_DEFAULT_NORETURN (noprocess ());
- void (*to_files_info) (struct target_ops *)
+ virtual void files_info ()
TARGET_DEFAULT_IGNORE ();
- int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *,
+ virtual int insert_breakpoint (struct gdbarch *,
struct bp_target_info *)
- TARGET_DEFAULT_FUNC (memory_insert_breakpoint);
- int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
+ TARGET_DEFAULT_NORETURN (noprocess ());
+ virtual int remove_breakpoint (struct gdbarch *,
struct bp_target_info *,
enum remove_bp_reason)
- TARGET_DEFAULT_FUNC (memory_remove_breakpoint);
+ TARGET_DEFAULT_NORETURN (noprocess ());
/* Returns true if the target stopped because it executed a
software breakpoint. This is necessary for correct background
@@ -491,10 +496,10 @@ struct target_ops
done from the target, so GDB needs to be able to tell whether
it should ignore the event and whether it should adjust the PC.
See adjust_pc_after_break. */
- int (*to_stopped_by_sw_breakpoint) (struct target_ops *)
+ virtual int stopped_by_sw_breakpoint ()
TARGET_DEFAULT_RETURN (0);
/* Returns true if the above method is supported. */
- int (*to_supports_stopped_by_sw_breakpoint) (struct target_ops *)
+ virtual int supports_stopped_by_sw_breakpoint ()
TARGET_DEFAULT_RETURN (0);
/* Returns true if the target stopped for a hardware breakpoint.
@@ -504,197 +509,203 @@ struct target_ops
require PC adjustment, GDB needs to be able to tell whether the
hardware breakpoint event is a delayed event for a breakpoint
that is already gone and should thus be ignored. */
- int (*to_stopped_by_hw_breakpoint) (struct target_ops *)
+ virtual int stopped_by_hw_breakpoint ()
TARGET_DEFAULT_RETURN (0);
/* Returns true if the above method is supported. */
- int (*to_supports_stopped_by_hw_breakpoint) (struct target_ops *)
+ virtual int supports_stopped_by_hw_breakpoint ()
TARGET_DEFAULT_RETURN (0);
- int (*to_can_use_hw_breakpoint) (struct target_ops *,
- enum bptype, int, int)
+ virtual int can_use_hw_breakpoint (enum bptype, int, int)
TARGET_DEFAULT_RETURN (0);
- int (*to_ranged_break_num_registers) (struct target_ops *)
+ virtual int ranged_break_num_registers ()
TARGET_DEFAULT_RETURN (-1);
- int (*to_insert_hw_breakpoint) (struct target_ops *,
- struct gdbarch *, struct bp_target_info *)
+ virtual int insert_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *)
TARGET_DEFAULT_RETURN (-1);
- int (*to_remove_hw_breakpoint) (struct target_ops *,
- struct gdbarch *, struct bp_target_info *)
+ virtual int remove_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *)
TARGET_DEFAULT_RETURN (-1);
/* Documentation of what the two routines below are expected to do is
provided with the corresponding target_* macros. */
- int (*to_remove_watchpoint) (struct target_ops *, CORE_ADDR, int,
+ virtual int remove_watchpoint (CORE_ADDR, int,
enum target_hw_bp_type, struct expression *)
TARGET_DEFAULT_RETURN (-1);
- int (*to_insert_watchpoint) (struct target_ops *, CORE_ADDR, int,
+ virtual int insert_watchpoint (CORE_ADDR, int,
enum target_hw_bp_type, struct expression *)
TARGET_DEFAULT_RETURN (-1);
- int (*to_insert_mask_watchpoint) (struct target_ops *,
+ virtual int insert_mask_watchpoint (
CORE_ADDR, CORE_ADDR,
enum target_hw_bp_type)
TARGET_DEFAULT_RETURN (1);
- int (*to_remove_mask_watchpoint) (struct target_ops *,
+ virtual int remove_mask_watchpoint (
CORE_ADDR, CORE_ADDR,
enum target_hw_bp_type)
TARGET_DEFAULT_RETURN (1);
- int (*to_stopped_by_watchpoint) (struct target_ops *)
+ virtual int stopped_by_watchpoint ()
TARGET_DEFAULT_RETURN (0);
- int to_have_steppable_watchpoint;
- int to_have_continuable_watchpoint;
- int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *)
+ virtual int have_steppable_watchpoint ()
TARGET_DEFAULT_RETURN (0);
- int (*to_watchpoint_addr_within_range) (struct target_ops *,
+ virtual bool have_continuable_watchpoint ()
+ TARGET_DEFAULT_RETURN (0);
+ virtual int stopped_data_address (CORE_ADDR *)
+ TARGET_DEFAULT_RETURN (0);
+ virtual int watchpoint_addr_within_range (
CORE_ADDR, CORE_ADDR, int)
TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
/* Documentation of this routine is provided with the corresponding
target_* macro. */
- int (*to_region_ok_for_hw_watchpoint) (struct target_ops *,
- CORE_ADDR, int)
+ virtual int region_ok_for_hw_watchpoint (CORE_ADDR, int)
TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
- int (*to_can_accel_watchpoint_condition) (struct target_ops *,
+ virtual int can_accel_watchpoint_condition (
CORE_ADDR, int, int,
struct expression *)
TARGET_DEFAULT_RETURN (0);
- int (*to_masked_watch_num_registers) (struct target_ops *,
+ virtual int masked_watch_num_registers (
CORE_ADDR, CORE_ADDR)
TARGET_DEFAULT_RETURN (-1);
/* Return 1 for sure target can do single step. Return -1 for
unknown. Return 0 for target can't do. */
- int (*to_can_do_single_step) (struct target_ops *)
+ virtual int can_do_single_step ()
TARGET_DEFAULT_RETURN (-1);
- void (*to_terminal_init) (struct target_ops *)
+ virtual bool supports_terminal_ours ()
+ TARGET_DEFAULT_RETURN (0);
+ virtual void terminal_init ()
TARGET_DEFAULT_IGNORE ();
- void (*to_terminal_inferior) (struct target_ops *)
+ virtual void terminal_inferior ()
TARGET_DEFAULT_IGNORE ();
- void (*to_terminal_ours_for_output) (struct target_ops *)
+ virtual void terminal_ours_for_output ()
TARGET_DEFAULT_IGNORE ();
- void (*to_terminal_ours) (struct target_ops *)
+ virtual void terminal_ours ()
TARGET_DEFAULT_IGNORE ();
- void (*to_terminal_info) (struct target_ops *, const char *, int)
+ virtual void terminal_info (const char *, int)
TARGET_DEFAULT_FUNC (default_terminal_info);
- void (*to_kill) (struct target_ops *)
+ virtual void kill ()
TARGET_DEFAULT_NORETURN (noprocess ());
- void (*to_load) (struct target_ops *, const char *, int)
+ virtual void load (const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Start an inferior process and set inferior_ptid to its pid.
EXEC_FILE is the file to run.
ALLARGS is a string containing the arguments to the program.
ENV is the environment vector to pass. Errors reported with error().
On VxWorks and various standalone systems, we ignore exec_file. */
- void (*to_create_inferior) (struct target_ops *,
- char *, char *, char **, int);
- void (*to_post_startup_inferior) (struct target_ops *, ptid_t)
+ virtual bool can_create_inferior ();
+ virtual void create_inferior (char *, char *, char **, int);
+ virtual void post_startup_inferior (ptid_t)
TARGET_DEFAULT_IGNORE ();
- int (*to_insert_fork_catchpoint) (struct target_ops *, int)
+ virtual int insert_fork_catchpoint (int)
TARGET_DEFAULT_RETURN (1);
- int (*to_remove_fork_catchpoint) (struct target_ops *, int)
+ virtual int remove_fork_catchpoint (int)
TARGET_DEFAULT_RETURN (1);
- int (*to_insert_vfork_catchpoint) (struct target_ops *, int)
+ virtual int insert_vfork_catchpoint (int)
TARGET_DEFAULT_RETURN (1);
- int (*to_remove_vfork_catchpoint) (struct target_ops *, int)
+ virtual int remove_vfork_catchpoint (int)
TARGET_DEFAULT_RETURN (1);
- int (*to_follow_fork) (struct target_ops *, int, int)
+ virtual int follow_fork (int, int)
TARGET_DEFAULT_FUNC (default_follow_fork);
- int (*to_insert_exec_catchpoint) (struct target_ops *, int)
+ virtual int insert_exec_catchpoint (int)
TARGET_DEFAULT_RETURN (1);
- int (*to_remove_exec_catchpoint) (struct target_ops *, int)
+ virtual int remove_exec_catchpoint (int)
TARGET_DEFAULT_RETURN (1);
- void (*to_follow_exec) (struct target_ops *, struct inferior *, char *)
+ virtual void follow_exec (struct inferior *, char *)
TARGET_DEFAULT_IGNORE ();
- int (*to_set_syscall_catchpoint) (struct target_ops *,
+ virtual int set_syscall_catchpoint (
int, int, int, int, int *)
TARGET_DEFAULT_RETURN (1);
- int (*to_has_exited) (struct target_ops *, int, int, int *)
+ virtual int has_exited (int, int, int *)
TARGET_DEFAULT_RETURN (0);
- void (*to_mourn_inferior) (struct target_ops *)
+ virtual void mourn_inferior ()
TARGET_DEFAULT_FUNC (default_mourn_inferior);
- /* Note that to_can_run is special and can be invoked on an
- unpushed target. Targets defining this method must also define
+
+ /* Note that can_run is special and can be invoked on an unpushed
+ target. Targets defining this method must also define
to_can_async_p and to_supports_non_stop. */
- int (*to_can_run) (struct target_ops *)
- TARGET_DEFAULT_RETURN (0);
+ virtual int can_run ();
/* Documentation of this routine is provided with the corresponding
target_* macro. */
- void (*to_pass_signals) (struct target_ops *, int,
- unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
+ virtual void pass_signals (int,
+ unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
TARGET_DEFAULT_IGNORE ();
/* Documentation of this routine is provided with the
corresponding target_* function. */
- void (*to_program_signals) (struct target_ops *, int,
- unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
+ virtual void program_signals (int,
+ unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
TARGET_DEFAULT_IGNORE ();
- int (*to_thread_alive) (struct target_ops *, ptid_t ptid)
+ virtual int thread_alive (ptid_t ptid)
TARGET_DEFAULT_RETURN (0);
- void (*to_update_thread_list) (struct target_ops *)
+ virtual void update_thread_list ()
TARGET_DEFAULT_IGNORE ();
- char *(*to_pid_to_str) (struct target_ops *, ptid_t)
+ virtual char *pid_to_str (ptid_t)
TARGET_DEFAULT_FUNC (default_pid_to_str);
- char *(*to_extra_thread_info) (struct target_ops *, struct thread_info *)
+ virtual char *extra_thread_info (struct thread_info *)
TARGET_DEFAULT_RETURN (NULL);
- const char *(*to_thread_name) (struct target_ops *, struct thread_info *)
+ virtual const char *thread_name (struct thread_info *)
TARGET_DEFAULT_RETURN (NULL);
- void (*to_stop) (struct target_ops *, ptid_t)
+ virtual void stop (ptid_t)
TARGET_DEFAULT_IGNORE ();
- void (*to_interrupt) (struct target_ops *, ptid_t)
+ virtual void interrupt (ptid_t)
TARGET_DEFAULT_IGNORE ();
- void (*to_pass_ctrlc) (struct target_ops *)
+ virtual void pass_ctrlc ()
TARGET_DEFAULT_FUNC (default_target_pass_ctrlc);
- void (*to_rcmd) (struct target_ops *,
- const char *command, struct ui_file *output)
+ virtual void rcmd (const char *command, struct ui_file *output)
TARGET_DEFAULT_FUNC (default_rcmd);
- char *(*to_pid_to_exec_file) (struct target_ops *, int pid)
+ virtual char *pid_to_exec_file (int pid)
TARGET_DEFAULT_RETURN (NULL);
- void (*to_log_command) (struct target_ops *, const char *)
+ virtual void log_command (const char *)
TARGET_DEFAULT_IGNORE ();
- struct target_section_table *(*to_get_section_table) (struct target_ops *)
+ virtual struct target_section_table *get_section_table ()
TARGET_DEFAULT_RETURN (NULL);
enum strata to_stratum;
- int (*to_has_all_memory) (struct target_ops *);
- int (*to_has_memory) (struct target_ops *);
- int (*to_has_stack) (struct target_ops *);
- int (*to_has_registers) (struct target_ops *);
- int (*to_has_execution) (struct target_ops *, ptid_t);
- int to_has_thread_control; /* control thread execution */
- int to_attach_no_wait;
+
+ /* Provide default values for all "must have" methods. */
+ virtual int has_all_memory () { return 0; }
+ virtual int has_memory () { return 0; }
+ virtual int has_stack () { return 0; }
+ virtual int has_registers () { return 0; }
+ virtual int has_execution (ptid_t) { return 0; }
+
+ /* Control thread execution. */
+ virtual thread_control_capabilities get_thread_control_capabilities ()
+ TARGET_DEFAULT_RETURN (tc_none);
+ virtual bool attach_no_wait ()
+ TARGET_DEFAULT_RETURN (0);
/* This method must be implemented in some situations. See the
- comment on 'to_can_run'. */
- int (*to_can_async_p) (struct target_ops *)
+ comment on 'can_run'. */
+ virtual int can_async_p ()
TARGET_DEFAULT_RETURN (0);
- int (*to_is_async_p) (struct target_ops *)
+ virtual int is_async_p ()
TARGET_DEFAULT_RETURN (0);
- void (*to_async) (struct target_ops *, int)
+ virtual void async (int)
TARGET_DEFAULT_NORETURN (tcomplain ());
- void (*to_thread_events) (struct target_ops *, int)
+ virtual void thread_events (int)
TARGET_DEFAULT_IGNORE ();
/* This method must be implemented in some situations. See the
- comment on 'to_can_run'. */
- int (*to_supports_non_stop) (struct target_ops *)
+ comment on 'can_run'. */
+ virtual int supports_non_stop ()
TARGET_DEFAULT_RETURN (0);
/* Return true if the target operates in non-stop mode even with
"set non-stop off". */
- int (*to_always_non_stop_p) (struct target_ops *)
+ virtual int always_non_stop_p ()
TARGET_DEFAULT_RETURN (0);
/* find_memory_regions support method for gcore */
- int (*to_find_memory_regions) (struct target_ops *,
- find_memory_region_ftype func, void *data)
+ virtual int find_memory_regions (find_memory_region_ftype func, void *data)
TARGET_DEFAULT_FUNC (dummy_find_memory_regions);
/* make_corefile_notes support method for gcore */
- char * (*to_make_corefile_notes) (struct target_ops *, bfd *, int *)
+ virtual char *make_corefile_notes (bfd *, int *)
TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
/* get_bookmark support method for bookmarks */
- gdb_byte * (*to_get_bookmark) (struct target_ops *, const char *, int)
+ virtual gdb_byte *get_bookmark (const char *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* goto_bookmark support method for bookmarks */
- void (*to_goto_bookmark) (struct target_ops *, const gdb_byte *, int)
+ virtual void goto_bookmark (const gdb_byte *, int)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Return the thread-local address at OFFSET in the
thread-local storage for the thread PTID and the shared library
@@ -702,10 +713,9 @@ struct target_ops
thread-local storage hasn't been allocated yet, this function
may return an error. LOAD_MODULE_ADDR may be zero for statically
linked multithreaded inferiors. */
- CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
- ptid_t ptid,
- CORE_ADDR load_module_addr,
- CORE_ADDR offset)
+ virtual CORE_ADDR get_thread_local_address (ptid_t ptid,
+ CORE_ADDR load_module_addr,
+ CORE_ADDR offset)
TARGET_DEFAULT_NORETURN (generic_tls_error ());
/* Request that OPS transfer up to LEN 8-bit bytes of the target's
@@ -737,19 +747,18 @@ struct target_ops
See target_read and target_write for more information. One,
and only one, of readbuf or writebuf must be non-NULL. */
- enum target_xfer_status (*to_xfer_partial) (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+ virtual enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
TARGET_DEFAULT_RETURN (TARGET_XFER_E_IO);
/* Return the limit on the size of any single memory transfer
for the target. */
- ULONGEST (*to_get_memory_xfer_limit) (struct target_ops *)
+ virtual ULONGEST get_memory_xfer_limit ()
TARGET_DEFAULT_RETURN (ULONGEST_MAX);
/* Returns the memory map for the target. A return value of NULL
@@ -765,7 +774,7 @@ struct target_ops
This method should not cache data; if the memory map could
change unexpectedly, it should be invalidated, and higher
layers will re-fetch it. */
- VEC(mem_region_s) *(*to_memory_map) (struct target_ops *)
+ virtual VEC(mem_region_s) *memory_map ()
TARGET_DEFAULT_RETURN (NULL);
/* Erases the region of flash memory starting at ADDRESS, of
@@ -773,38 +782,36 @@ struct target_ops
Precondition: both ADDRESS and ADDRESS+LENGTH should be aligned
on flash block boundaries, as reported by 'to_memory_map'. */
- void (*to_flash_erase) (struct target_ops *,
- ULONGEST address, LONGEST length)
+ virtual void flash_erase (ULONGEST address, LONGEST length)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Finishes a flash memory write sequence. After this operation
all flash memory should be available for writing and the result
of reading from areas written by 'to_flash_write' should be
equal to what was written. */
- void (*to_flash_done) (struct target_ops *)
+ virtual void flash_done ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Describe the architecture-specific features of this target. If
OPS doesn't have a description, this should delegate to the
"beneath" target. Returns the description found, or NULL if no
description was available. */
- const struct target_desc *(*to_read_description) (struct target_ops *ops)
+ virtual const struct target_desc *read_description ()
TARGET_DEFAULT_RETURN (NULL);
/* Build the PTID of the thread on which a given task is running,
based on LWP and THREAD. These values are extracted from the
task Private_Data section of the Ada Task Control Block, and
their interpretation depends on the target. */
- ptid_t (*to_get_ada_task_ptid) (struct target_ops *,
- long lwp, long thread)
+ virtual ptid_t get_ada_task_ptid (long lwp, long thread)
TARGET_DEFAULT_FUNC (default_get_ada_task_ptid);
/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
Return 0 if *READPTR is already at the end of the buffer.
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
- int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr,
- gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+ virtual int auxv_parse (gdb_byte **readptr,
+ gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
TARGET_DEFAULT_FUNC (default_auxv_parse);
/* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
@@ -813,47 +820,47 @@ struct target_ops
The result is 1 if found, 0 if not found, and -1 if there was an error
requiring halting of the search (e.g. memory read error).
If the pattern is found the address is recorded in FOUND_ADDRP. */
- int (*to_search_memory) (struct target_ops *ops,
- CORE_ADDR start_addr, ULONGEST search_space_len,
- const gdb_byte *pattern, ULONGEST pattern_len,
- CORE_ADDR *found_addrp)
+ virtual int search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp)
TARGET_DEFAULT_FUNC (default_search_memory);
/* Can target execute in reverse? */
- int (*to_can_execute_reverse) (struct target_ops *)
+ virtual int can_execute_reverse ()
TARGET_DEFAULT_RETURN (0);
/* The direction the target is currently executing. Must be
implemented on targets that support reverse execution and async
mode. The default simply returns forward execution. */
- enum exec_direction_kind (*to_execution_direction) (struct target_ops *)
+ virtual enum exec_direction_kind execution_direction ()
TARGET_DEFAULT_FUNC (default_execution_direction);
/* Does this target support debugging multiple processes
simultaneously? */
- int (*to_supports_multi_process) (struct target_ops *)
+ virtual int supports_multi_process ()
TARGET_DEFAULT_RETURN (0);
/* Does this target support enabling and disabling tracepoints while a trace
experiment is running? */
- int (*to_supports_enable_disable_tracepoint) (struct target_ops *)
+ virtual int supports_enable_disable_tracepoint ()
TARGET_DEFAULT_RETURN (0);
/* Does this target support disabling address space randomization? */
- int (*to_supports_disable_randomization) (struct target_ops *);
+ virtual int supports_disable_randomization ()
+ TARGET_DEFAULT_FUNC (find_default_supports_disable_randomization);
/* Does this target support the tracenz bytecode for string collection? */
- int (*to_supports_string_tracing) (struct target_ops *)
+ virtual int supports_string_tracing ()
TARGET_DEFAULT_RETURN (0);
/* Does this target support evaluation of breakpoint conditions on its
end? */
- int (*to_supports_evaluation_of_breakpoint_conditions) (struct target_ops *)
+ virtual int supports_evaluation_of_breakpoint_conditions ()
TARGET_DEFAULT_RETURN (0);
/* Does this target support evaluation of breakpoint commands on its
end? */
- int (*to_can_run_breakpoint_commands) (struct target_ops *)
+ virtual int can_run_breakpoint_commands ()
TARGET_DEFAULT_RETURN (0);
/* Determine current architecture of thread PTID.
@@ -866,22 +873,21 @@ struct target_ops
ptrace operations need to operate according to target_gdbarch ().
The default implementation always returns target_gdbarch (). */
- struct gdbarch *(*to_thread_architecture) (struct target_ops *, ptid_t)
+ virtual struct gdbarch *thread_architecture (ptid_t)
TARGET_DEFAULT_FUNC (default_thread_architecture);
/* Determine current address space of thread PTID.
The default implementation always returns the inferior's
address space. */
- struct address_space *(*to_thread_address_space) (struct target_ops *,
- ptid_t)
+ virtual struct address_space *thread_address_space (ptid_t)
TARGET_DEFAULT_FUNC (default_thread_address_space);
/* Target file operations. */
/* Return nonzero if the filesystem seen by the current inferior
is the local filesystem, zero otherwise. */
- int (*to_filesystem_is_local) (struct target_ops *)
+ virtual int filesystem_is_local ()
TARGET_DEFAULT_RETURN (1);
/* Open FILENAME on the target, in the filesystem as seen by INF,
@@ -891,111 +897,98 @@ struct target_ops
is being accessed over a link that may be slow. Return a
target file descriptor, or -1 if an error occurs (and set
*TARGET_ERRNO). */
- int (*to_fileio_open) (struct target_ops *,
- struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
- int *target_errno);
+ virtual int fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ int *target_errno);
/* Write up to LEN bytes from WRITE_BUF to FD on the target.
Return the number of bytes written, or -1 if an error occurs
(and set *TARGET_ERRNO). */
- int (*to_fileio_pwrite) (struct target_ops *,
- int fd, const gdb_byte *write_buf, int len,
- ULONGEST offset, int *target_errno);
+ virtual int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, int *target_errno);
/* Read up to LEN bytes FD on the target into READ_BUF.
Return the number of bytes read, or -1 if an error occurs
(and set *TARGET_ERRNO). */
- int (*to_fileio_pread) (struct target_ops *,
- int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, int *target_errno);
+ virtual int fileio_pread (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, int *target_errno);
/* Get information about the file opened as FD and put it in
SB. Return 0 on success, or -1 if an error occurs (and set
*TARGET_ERRNO). */
- int (*to_fileio_fstat) (struct target_ops *,
- int fd, struct stat *sb, int *target_errno);
+ virtual int fileio_fstat (int fd, struct stat *sb, int *target_errno);
/* Close FD on the target. Return 0, or -1 if an error occurs
(and set *TARGET_ERRNO). */
- int (*to_fileio_close) (struct target_ops *, int fd, int *target_errno);
+ virtual int fileio_close (int fd, int *target_errno);
/* Unlink FILENAME on the target, in the filesystem as seen by
INF. If INF is NULL, use the filesystem seen by the debugger
(GDB or, for remote targets, the remote stub). Return 0, or
-1 if an error occurs (and set *TARGET_ERRNO). */
- int (*to_fileio_unlink) (struct target_ops *,
- struct inferior *inf,
- const char *filename,
- int *target_errno);
+ virtual int fileio_unlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno);
/* Read value of symbolic link FILENAME on the target, in the
filesystem as seen by INF. If INF is NULL, use the filesystem
seen by the debugger (GDB or, for remote targets, the remote
stub). Return a null-terminated string allocated via xmalloc,
or NULL if an error occurs (and set *TARGET_ERRNO). */
- char *(*to_fileio_readlink) (struct target_ops *,
- struct inferior *inf,
- const char *filename,
- int *target_errno);
-
+ virtual char *fileio_readlink (struct inferior *inf,
+ const char *filename,
+ int *target_errno);
/* Implement the "info proc" command. */
- void (*to_info_proc) (struct target_ops *, const char *,
- enum info_proc_what);
+ virtual int info_proc (const char *, enum info_proc_what);
/* Tracepoint-related operations. */
/* Prepare the target for a tracing run. */
- void (*to_trace_init) (struct target_ops *)
+ virtual void trace_init ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Send full details of a tracepoint location to the target. */
- void (*to_download_tracepoint) (struct target_ops *,
- struct bp_location *location)
+ virtual void download_tracepoint (struct bp_location *location)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Is the target able to download tracepoint locations in current
state? */
- int (*to_can_download_tracepoint) (struct target_ops *)
+ virtual int can_download_tracepoint ()
TARGET_DEFAULT_RETURN (0);
/* Send full details of a trace state variable to the target. */
- void (*to_download_trace_state_variable) (struct target_ops *,
- struct trace_state_variable *tsv)
+ virtual void download_trace_state_variable (struct trace_state_variable *tsv)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Enable a tracepoint on the target. */
- void (*to_enable_tracepoint) (struct target_ops *,
- struct bp_location *location)
+ virtual void enable_tracepoint (struct bp_location *location)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disable a tracepoint on the target. */
- void (*to_disable_tracepoint) (struct target_ops *,
- struct bp_location *location)
+ virtual void disable_tracepoint (struct bp_location *location)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Inform the target info of memory regions that are readonly
(such as text sections), and so it should return data from
those rather than look in the trace buffer. */
- void (*to_trace_set_readonly_regions) (struct target_ops *)
+ virtual void trace_set_readonly_regions ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Start a trace run. */
- void (*to_trace_start) (struct target_ops *)
+ virtual void trace_start ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Get the current status of a tracing run. */
- int (*to_get_trace_status) (struct target_ops *, struct trace_status *ts)
+ virtual int get_trace_status (struct trace_status *ts)
TARGET_DEFAULT_RETURN (-1);
- void (*to_get_tracepoint_status) (struct target_ops *,
- struct breakpoint *tp,
- struct uploaded_tp *utp)
+ virtual void get_tracepoint_status (struct breakpoint *tp,
+ struct uploaded_tp *utp)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Stop a trace run. */
- void (*to_trace_stop) (struct target_ops *)
+ virtual void trace_stop ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Ask the target to find a trace frame of the given type TYPE,
@@ -1003,55 +996,50 @@ struct target_ops
number of the trace frame, and also the tracepoint number at
TPP. If no trace frame matches, return -1. May throw if the
operation fails. */
- int (*to_trace_find) (struct target_ops *,
- enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
+ virtual int trace_find (enum trace_find_type type, int num,
+ CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
TARGET_DEFAULT_RETURN (-1);
/* Get the value of the trace state variable number TSV, returning
1 if the value is known and writing the value itself into the
location pointed to by VAL, else returning 0. */
- int (*to_get_trace_state_variable_value) (struct target_ops *,
- int tsv, LONGEST *val)
+ virtual int get_trace_state_variable_value (int tsv, LONGEST *val)
TARGET_DEFAULT_RETURN (0);
- int (*to_save_trace_data) (struct target_ops *, const char *filename)
+ virtual int save_trace_data (const char *filename)
TARGET_DEFAULT_NORETURN (tcomplain ());
- int (*to_upload_tracepoints) (struct target_ops *,
- struct uploaded_tp **utpp)
+ virtual int upload_tracepoints (struct uploaded_tp **utpp)
TARGET_DEFAULT_RETURN (0);
- int (*to_upload_trace_state_variables) (struct target_ops *,
- struct uploaded_tsv **utsvp)
+ virtual int upload_trace_state_variables (struct uploaded_tsv **utsvp)
TARGET_DEFAULT_RETURN (0);
- LONGEST (*to_get_raw_trace_data) (struct target_ops *, gdb_byte *buf,
- ULONGEST offset, LONGEST len)
+ virtual LONGEST get_raw_trace_data (gdb_byte *buf,
+ ULONGEST offset, LONGEST len)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Get the minimum length of instruction on which a fast tracepoint
may be set on the target. If this operation is unsupported,
return -1. If for some reason the minimum length cannot be
determined, return 0. */
- int (*to_get_min_fast_tracepoint_insn_len) (struct target_ops *)
+ virtual int get_min_fast_tracepoint_insn_len ()
TARGET_DEFAULT_RETURN (-1);
/* Set the target's tracing behavior in response to unexpected
disconnection - set VAL to 1 to keep tracing, 0 to stop. */
- void (*to_set_disconnected_tracing) (struct target_ops *, int val)
+ virtual void set_disconnected_tracing (int val)
TARGET_DEFAULT_IGNORE ();
- void (*to_set_circular_trace_buffer) (struct target_ops *, int val)
+ virtual void set_circular_trace_buffer (int val)
TARGET_DEFAULT_IGNORE ();
/* Set the size of trace buffer in the target. */
- void (*to_set_trace_buffer_size) (struct target_ops *, LONGEST val)
+ virtual void set_trace_buffer_size (LONGEST val)
TARGET_DEFAULT_IGNORE ();
/* Add/change textual notes about the trace run, returning 1 if
successful, 0 otherwise. */
- int (*to_set_trace_notes) (struct target_ops *,
- const char *user, const char *notes,
- const char *stopnotes)
+ virtual int set_trace_notes (const char *user, const char *notes,
+ const char *stopnotes)
TARGET_DEFAULT_RETURN (0);
/* Return the processor core that thread PTID was last seen on.
@@ -1061,217 +1049,199 @@ struct target_ops
If the core cannot be determined -- either for the specified
thread, or right now, or in this debug session, or for this
target -- return -1. */
- int (*to_core_of_thread) (struct target_ops *, ptid_t ptid)
+ virtual int core_of_thread (ptid_t ptid)
TARGET_DEFAULT_RETURN (-1);
/* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range
matches the contents of [DATA,DATA+SIZE). Returns 1 if there's
a match, 0 if there's a mismatch, and -1 if an error is
encountered while reading memory. */
- int (*to_verify_memory) (struct target_ops *, const gdb_byte *data,
- CORE_ADDR memaddr, ULONGEST size)
+ virtual int verify_memory (const gdb_byte *data,
+ CORE_ADDR memaddr, ULONGEST size)
TARGET_DEFAULT_FUNC (default_verify_memory);
/* Return the address of the start of the Thread Information Block
a Windows OS specific feature. */
- int (*to_get_tib_address) (struct target_ops *,
- ptid_t ptid, CORE_ADDR *addr)
+ virtual int get_tib_address (ptid_t ptid, CORE_ADDR *addr)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Send the new settings of write permission variables. */
- void (*to_set_permissions) (struct target_ops *)
+ virtual void set_permissions ()
TARGET_DEFAULT_IGNORE ();
/* Look for a static tracepoint marker at ADDR, and fill in MARKER
with its details. Return 1 on success, 0 on failure. */
- int (*to_static_tracepoint_marker_at) (struct target_ops *, CORE_ADDR,
- struct static_tracepoint_marker *marker)
+ virtual int static_tracepoint_marker_at (CORE_ADDR,
+ struct static_tracepoint_marker *marker)
TARGET_DEFAULT_RETURN (0);
/* Return a vector of all tracepoints markers string id ID, or all
markers if ID is NULL. */
- VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid) (struct target_ops *, const char *id)
+ virtual VEC(static_tracepoint_marker_p) *static_tracepoint_markers_by_strid (const char *id)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Return a traceframe info object describing the current
traceframe's contents. This method should not cache data;
higher layers take care of caching, invalidating, and
re-fetching when necessary. */
- struct traceframe_info *(*to_traceframe_info) (struct target_ops *)
+ virtual struct traceframe_info *traceframe_info ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Ask the target to use or not to use agent according to USE. Return 1
successful, 0 otherwise. */
- int (*to_use_agent) (struct target_ops *, int use)
+ virtual int use_agent (int use)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Is the target able to use agent in current state? */
- int (*to_can_use_agent) (struct target_ops *)
+ virtual int can_use_agent ()
TARGET_DEFAULT_RETURN (0);
/* Check whether the target supports branch tracing. */
- int (*to_supports_btrace) (struct target_ops *, enum btrace_format)
+ virtual int supports_btrace (enum btrace_format)
TARGET_DEFAULT_RETURN (0);
/* Enable branch tracing for PTID using CONF configuration.
Return a branch trace target information struct for reading and for
disabling branch trace. */
- struct btrace_target_info *(*to_enable_btrace) (struct target_ops *,
- ptid_t ptid,
- const struct btrace_config *conf)
+ virtual struct btrace_target_info *enable_btrace (ptid_t ptid,
+ const struct btrace_config *conf)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disable branch tracing and deallocate TINFO. */
- void (*to_disable_btrace) (struct target_ops *,
- struct btrace_target_info *tinfo)
+ virtual void disable_btrace (struct btrace_target_info *tinfo)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disable branch tracing and deallocate TINFO. This function is similar
to to_disable_btrace, except that it is called during teardown and is
only allowed to perform actions that are safe. A counter-example would
be attempting to talk to a remote target. */
- void (*to_teardown_btrace) (struct target_ops *,
- struct btrace_target_info *tinfo)
+ virtual void teardown_btrace (struct btrace_target_info *tinfo)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Read branch trace data for the thread indicated by BTINFO into DATA.
DATA is cleared before new trace is added. */
- enum btrace_error (*to_read_btrace) (struct target_ops *self,
- struct btrace_data *data,
- struct btrace_target_info *btinfo,
- enum btrace_read_type type)
+ virtual enum btrace_error read_btrace (struct btrace_data *data,
+ struct btrace_target_info *btinfo,
+ enum btrace_read_type type)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Get the branch trace configuration. */
- const struct btrace_config *(*to_btrace_conf) (struct target_ops *self,
- const struct btrace_target_info *)
+ virtual const struct btrace_config *btrace_conf (const struct btrace_target_info *)
TARGET_DEFAULT_RETURN (NULL);
/* Stop trace recording. */
- void (*to_stop_recording) (struct target_ops *)
+ virtual void stop_recording ()
TARGET_DEFAULT_IGNORE ();
/* Print information about the recording. */
- void (*to_info_record) (struct target_ops *)
+ virtual void info_record ()
TARGET_DEFAULT_IGNORE ();
/* Save the recorded execution trace into a file. */
- void (*to_save_record) (struct target_ops *, const char *filename)
+ virtual void save_record (const char *filename)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Delete the recorded execution trace from the current position
onwards. */
- void (*to_delete_record) (struct target_ops *)
+ virtual void delete_record ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Query if the record target is currently replaying PTID. */
- int (*to_record_is_replaying) (struct target_ops *, ptid_t ptid)
+ virtual int record_is_replaying (ptid_t ptid)
TARGET_DEFAULT_RETURN (0);
/* Query if the record target will replay PTID if it were resumed in
execution direction DIR. */
- int (*to_record_will_replay) (struct target_ops *, ptid_t ptid, int dir)
+ virtual int record_will_replay (ptid_t ptid, int dir)
TARGET_DEFAULT_RETURN (0);
/* Stop replaying. */
- void (*to_record_stop_replaying) (struct target_ops *)
+ virtual void record_stop_replaying ()
TARGET_DEFAULT_IGNORE ();
/* Go to the begin of the execution trace. */
- void (*to_goto_record_begin) (struct target_ops *)
+ virtual void goto_record_begin ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Go to the end of the execution trace. */
- void (*to_goto_record_end) (struct target_ops *)
+ virtual void goto_record_end ()
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Go to a specific location in the recorded execution trace. */
- void (*to_goto_record) (struct target_ops *, ULONGEST insn)
+ virtual void goto_record (ULONGEST insn)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* 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) (struct target_ops *, int size, int flags)
+ virtual void insn_history (int size, int flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* 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) (struct target_ops *,
+ virtual void insn_history_from (
ULONGEST from, int size, int flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Disassemble a section of the recorded execution trace from instruction
BEGIN (inclusive) to instruction END (inclusive). */
- void (*to_insn_history_range) (struct target_ops *,
+ virtual void insn_history_range (
ULONGEST begin, ULONGEST end, int flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* 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) (struct target_ops *, int size, int flags)
+ virtual void call_history (int size, int flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* 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) (struct target_ops *,
- ULONGEST begin, int size, int flags)
+ virtual void call_history_from (ULONGEST begin, int size, int flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Print a function trace of an execution trace section from function BEGIN
(inclusive) to function END (inclusive). */
- void (*to_call_history_range) (struct target_ops *,
- ULONGEST begin, ULONGEST end, int flags)
+ virtual void call_history_range (ULONGEST begin, ULONGEST end, int flags)
TARGET_DEFAULT_NORETURN (tcomplain ());
/* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
non-empty annex. */
- int (*to_augmented_libraries_svr4_read) (struct target_ops *)
+ virtual int augmented_libraries_svr4_read ()
TARGET_DEFAULT_RETURN (0);
/* Those unwinders are tried before any other arch unwinders. If
SELF doesn't have unwinders, it should delegate to the
"beneath" target. */
- const struct frame_unwind *(*to_get_unwinder) (struct target_ops *self)
+ virtual const struct frame_unwind *get_unwinder ()
TARGET_DEFAULT_RETURN (NULL);
- const struct frame_unwind *(*to_get_tailcall_unwinder) (struct target_ops *self)
+ virtual const struct frame_unwind *get_tailcall_unwinder ()
TARGET_DEFAULT_RETURN (NULL);
/* Prepare to generate a core file. */
- void (*to_prepare_to_generate_core) (struct target_ops *)
+ virtual void prepare_to_generate_core ()
TARGET_DEFAULT_IGNORE ();
/* Cleanup after generating a core file. */
- void (*to_done_generating_core) (struct target_ops *)
+ virtual void done_generating_core ()
TARGET_DEFAULT_IGNORE ();
-
- int to_magic;
- /* Need sub-structure for target machine related rather than comm related?
- */
};
-/* Magic number for checking ops size. If a struct doesn't end with this
- number, somebody changed the declaration but didn't change all the
- places that initialize one. */
-
-#define OPS_MAGIC 3840
-
/* The ops structure for our "current" target process. This should
never be NULL. If there is no target, it points to the dummy_target. */
-extern struct target_ops current_target;
+extern struct target_ops *target_stack;
/* Define easy words for doing these operations on our current target. */
-#define target_shortname (current_target.to_shortname)
-#define target_longname (current_target.to_longname)
+#define target_shortname (target_stack->shortname ())
+#define target_longname (target_stack->longname ())
/* Does whatever cleanup is required for a target that we are no
longer going to be calling. This routine is automatically always
@@ -1298,8 +1268,8 @@ extern struct target_ops *find_run_target (void);
or their target_attach implementation takes care of the waiting.
These targets must set to_attach_no_wait. */
-#define target_attach_no_wait \
- (current_target.to_attach_no_wait)
+#define target_attach_no_wait() \
+ (target_stack->attach_no_wait ())
/* The target_attach operation places a process under debugger control,
and stops the process.
@@ -1307,7 +1277,7 @@ extern struct target_ops *find_run_target (void);
This operation provides a target-specific hook that allows the
necessary bookkeeping to be performed after an attach completes. */
#define target_post_attach(pid) \
- (*current_target.to_post_attach) (&current_target, pid)
+ (target_stack->post_attach) (pid)
/* Display a message indicating we're about to detach from the current
inferior process. */
@@ -1377,7 +1347,7 @@ extern void target_store_registers (struct regcache *regcache, int regs);
debugged. */
#define target_prepare_to_store(regcache) \
- (*current_target.to_prepare_to_store) (&current_target, regcache)
+ (target_stack->prepare_to_store) (regcache)
/* Determine current address space of thread PTID. */
@@ -1394,7 +1364,7 @@ int target_info_proc (const char *, enum info_proc_what);
simultaneously. */
#define target_supports_multi_process() \
- (*current_target.to_supports_multi_process) (&current_target)
+ (target_stack->supports_multi_process) ()
/* Returns true if this target can disable address space randomization. */
@@ -1404,22 +1374,22 @@ int target_supports_disable_randomization (void);
while a trace experiment is running. */
#define target_supports_enable_disable_tracepoint() \
- (*current_target.to_supports_enable_disable_tracepoint) (&current_target)
+ (target_stack->supports_enable_disable_tracepoint) ()
#define target_supports_string_tracing() \
- (*current_target.to_supports_string_tracing) (&current_target)
+ (target_stack->supports_string_tracing) ()
/* Returns true if this target can handle breakpoint conditions
on its end. */
#define target_supports_evaluation_of_breakpoint_conditions() \
- (*current_target.to_supports_evaluation_of_breakpoint_conditions) (&current_target)
+ (target_stack->supports_evaluation_of_breakpoint_conditions) ()
/* Returns true if this target can handle breakpoint commands
on its end. */
#define target_can_run_breakpoint_commands() \
- (*current_target.to_can_run_breakpoint_commands) (&current_target)
+ (target_stack->can_run_breakpoint_commands) ()
extern int target_read_string (CORE_ADDR, char **, int, int *);
@@ -1494,7 +1464,7 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
/* Print a line about the current target. */
#define target_files_info() \
- (*current_target.to_files_info) (&current_target)
+ (target_stack->files_info) ()
/* Insert a breakpoint at address BP_TGT->placed_address in
the target machine. Returns 0 for success, and returns non-zero or
@@ -1545,8 +1515,8 @@ extern void target_terminal_ours_for_output (void);
extern void target_terminal_ours (void);
-/* Return true if the target stack has a non-default
- "to_terminal_ours" method. */
+/* Return true if the target stack has a non-default "terminal_ours"
+ method. */
extern int target_supports_terminal_ours (void);
@@ -1558,7 +1528,7 @@ extern struct cleanup *make_cleanup_restore_target_terminal (void);
exists. */
#define target_terminal_info(arg, from_tty) \
- (*current_target.to_terminal_info) (&current_target, arg, from_tty)
+ (target_stack->terminal_info) (arg, from_tty)
/* Kill the inferior process. Make it go away. */
@@ -1588,7 +1558,7 @@ extern void target_load (const char *arg, int from_tty);
Such targets will supply an appropriate definition for this function. */
#define target_post_startup_inferior(ptid) \
- (*current_target.to_post_startup_inferior) (&current_target, ptid)
+ (target_stack->post_startup_inferior) (ptid)
/* On some targets, we can catch an inferior fork or vfork event when
it occurs. These functions insert/remove an already-created
@@ -1596,16 +1566,16 @@ extern void target_load (const char *arg, int from_tty);
catchpoint type is not supported and -1 for failure. */
#define target_insert_fork_catchpoint(pid) \
- (*current_target.to_insert_fork_catchpoint) (&current_target, pid)
+ (target_stack->insert_fork_catchpoint) (pid)
#define target_remove_fork_catchpoint(pid) \
- (*current_target.to_remove_fork_catchpoint) (&current_target, pid)
+ (target_stack->remove_fork_catchpoint) (pid)
#define target_insert_vfork_catchpoint(pid) \
- (*current_target.to_insert_vfork_catchpoint) (&current_target, pid)
+ (target_stack->insert_vfork_catchpoint) (pid)
#define target_remove_vfork_catchpoint(pid) \
- (*current_target.to_remove_vfork_catchpoint) (&current_target, pid)
+ (target_stack->remove_vfork_catchpoint) (pid)
/* If the inferior forks or vforks, this function will be called at
the next resume in order to perform any bookkeeping and fiddling
@@ -1628,10 +1598,10 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname);
catchpoint type is not supported and -1 for failure. */
#define target_insert_exec_catchpoint(pid) \
- (*current_target.to_insert_exec_catchpoint) (&current_target, pid)
+ (target_stack->insert_exec_catchpoint) (pid)
#define target_remove_exec_catchpoint(pid) \
- (*current_target.to_remove_exec_catchpoint) (&current_target, pid)
+ (target_stack->remove_exec_catchpoint) (pid)
/* Syscall catch.
@@ -1654,15 +1624,14 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname);
for failure. */
#define target_set_syscall_catchpoint(pid, needed, any_count, table_size, table) \
- (*current_target.to_set_syscall_catchpoint) (&current_target, \
- pid, needed, any_count, \
- table_size, table)
+ (target_stack->set_syscall_catchpoint) (pid, needed, any_count, \
+ table_size, table)
/* Returns TRUE if PID has exited. And, also sets EXIT_STATUS to the
exit code of PID, if any. */
#define target_has_exited(pid,wait_status,exit_status) \
- (*current_target.to_has_exited) (&current_target, \
+ (target_stack->has_exited) (\
pid,wait_status,exit_status)
/* The debugger has completed a blocking wait() call. There is now
@@ -1674,10 +1643,9 @@ void target_follow_exec (struct inferior *inf, char *execd_pathname);
void target_mourn_inferior (void);
-/* Does target have enough data to do a run or attach command? */
+/* Does target have enough data to do a run or attach command? */
-#define target_can_run(t) \
- ((t)->to_can_run) (t)
+extern int target_can_run ();
/* Set list of signals to be handled in the target.
@@ -1747,7 +1715,7 @@ extern void default_target_pass_ctrlc (struct target_ops *ops);
placed in OUTBUF. */
#define target_rcmd(command, outbuf) \
- (*current_target.to_rcmd) (&current_target, command, outbuf)
+ (target_stack->rcmd) (command, outbuf)
/* Does the target include all of memory, or only part of it? This
@@ -1792,27 +1760,26 @@ extern int target_has_execution_current (void);
/* Default implementations for process_stratum targets. Return true
if there's a selected inferior, false otherwise. */
-extern int default_child_has_all_memory (struct target_ops *ops);
-extern int default_child_has_memory (struct target_ops *ops);
-extern int default_child_has_stack (struct target_ops *ops);
-extern int default_child_has_registers (struct target_ops *ops);
-extern int default_child_has_execution (struct target_ops *ops,
- ptid_t the_ptid);
+extern int default_child_has_all_memory ();
+extern int default_child_has_memory ();
+extern int default_child_has_stack ();
+extern int default_child_has_registers ();
+extern int default_child_has_execution (ptid_t the_ptid);
/* Can the target support the debugger control of thread execution?
Can it lock the thread scheduler? */
#define target_can_lock_scheduler \
- (current_target.to_has_thread_control & tc_schedlock)
+ (target_stack->get_thread_control_capabilities () & tc_schedlock)
/* Controls whether async mode is permitted. */
extern int target_async_permitted;
/* Can the target support asynchronous execution? */
-#define target_can_async_p() (current_target.to_can_async_p (&current_target))
+#define target_can_async_p() (target_stack->can_async_p ())
/* Is the target in asynchronous execution mode? */
-#define target_is_async_p() (current_target.to_is_async_p (&current_target))
+#define target_is_async_p() (target_stack->is_async_p ())
/* Enables/disabled async target events. */
extern void target_async (int enable);
@@ -1830,7 +1797,7 @@ extern enum auto_boolean target_non_stop_enabled;
extern int target_is_non_stop_p (void);
#define target_execution_direction() \
- (current_target.to_execution_direction (&current_target))
+ (target_stack->execution_direction ())
/* Converts a process id to a string. Usually, the string just contains
`process xyz', but on some systems it may contain
@@ -1845,7 +1812,7 @@ extern char *normal_pid_to_str (ptid_t ptid);
is okay. */
#define target_extra_thread_info(TP) \
- (current_target.to_extra_thread_info (&current_target, TP))
+ (target_stack->extra_thread_info (TP))
/* Return the thread's name, or NULL if the target is unable to determine it.
The returned value must not be freed by the caller. */
@@ -1865,12 +1832,12 @@ extern const char *target_thread_name (struct thread_info *);
it must persist. */
#define target_pid_to_exec_file(pid) \
- (current_target.to_pid_to_exec_file) (&current_target, pid)
+ (target_stack->pid_to_exec_file) (pid)
/* See the to_thread_architecture description in struct target_ops. */
#define target_thread_architecture(ptid) \
- (current_target.to_thread_architecture (&current_target, ptid))
+ (target_stack->thread_architecture (ptid))
/*
* Iterator function for target memory regions.
@@ -1880,21 +1847,21 @@ extern const char *target_thread_name (struct thread_info *);
*/
#define target_find_memory_regions(FUNC, DATA) \
- (current_target.to_find_memory_regions) (&current_target, FUNC, DATA)
+ (target_stack->find_memory_regions) (FUNC, DATA)
/*
* Compose corefile .note section.
*/
#define target_make_corefile_notes(BFD, SIZE_P) \
- (current_target.to_make_corefile_notes) (&current_target, BFD, SIZE_P)
+ (target_stack->make_corefile_notes) (BFD, SIZE_P)
/* Bookmark interfaces. */
#define target_get_bookmark(ARGS, FROM_TTY) \
- (current_target.to_get_bookmark) (&current_target, ARGS, FROM_TTY)
+ (target_stack->get_bookmark) (ARGS, FROM_TTY)
#define target_goto_bookmark(ARG, FROM_TTY) \
- (current_target.to_goto_bookmark) (&current_target, ARG, FROM_TTY)
+ (target_stack->goto_bookmark) (ARG, FROM_TTY)
/* Hardware watchpoint interfaces. */
@@ -1902,32 +1869,32 @@ extern const char *target_thread_name (struct thread_info *);
write). Only the INFERIOR_PTID task is being queried. */
#define target_stopped_by_watchpoint() \
- ((*current_target.to_stopped_by_watchpoint) (&current_target))
+ ((target_stack->stopped_by_watchpoint) ())
/* Returns non-zero if the target stopped because it executed a
software breakpoint instruction. */
#define target_stopped_by_sw_breakpoint() \
- ((*current_target.to_stopped_by_sw_breakpoint) (&current_target))
+ ((target_stack->stopped_by_sw_breakpoint) ())
#define target_supports_stopped_by_sw_breakpoint() \
- ((*current_target.to_supports_stopped_by_sw_breakpoint) (&current_target))
+ ((target_stack->supports_stopped_by_sw_breakpoint) ())
#define target_stopped_by_hw_breakpoint() \
- ((*current_target.to_stopped_by_hw_breakpoint) (&current_target))
+ ((target_stack->stopped_by_hw_breakpoint) ())
#define target_supports_stopped_by_hw_breakpoint() \
- ((*current_target.to_supports_stopped_by_hw_breakpoint) (&current_target))
+ ((target_stack->supports_stopped_by_hw_breakpoint) ())
/* Non-zero if we have steppable watchpoints */
#define target_have_steppable_watchpoint \
- (current_target.to_have_steppable_watchpoint)
+ (target_stack->have_steppable_watchpoint ())
/* Non-zero if we have continuable watchpoints */
#define target_have_continuable_watchpoint \
- (current_target.to_have_continuable_watchpoint)
+ (target_stack->have_continuable_watchpoint ())
/* Provide defaults for hardware watchpoint functions. */
@@ -1944,19 +1911,18 @@ extern const char *target_thread_name (struct thread_info *);
this one used so far. */
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
- (*current_target.to_can_use_hw_breakpoint) (&current_target, \
+ (target_stack->can_use_hw_breakpoint) ( \
TYPE, CNT, OTHERTYPE)
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */
#define target_region_ok_for_hw_watchpoint(addr, len) \
- (*current_target.to_region_ok_for_hw_watchpoint) (&current_target, \
- addr, len)
+ (target_stack->region_ok_for_hw_watchpoint) (addr, len)
#define target_can_do_single_step() \
- (*current_target.to_can_do_single_step) (&current_target)
+ (target_stack->can_do_single_step) ()
/* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes.
TYPE is 0 for write, 1 for read, and 2 for read/write accesses.
@@ -1965,12 +1931,10 @@ extern const char *target_thread_name (struct thread_info *);
-1 for failure. */
#define target_insert_watchpoint(addr, len, type, cond) \
- (*current_target.to_insert_watchpoint) (&current_target, \
- addr, len, type, cond)
+ (target_stack->insert_watchpoint) (addr, len, type, cond)
#define target_remove_watchpoint(addr, len, type, cond) \
- (*current_target.to_remove_watchpoint) (&current_target, \
- addr, len, type, cond)
+ (target_stack->remove_watchpoint) (addr, len, type, cond)
/* Insert a new masked watchpoint at ADDR using the mask MASK.
RW may be hw_read for a read watchpoint, hw_write for a write watchpoint
@@ -1994,12 +1958,10 @@ extern int target_remove_mask_watchpoint (CORE_ADDR, CORE_ADDR,
message) otherwise. */
#define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
- (*current_target.to_insert_hw_breakpoint) (&current_target, \
- gdbarch, bp_tgt)
+ (target_stack->insert_hw_breakpoint) (gdbarch, bp_tgt)
#define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
- (*current_target.to_remove_hw_breakpoint) (&current_target, \
- gdbarch, bp_tgt)
+ (target_stack->remove_hw_breakpoint) (gdbarch, bp_tgt)
/* Return number of debug registers needed for a ranged breakpoint,
or -1 if ranged breakpoints are not supported. */
@@ -2010,12 +1972,12 @@ extern int target_ranged_break_num_registers (void);
target_stopped_by_watchpoint, in such case place it to *ADDR_P. Only the
INFERIOR_PTID task is being queried. */
#define target_stopped_data_address(target, addr_p) \
- (*(target)->to_stopped_data_address) (target, addr_p)
+ (target)->stopped_data_address (addr_p)
/* Return non-zero if ADDR is within the range of a watchpoint spanning
LENGTH bytes beginning at START. */
#define target_watchpoint_addr_within_range(target, addr, start, length) \
- (*(target)->to_watchpoint_addr_within_range) (target, addr, start, length)
+ (target)->watchpoint_addr_within_range (addr, start, length)
/* Return non-zero if the target is capable of using hardware to evaluate
the condition expression. In this case, if the condition is false when
@@ -2028,8 +1990,7 @@ extern int target_ranged_break_num_registers (void);
For this reason, GDB will still evaluate the condition expression when
the watchpoint triggers. */
#define target_can_accel_watchpoint_condition(addr, len, type, cond) \
- (*current_target.to_can_accel_watchpoint_condition) (&current_target, \
- addr, len, type, cond)
+ (target_stack->can_accel_watchpoint_condition) (addr, len, type, cond)
/* Return number of debug registers needed for a masked watchpoint,
-1 if masked watchpoints are not supported or -2 if the given address
@@ -2039,12 +2000,12 @@ extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask);
/* Target can execute in reverse? */
#define target_can_execute_reverse \
- current_target.to_can_execute_reverse (&current_target)
+ target_stack->can_execute_reverse ()
extern const struct target_desc *target_read_description (struct target_ops *);
#define target_get_ada_task_ptid(lwp, tid) \
- (*current_target.to_get_ada_task_ptid) (&current_target, lwp,tid)
+ (target_stack->get_ada_task_ptid) (lwp,tid)
/* Utility implementation of searching memory. */
extern int simple_search_memory (struct target_ops* ops,
@@ -2066,7 +2027,7 @@ extern int target_search_memory (CORE_ADDR start_addr,
/* Return nonzero if the filesystem seen by the current inferior
is the local filesystem, zero otherwise. */
#define target_filesystem_is_local() \
- current_target.to_filesystem_is_local (&current_target)
+ target_stack->filesystem_is_local ()
/* Open FILENAME on the target, in the filesystem as seen by INF,
using FLAGS and MODE. If INF is NULL, use the filesystem seen
@@ -2154,105 +2115,100 @@ extern char *target_fileio_read_stralloc (struct inferior *inf,
/* Tracepoint-related operations. */
#define target_trace_init() \
- (*current_target.to_trace_init) (&current_target)
+ (target_stack->trace_init) ()
#define target_download_tracepoint(t) \
- (*current_target.to_download_tracepoint) (&current_target, t)
+ (target_stack->download_tracepoint) (t)
#define target_can_download_tracepoint() \
- (*current_target.to_can_download_tracepoint) (&current_target)
+ (target_stack->can_download_tracepoint) ()
#define target_download_trace_state_variable(tsv) \
- (*current_target.to_download_trace_state_variable) (&current_target, tsv)
+ (target_stack->download_trace_state_variable) (tsv)
#define target_enable_tracepoint(loc) \
- (*current_target.to_enable_tracepoint) (&current_target, loc)
+ (target_stack->enable_tracepoint) (loc)
#define target_disable_tracepoint(loc) \
- (*current_target.to_disable_tracepoint) (&current_target, loc)
+ (target_stack->disable_tracepoint) (loc)
#define target_trace_start() \
- (*current_target.to_trace_start) (&current_target)
+ (target_stack->trace_start) ()
#define target_trace_set_readonly_regions() \
- (*current_target.to_trace_set_readonly_regions) (&current_target)
+ (target_stack->trace_set_readonly_regions) ()
#define target_get_trace_status(ts) \
- (*current_target.to_get_trace_status) (&current_target, ts)
+ (target_stack->get_trace_status) (ts)
#define target_get_tracepoint_status(tp,utp) \
- (*current_target.to_get_tracepoint_status) (&current_target, tp, utp)
+ (target_stack->get_tracepoint_status) (tp, utp)
#define target_trace_stop() \
- (*current_target.to_trace_stop) (&current_target)
+ (target_stack->trace_stop) ()
#define target_trace_find(type,num,addr1,addr2,tpp) \
- (*current_target.to_trace_find) (&current_target, \
+ (target_stack->trace_find) (\
(type), (num), (addr1), (addr2), (tpp))
#define target_get_trace_state_variable_value(tsv,val) \
- (*current_target.to_get_trace_state_variable_value) (&current_target, \
- (tsv), (val))
+ (target_stack->get_trace_state_variable_value) ((tsv), (val))
#define target_save_trace_data(filename) \
- (*current_target.to_save_trace_data) (&current_target, filename)
+ (target_stack->save_trace_data) (filename)
#define target_upload_tracepoints(utpp) \
- (*current_target.to_upload_tracepoints) (&current_target, utpp)
+ (target_stack->upload_tracepoints) (utpp)
#define target_upload_trace_state_variables(utsvp) \
- (*current_target.to_upload_trace_state_variables) (&current_target, utsvp)
+ (target_stack->upload_trace_state_variables) (utsvp)
#define target_get_raw_trace_data(buf,offset,len) \
- (*current_target.to_get_raw_trace_data) (&current_target, \
- (buf), (offset), (len))
+ (target_stack->get_raw_trace_data) ((buf), (offset), (len))
#define target_get_min_fast_tracepoint_insn_len() \
- (*current_target.to_get_min_fast_tracepoint_insn_len) (&current_target)
+ (target_stack->get_min_fast_tracepoint_insn_len) ()
#define target_set_disconnected_tracing(val) \
- (*current_target.to_set_disconnected_tracing) (&current_target, val)
+ (target_stack->set_disconnected_tracing) (val)
#define target_set_circular_trace_buffer(val) \
- (*current_target.to_set_circular_trace_buffer) (&current_target, val)
+ (target_stack->set_circular_trace_buffer) (val)
#define target_set_trace_buffer_size(val) \
- (*current_target.to_set_trace_buffer_size) (&current_target, val)
+ (target_stack->set_trace_buffer_size) (val)
#define target_set_trace_notes(user,notes,stopnotes) \
- (*current_target.to_set_trace_notes) (&current_target, \
- (user), (notes), (stopnotes))
+ (target_stack->set_trace_notes) ((user), (notes), (stopnotes))
#define target_get_tib_address(ptid, addr) \
- (*current_target.to_get_tib_address) (&current_target, (ptid), (addr))
+ (target_stack->get_tib_address) ((ptid), (addr))
#define target_set_permissions() \
- (*current_target.to_set_permissions) (&current_target)
+ (target_stack->set_permissions) ()
#define target_static_tracepoint_marker_at(addr, marker) \
- (*current_target.to_static_tracepoint_marker_at) (&current_target, \
- addr, marker)
+ (target_stack->static_tracepoint_marker_at) (addr, marker)
#define target_static_tracepoint_markers_by_strid(marker_id) \
- (*current_target.to_static_tracepoint_markers_by_strid) (&current_target, \
- marker_id)
+ (target_stack->static_tracepoint_markers_by_strid) (marker_id)
#define target_traceframe_info() \
- (*current_target.to_traceframe_info) (&current_target)
+ (target_stack->traceframe_info) ()
#define target_use_agent(use) \
- (*current_target.to_use_agent) (&current_target, use)
+ (target_stack->use_agent) (use)
#define target_can_use_agent() \
- (*current_target.to_can_use_agent) (&current_target)
+ (target_stack->can_use_agent) ()
#define target_augmented_libraries_svr4_read() \
- (*current_target.to_augmented_libraries_svr4_read) (&current_target)
+ (target_stack->augmented_libraries_svr4_read) ()
/* Command logging facility. */
#define target_log_command(p) \
- (*current_target.to_log_command) (&current_target, p)
+ (target_stack->log_command) (p)
extern int target_core_of_thread (ptid_t ptid);
@@ -2281,11 +2237,6 @@ int target_verify_memory (const gdb_byte *data,
/* Routines for maintenance of the target structures...
- complete_target_initialization: Finalize a target_ops by filling in
- any fields needed by the target implementation. Unnecessary for
- targets which are registered via add_target, as this part gets
- taken care of then.
-
add_target: Add a target to the list of all possible targets.
This only makes sense for targets that should be activated using
the "target TARGET_NAME ..." command.
@@ -2304,8 +2255,6 @@ extern void add_target (struct target_ops *);
extern void add_target_with_completer (struct target_ops *t,
completer_ftype *completer);
-extern void complete_target_initialization (struct target_ops *t);
-
/* Adds a command ALIAS for target T and marks it deprecated. This is useful
for maintaining backwards compatibility when renaming targets. */
@@ -2374,12 +2323,28 @@ extern struct target_section_table *target_get_section_table
/* From mem-break.c */
-extern int memory_remove_breakpoint (struct target_ops *, struct gdbarch *,
- struct bp_target_info *,
+extern int memory_remove_breakpoint (struct target_ops *,
+ struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason);
-extern int memory_insert_breakpoint (struct target_ops *, struct gdbarch *,
- struct bp_target_info *);
+extern int memory_insert_breakpoint (struct target_ops *,
+ struct gdbarch *, struct bp_target_info *);
+
+/* Convenience template use to add memory breakpoints support to a
+ target. */
+
+template <class T>
+struct memory_breakpoint_target : public T
+{
+ int insert_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt) OVERRIDE
+ { return memory_insert_breakpoint (this, gdbarch, bp_tgt); }
+
+ int remove_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt,
+ enum remove_bp_reason reason) OVERRIDE
+ { return memory_remove_breakpoint (this, gdbarch, bp_tgt, reason); }
+};
/* Check whether the memory at the breakpoint's placed address still
contains the expected breakpoint instruction. */
diff --git a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
index 0c954c8066d..0c91c0bcb30 100644
--- a/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
+++ b/gdb/testsuite/gdb.base/breakpoint-in-ro-region.exp
@@ -37,7 +37,7 @@ proc probe_target_hardware_step {} {
gdb_test_no_output "set debug target 1"
set test "probe target hardware step"
gdb_test_multiple "si" $test {
- -re "to_resume \\(\[^\r\n\]+, step, .*$gdb_prompt $" {
+ -re "resume \\(\[^\r\n\]+, step, .*$gdb_prompt $" {
set hw_step 1
pass $test
}
@@ -45,7 +45,7 @@ proc probe_target_hardware_step {} {
pass $test
}
}
- gdb_test "set debug target 0" "->to_log_command.*\\).*"
+ gdb_test "set debug target 0" "->log_command.*\\).*"
return $hw_step
}
diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
index cc1acea900c..642b5ee6c69 100644
--- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
+++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp
@@ -62,7 +62,7 @@ gdb_test_no_output "set debug target 1"
set hardware_step 0
set test "probe target hardware step"
gdb_test_multiple "si" $test {
- -re "to_resume \\(\[^\r\n\]+, step, .*$gdb_prompt $" {
+ -re "resume \\(\[^\r\n\]+, step, .*$gdb_prompt $" {
set hardware_step 1
pass $test
}
@@ -76,7 +76,7 @@ if { $hardware_step } {
return
}
-gdb_test "set debug target 0" "->to_log_command.*\\)"
+gdb_test "set debug target 0" "->log_command.*\\)"
set line_re "\[^\r\n\]*"
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 9c561b9e650..c3424f20aa5 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -37,6 +37,40 @@
#define O_LARGEFILE 0
#endif
+class tfile_target : public tracefile_target
+{
+ public:
+ const char *shortname () OVERRIDE
+ { return "tfile"; }
+
+ const char *longname () OVERRIDE
+ { return _("Local trace dump file"); }
+
+ const char *doc () OVERRIDE
+ {
+ return _("\
+Use a trace file as a target. Specify the filename of the trace file.");
+ }
+
+ void open (const char *, int) OVERRIDE;
+ void close () OVERRIDE;
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+ void files_info () OVERRIDE;
+ int trace_find (enum trace_find_type type, int num,
+ CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) OVERRIDE;
+ int get_trace_state_variable_value (int tsv, LONGEST *val) OVERRIDE;
+ struct traceframe_info *traceframe_info () OVERRIDE;
+
+ void get_tracepoint_status (struct breakpoint *tp,
+ struct uploaded_tp *utp) OVERRIDE;
+};
+
/* TFILE trace writer. */
struct tfile_trace_file_writer
@@ -274,7 +308,7 @@ tfile_write_tdesc (struct trace_file_writer *self)
{
struct tfile_trace_file_writer *writer
= (struct tfile_trace_file_writer *) self;
- char *tdesc = target_fetch_description_xml (&current_target);
+ char *tdesc = target_fetch_description_xml (target_stack);
char *ptr = tdesc;
char *next;
@@ -379,10 +413,6 @@ tfile_trace_file_writer_new (void)
/* target tfile command */
-static struct target_ops tfile_ops;
-
-/* Fill in tfile_ops with its defined operations and properties. */
-
#define TRACE_HEADER_SIZE 8
#define TFILE_PID (1)
@@ -418,8 +448,8 @@ tfile_read (gdb_byte *readbuf, int size)
error (_("Premature end of file while reading trace file"));
}
-static void
-tfile_open (const char *arg, int from_tty)
+void
+tfile_target::open (const char *arg, int from_tty)
{
char *temp;
struct cleanup *old_chain;
@@ -457,7 +487,7 @@ tfile_open (const char *arg, int from_tty)
/* Looks semi-reasonable. Toss the old trace file and work on the new. */
discard_cleanups (old_chain); /* Don't free filename any more. */
- unpush_target (&tfile_ops);
+ unpush_target (this);
trace_filename = xstrdup (filename);
trace_fd = scratch_chan;
@@ -474,7 +504,7 @@ tfile_open (const char *arg, int from_tty)
&& (startswith (header + 1, "TRACE0\n"))))
error (_("File is not a valid trace file."));
- push_target (&tfile_ops);
+ push_target (this);
trace_regblock_size = 0;
ts = current_trace_status ();
@@ -527,7 +557,7 @@ tfile_open (const char *arg, int from_tty)
CATCH (ex, RETURN_MASK_ALL)
{
/* Remove the partially set up target. */
- unpush_target (&tfile_ops);
+ unpush_target (this);
throw_exception (ex);
}
END_CATCH
@@ -547,7 +577,7 @@ tfile_open (const char *arg, int from_tty)
merge_uploaded_tracepoints (&uploaded_tps);
- post_create_inferior (&tfile_ops, from_tty);
+ post_create_inferior (this, from_tty);
}
/* Interpret the given line from the definitions part of the trace
@@ -590,8 +620,8 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp,
/* Close the trace file and generally clean up. */
-static void
-tfile_close (struct target_ops *self)
+void
+tfile_target::close ()
{
int pid;
@@ -602,7 +632,7 @@ tfile_close (struct target_ops *self)
inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */
exit_inferior_silent (pid);
- close (trace_fd);
+ ::close (trace_fd);
trace_fd = -1;
xfree (trace_filename);
trace_filename = NULL;
@@ -611,15 +641,14 @@ tfile_close (struct target_ops *self)
trace_reset_local_state ();
}
-static void
-tfile_files_info (struct target_ops *t)
+void
+tfile_target::files_info ()
{
printf_filtered ("\t`%s'\n", trace_filename);
}
-static void
-tfile_get_tracepoint_status (struct target_ops *self,
- struct breakpoint *tp, struct uploaded_tp *utp)
+void
+tfile_target::get_tracepoint_status (struct breakpoint *tp, struct uploaded_tp *utp)
{
/* Other bits of trace status were collected as part of opening the
trace files, so nothing to do here. */
@@ -663,9 +692,9 @@ tfile_get_traceframe_address (off_t tframe_offset)
both the traceframe and tracepoint number, otherwise -1 for
each. */
-static int
-tfile_trace_find (struct target_ops *self, enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
+int
+tfile_target::trace_find (enum trace_find_type type, int num,
+ CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
{
short tpnum;
int tfnum = 0, found = 0;
@@ -846,9 +875,8 @@ traceframe_find_block_type (char type_wanted, int pos)
/* Look for a block of saved registers in the traceframe, and get the
requested register from it. */
-static void
-tfile_fetch_registers (struct target_ops *ops,
- struct regcache *regcache, int regno)
+void
+tfile_target::fetch_registers (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int offset, regn, regsize, dummy;
@@ -893,7 +921,7 @@ tfile_fetch_registers (struct target_ops *ops,
}
static enum target_xfer_status
-tfile_xfer_partial_features (struct target_ops *ops, const char *annex,
+tfile_xfer_partial_features (const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
@@ -919,15 +947,15 @@ tfile_xfer_partial_features (struct target_ops *ops, const char *annex,
return TARGET_XFER_OK;
}
-static enum target_xfer_status
-tfile_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+enum target_xfer_status
+tfile_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
/* We're only doing regular memory and tdesc for now. */
if (object == TARGET_OBJECT_AVAILABLE_FEATURES)
- return tfile_xfer_partial_features (ops, annex, readbuf, writebuf,
+ return tfile_xfer_partial_features (annex, readbuf, writebuf,
offset, len, xfered_len);
if (object != TARGET_OBJECT_MEMORY)
return TARGET_XFER_E_IO;
@@ -1011,9 +1039,8 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object,
/* Iterate through the blocks of a trace frame, looking for a 'V'
block with a matching tsv number. */
-static int
-tfile_get_trace_state_variable_value (struct target_ops *self,
- int tsvnum, LONGEST *val)
+int
+tfile_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
{
int pos;
int found = 0;
@@ -1099,8 +1126,8 @@ build_traceframe_info (char blocktype, void *data)
return 0;
}
-static struct traceframe_info *
-tfile_traceframe_info (struct target_ops *self)
+struct traceframe_info *
+tfile_target::traceframe_info ()
{
struct traceframe_info *info = XCNEW (struct traceframe_info);
@@ -1118,33 +1145,10 @@ tfile_append_tdesc_line (const char *line)
buffer_grow_str (&trace_tdesc, "\n");
}
-static void
-init_tfile_ops (void)
-{
- init_tracefile_ops (&tfile_ops);
-
- tfile_ops.to_shortname = "tfile";
- tfile_ops.to_longname = "Local trace dump file";
- tfile_ops.to_doc
- = "Use a trace file as a target. Specify the filename of the trace file.";
- tfile_ops.to_open = tfile_open;
- tfile_ops.to_close = tfile_close;
- tfile_ops.to_fetch_registers = tfile_fetch_registers;
- tfile_ops.to_xfer_partial = tfile_xfer_partial;
- tfile_ops.to_files_info = tfile_files_info;
- tfile_ops.to_get_tracepoint_status = tfile_get_tracepoint_status;
- tfile_ops.to_trace_find = tfile_trace_find;
- tfile_ops.to_get_trace_state_variable_value
- = tfile_get_trace_state_variable_value;
- tfile_ops.to_traceframe_info = tfile_traceframe_info;
-}
-
extern initialize_file_ftype _initialize_tracefile_tfile;
void
_initialize_tracefile_tfile (void)
{
- init_tfile_ops ();
-
- add_target_with_completer (&tfile_ops, filename_completer);
+ add_target_with_completer (new tfile_target (), filename_completer);
}
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index 56fb0d2e2be..8a3faced286 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -425,16 +425,16 @@ tracefile_fetch_registers (struct regcache *regcache, int regno)
/* This is the implementation of target_ops method to_has_all_memory. */
-static int
-tracefile_has_all_memory (struct target_ops *ops)
+int
+tracefile_target::has_all_memory ()
{
return 1;
}
/* This is the implementation of target_ops method to_has_memory. */
-static int
-tracefile_has_memory (struct target_ops *ops)
+int
+tracefile_target::has_memory ()
{
return 1;
}
@@ -443,8 +443,8 @@ tracefile_has_memory (struct target_ops *ops)
The target has a stack when GDB has already selected one trace
frame. */
-static int
-tracefile_has_stack (struct target_ops *ops)
+int
+tracefile_target::has_stack ()
{
return get_traceframe_number () != -1;
}
@@ -453,8 +453,8 @@ tracefile_has_stack (struct target_ops *ops)
The target has registers when GDB has already selected one trace
frame. */
-static int
-tracefile_has_registers (struct target_ops *ops)
+int
+tracefile_target::has_registers ()
{
return get_traceframe_number () != -1;
}
@@ -462,8 +462,8 @@ tracefile_has_registers (struct target_ops *ops)
/* This is the implementation of target_ops method to_thread_alive.
tracefile has one thread faked by GDB. */
-static int
-tracefile_thread_alive (struct target_ops *ops, ptid_t ptid)
+int
+tracefile_target::thread_alive (ptid_t ptid)
{
return 1;
}
@@ -471,8 +471,8 @@ tracefile_thread_alive (struct target_ops *ops, ptid_t ptid)
/* This is the implementation of target_ops method to_get_trace_status.
The trace status for a file is that tracing can never be run. */
-static int
-tracefile_get_trace_status (struct target_ops *self, struct trace_status *ts)
+int
+tracefile_target::get_trace_status (struct trace_status *ts)
{
/* Other bits of trace status were collected as part of opening the
trace files, so nothing to do here. */
@@ -480,19 +480,9 @@ tracefile_get_trace_status (struct target_ops *self, struct trace_status *ts)
return -1;
}
-/* Initialize OPS for tracefile related targets. */
-
-void
-init_tracefile_ops (struct target_ops *ops)
+tracefile_target::tracefile_target ()
{
- ops->to_stratum = process_stratum;
- ops->to_get_trace_status = tracefile_get_trace_status;
- ops->to_has_all_memory = tracefile_has_all_memory;
- ops->to_has_memory = tracefile_has_memory;
- ops->to_has_stack = tracefile_has_stack;
- ops->to_has_registers = tracefile_has_registers;
- ops->to_thread_alive = tracefile_thread_alive;
- ops->to_magic = OPS_MAGIC;
+ this->to_stratum = process_stratum;
}
extern initialize_file_ftype _initialize_tracefile;
diff --git a/gdb/tracefile.h b/gdb/tracefile.h
index e6d4460d3ef..00c628341b5 100644
--- a/gdb/tracefile.h
+++ b/gdb/tracefile.h
@@ -113,7 +113,18 @@ struct trace_file_writer
extern struct trace_file_writer *tfile_trace_file_writer_new (void);
-extern void init_tracefile_ops (struct target_ops *ops);
+class tracefile_target : public target_ops
+{
+ public:
+ tracefile_target ();
+
+ int get_trace_status (struct trace_status *ts) OVERRIDE;
+ int has_all_memory () OVERRIDE;
+ int has_memory () OVERRIDE;
+ int has_stack () OVERRIDE;
+ int has_registers () OVERRIDE;
+ int thread_alive (ptid_t ptid) OVERRIDE;
+};
extern void tracefile_fetch_registers (struct regcache *regcache, int regno);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index a2189d57198..34bcaf35d4b 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4136,7 +4136,7 @@ sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var,
gdb_byte *buf;
/* We need to read the whole object before we know its size. */
- size = target_read_alloc (&current_target,
+ size = target_read_alloc (target_stack,
TARGET_OBJECT_STATIC_TRACE_DATA,
NULL, &buf);
if (size >= 0)
diff --git a/gdb/valops.c b/gdb/valops.c
index 40392e8889d..363dcdaca8e 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -973,7 +973,7 @@ read_value_memory (struct value *val, LONGEST embedded_offset,
enum target_xfer_status status;
ULONGEST xfered_partial;
- status = target_xfer_partial (current_target.beneath,
+ status = target_xfer_partial (target_stack,
object, NULL,
buffer + xfered_total * unit_size, NULL,
memaddr + xfered_total,
@@ -1209,7 +1209,7 @@ value_assign (struct value *toval, struct value *fromval)
case lval_register:
case lval_computed:
- observer_notify_target_changed (&current_target);
+ observer_notify_target_changed (target_stack);
/* Having destroyed the frame cache, restore the selected
frame. */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 6896da2b624..2237b0e8818 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1923,7 +1923,7 @@ print_function_pointer_address (const struct value_print_options *options,
{
CORE_ADDR func_addr
= gdbarch_convert_from_func_ptr_addr (gdbarch, address,
- &current_target);
+ target_stack);
/* If the function pointer is represented by a description, print
the address of the description. */
diff --git a/gdb/value.c b/gdb/value.c
index d6eab24e62a..4e608c02505 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3289,7 +3289,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
set_value_address (v,
gdbarch_convert_from_func_ptr_addr
- (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), &current_target));
+ (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), target_stack));
}
if (arg1p)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 0470f31eed2..b577fdb55f8 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -199,10 +199,6 @@ typedef enum
#define DEBUG_MEM(x) if (debug_memory) printf_unfiltered x
#define DEBUG_EXCEPT(x) if (debug_exceptions) printf_unfiltered x
-static void windows_interrupt (struct target_ops *self, ptid_t);
-static int windows_thread_alive (struct target_ops *, ptid_t);
-static void windows_kill_inferior (struct target_ops *);
-
static void cygwin_set_dr (int i, CORE_ADDR addr);
static void cygwin_set_dr7 (unsigned long val);
static CORE_ADDR cygwin_get_dr (int i);
@@ -300,6 +296,55 @@ static const struct xlate_exception
{STATUS_FLOAT_DIVIDE_BY_ZERO, GDB_SIGNAL_FPE},
{-1, GDB_SIGNAL_UNKNOWN}};
+
+struct windows_nat_target : public x86_nat_target<inf_child_target>
+{
+ void close () OVERRIDE;
+
+ void attach (const char *, int) OVERRIDE;
+
+ bool attach_no_wait () OVERRIDE
+ { return true; }
+
+ void detach (const char *, int) OVERRIDE;
+
+ void resume (ptid_t, int , enum gdb_signal) OVERRIDE;
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) OVERRIDE;
+
+ void fetch_registers (struct regcache *, int) OVERRIDE;
+ void store_registers (struct regcache *, int) OVERRIDE;
+
+ enum target_xfer_status xfer_partial (enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) OVERRIDE;
+
+ void files_info () OVERRIDE;
+
+ void kill () OVERRIDE;
+
+ void create_inferior (char *, char *, char **, int) OVERRIDE;
+
+ void mourn_inferior () OVERRIDE;
+
+ int thread_alive (ptid_t ptid) OVERRIDE;
+
+ char *pid_to_str (ptid_t) OVERRIDE;
+
+ void interrupt (ptid_t) OVERRIDE;
+
+ char *pid_to_exec_file (int pid) OVERRIDE;
+
+ ptid_t get_ada_task_ptid (long lwp, long thread) OVERRIDE;
+
+ int get_tib_address (ptid_t ptid, CORE_ADDR *addr) OVERRIDE;
+
+ const char *thread_name (struct thread_info *) OVERRIDE;
+};
+
/* Set the MAPPINGS static global to OFFSETS.
See the description of MAPPINGS for more details. */
@@ -533,9 +578,8 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r)
}
}
-static void
-windows_fetch_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int r)
+void
+windows_nat_target::fetch_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
@@ -560,9 +604,9 @@ do_windows_store_inferior_registers (const struct regcache *regcache, int r)
}
/* Store a new register value into the current thread context. */
-static void
-windows_store_inferior_registers (struct target_ops *ops,
- struct regcache *regcache, int r)
+
+void
+windows_nat_target::store_registers (struct regcache *regcache, int r)
{
current_thread = thread_rec (ptid_get_tid (inferior_ptid), TRUE);
/* Check if current_thread exists. Windows sometimes uses a non-existent
@@ -1296,9 +1340,8 @@ fake_create_process (void)
return main_thread_id;
}
-static void
-windows_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum gdb_signal sig)
+void
+windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
{
windows_thread_info *th;
DWORD continue_status = DBG_CONTINUE;
@@ -1359,8 +1402,7 @@ windows_resume (struct target_ops *ops,
/* Single step by setting t bit. */
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- windows_fetch_inferior_registers (ops, regcache,
- gdbarch_ps_regnum (gdbarch));
+ fetch_registers (regcache, gdbarch_ps_regnum (gdbarch));
th->context.EFlags |= FLAG_TRACE_BIT;
}
@@ -1617,9 +1659,9 @@ out:
}
/* Wait for interesting events to occur in the target process. */
-static ptid_t
-windows_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *ourstatus, int options)
+ptid_t
+windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
+ int options)
{
int pid = -1;
@@ -1662,7 +1704,7 @@ windows_wait (struct target_ops *ops,
the user tries to resume the execution in the inferior.
This is a classic race that we should try to fix one day. */
SetConsoleCtrlHandler (&ctrl_c_handler, TRUE);
- retval = get_windows_debug_event (ops, pid, ourstatus);
+ retval = get_windows_debug_event (this, pid, ourstatus);
SetConsoleCtrlHandler (&ctrl_c_handler, FALSE);
if (retval)
@@ -1675,7 +1717,7 @@ windows_wait (struct target_ops *ops,
detach = deprecated_ui_loop_hook (0);
if (detach)
- windows_kill_inferior (ops);
+ kill ();
}
}
}
@@ -1777,7 +1819,7 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
{
struct target_waitstatus status;
- windows_wait (ops, minus_one_ptid, &status, 0);
+ ops->wait (minus_one_ptid, &status, 0);
/* Note windows_wait returns TARGET_WAITKIND_SPURIOUS for thread
events. */
@@ -1785,7 +1827,7 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD pid, int attaching)
&& status.kind != TARGET_WAITKIND_SPURIOUS)
break;
- windows_resume (ops, minus_one_ptid, 0, GDB_SIGNAL_0);
+ ops->resume (minus_one_ptid, 0, GDB_SIGNAL_0);
}
/* Now that the inferior has been started and all DLLs have been mapped,
@@ -1859,8 +1901,9 @@ out:
}
/* Attach to process PID, then initialize for debugging it. */
-static void
-windows_attach (struct target_ops *ops, const char *args, int from_tty)
+
+void
+windows_nat_target::attach (const char *args, int from_tty)
{
BOOL ok;
DWORD pid;
@@ -1908,17 +1951,17 @@ windows_attach (struct target_ops *ops, const char *args, int from_tty)
gdb_flush (gdb_stdout);
}
- do_initial_windows_stuff (ops, pid, 1);
+ do_initial_windows_stuff (this, pid, 1);
target_terminal_ours ();
}
-static void
-windows_detach (struct target_ops *ops, const char *args, int from_tty)
+void
+windows_nat_target::detach (const char *args, int from_tty)
{
int detached = 1;
ptid_t ptid = {-1};
- windows_resume (ops, ptid, 0, GDB_SIGNAL_0);
+ resume (ptid, 0, GDB_SIGNAL_0);
if (!DebugActiveProcessStop (current_event.dwProcessId))
{
@@ -1942,7 +1985,7 @@ windows_detach (struct target_ops *ops, const char *args, int from_tty)
inferior_ptid = null_ptid;
detach_inferior (current_event.dwProcessId);
- inf_child_maybe_unpush_target (ops);
+ maybe_unpush_target ();
}
/* Try to determine the executable filename.
@@ -1999,8 +2042,8 @@ windows_get_exec_module_filename (char *exe_name_ret, size_t exe_name_max_len)
/* The pid_to_exec_file target_ops method for this platform. */
-static char *
-windows_pid_to_exec_file (struct target_ops *self, int pid)
+char *
+windows_nat_target::pid_to_exec_file (int pid)
{
static char path[__PMAX];
#ifdef __CYGWIN__
@@ -2027,8 +2070,8 @@ windows_pid_to_exec_file (struct target_ops *self, int pid)
/* Print status information about what we're accessing. */
-static void
-windows_files_info (struct target_ops *ignore)
+void
+windows_nat_target::files_info ()
{
struct inferior *inf = current_inferior ();
@@ -2121,9 +2164,9 @@ clear_win32_environment (char **env)
ALLARGS is a string containing the arguments to the program.
ENV is the environment vector to pass. Errors reported with error(). */
-static void
-windows_create_inferior (struct target_ops *ops, char *exec_file,
- char *allargs, char **in_env, int from_tty)
+void
+windows_nat_target::create_inferior (char *exec_file, char *allargs,
+ char **in_env, int from_tty)
{
STARTUPINFO si;
#ifdef __CYGWIN__
@@ -2380,13 +2423,13 @@ windows_create_inferior (struct target_ops *ops, char *exec_file,
else
saw_create = 0;
- do_initial_windows_stuff (ops, pi.dwProcessId, 0);
+ do_initial_windows_stuff (this, pi.dwProcessId, 0);
/* windows_continue (DBG_CONTINUE, -1, 0); */
}
-static void
-windows_mourn_inferior (struct target_ops *ops)
+void
+windows_nat_target::mourn_inferior ()
{
(void) windows_continue (DBG_CONTINUE, -1, 0);
x86_cleanup_dregs();
@@ -2395,14 +2438,14 @@ windows_mourn_inferior (struct target_ops *ops)
CHECK (CloseHandle (current_process_handle));
open_process_used = 0;
}
- inf_child_mourn_inferior (ops);
+ inf_child_target::mourn_inferior ();
}
/* Send a SIGINT to the process group. This acts just like the user typed a
^C on the controlling terminal. */
-static void
-windows_interrupt (struct target_ops *self, ptid_t ptid)
+void
+windows_nat_target::interrupt (ptid_t ptid)
{
DEBUG_EVENTS (("gdb: GenerateConsoleCtrlEvent (CTRLC_EVENT, 0)\n"));
CHECK (GenerateConsoleCtrlEvent (CTRL_C_EVENT, current_event.dwProcessId));
@@ -2449,8 +2492,8 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
return success ? TARGET_XFER_OK : TARGET_XFER_E_IO;
}
-static void
-windows_kill_inferior (struct target_ops *ops)
+void
+windows_nat_target::kill ()
{
CHECK (TerminateProcess (current_process_handle, 0));
@@ -2467,16 +2510,16 @@ windows_kill_inferior (struct target_ops *ops)
target_mourn_inferior (); /* Or just windows_mourn_inferior? */
}
-static void
-windows_close (struct target_ops *self)
+void
+windows_nat_target::close ()
{
DEBUG_EVENTS (("gdb: windows_close, inferior_ptid=%d\n",
ptid_get_pid (inferior_ptid)));
}
/* Convert pid to printable format. */
-static char *
-windows_pid_to_str (struct target_ops *ops, ptid_t ptid)
+char *
+windows_nat_target::pid_to_str (ptid_t ptid)
{
static char buf[80];
@@ -2529,11 +2572,11 @@ windows_xfer_shared_libraries (struct target_ops *ops,
return len != 0 ? TARGET_XFER_OK : TARGET_XFER_EOF;
}
-static enum target_xfer_status
-windows_xfer_partial (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+enum target_xfer_status
+windows_nat_target::xfer_partial (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
@@ -2541,22 +2584,21 @@ windows_xfer_partial (struct target_ops *ops, enum target_object object,
return windows_xfer_memory (readbuf, writebuf, offset, len, xfered_len);
case TARGET_OBJECT_LIBRARIES:
- return windows_xfer_shared_libraries (ops, object, annex, readbuf,
+ return windows_xfer_shared_libraries (this, object, annex, readbuf,
writebuf, offset, len, xfered_len);
default:
- return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
+ return beneath->xfer_partial (object, annex,
+ readbuf, writebuf, offset, len,
+ xfered_len);
}
}
/* Provide thread local base, i.e. Thread Information Block address.
Returns 1 if ptid is found and sets *ADDR to thread_local_base. */
-static int
-windows_get_tib_address (struct target_ops *self,
- ptid_t ptid, CORE_ADDR *addr)
+int
+windows_nat_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
{
windows_thread_info *th;
@@ -2570,48 +2612,20 @@ windows_get_tib_address (struct target_ops *self,
return 1;
}
-static ptid_t
-windows_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
+ptid_t
+windows_nat_target::get_ada_task_ptid (long lwp, long thread)
{
return ptid_build (ptid_get_pid (inferior_ptid), 0, lwp);
}
/* Implementation of the to_thread_name method. */
-static const char *
-windows_thread_name (struct target_ops *self, struct thread_info *thr)
+const char *
+windows_nat_target::thread_name (struct thread_info *thr)
{
return thread_rec (ptid_get_tid (thr->ptid), 0)->name;
}
-static struct target_ops *
-windows_target (void)
-{
- struct target_ops *t = inf_child_target ();
-
- t->to_close = windows_close;
- t->to_attach = windows_attach;
- t->to_attach_no_wait = 1;
- t->to_detach = windows_detach;
- t->to_resume = windows_resume;
- t->to_wait = windows_wait;
- t->to_fetch_registers = windows_fetch_inferior_registers;
- t->to_store_registers = windows_store_inferior_registers;
- t->to_xfer_partial = windows_xfer_partial;
- t->to_files_info = windows_files_info;
- t->to_kill = windows_kill_inferior;
- t->to_create_inferior = windows_create_inferior;
- t->to_mourn_inferior = windows_mourn_inferior;
- t->to_thread_alive = windows_thread_alive;
- t->to_pid_to_str = windows_pid_to_str;
- t->to_interrupt = windows_interrupt;
- t->to_pid_to_exec_file = windows_pid_to_exec_file;
- t->to_get_ada_task_ptid = windows_get_ada_task_ptid;
- t->to_get_tib_address = windows_get_tib_address;
- t->to_thread_name = windows_thread_name;
-
- return t;
-}
/* -Wmissing-prototypes */
extern initialize_file_ftype _initialize_windows_nat;
@@ -2621,9 +2635,7 @@ _initialize_windows_nat (void)
{
struct target_ops *t;
- t = windows_target ();
-
- x86_use_watchpoints (t);
+ t = new windows_nat_target ();
x86_dr_low.set_control = cygwin_set_dr7;
x86_dr_low.set_addr = cygwin_set_dr;
@@ -2772,8 +2784,9 @@ cygwin_get_dr7 (void)
/* Determine if the thread referenced by "ptid" is alive
by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0
it means that the thread has died. Otherwise it is assumed to be alive. */
-static int
-windows_thread_alive (struct target_ops *ops, ptid_t ptid)
+
+int
+windows_nat_target::thread_alive (ptid_t ptid)
{
int tid;
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 810607a39fc..113cbecb1bc 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -327,7 +327,7 @@ display_one_tib (ptid_t ptid)
return -1;
}
- if (target_read (&current_target, TARGET_OBJECT_MEMORY,
+ if (target_read (target_stack, TARGET_OBJECT_MEMORY,
NULL, tib, thread_local_base, tib_size) != tib_size)
{
printf_filtered (_("Unable to read thread information "
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index fef36f7ffa6..b771af5910b 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -27,7 +27,6 @@
#include <sys/uio.h>
#include "x86-nat.h"
-#include "linux-nat.h"
#ifndef __x86_64__
#include "i386-linux-nat.h"
#endif
@@ -88,14 +87,15 @@ x86_linux_new_fork (struct lwp_info *parent, pid_t child_pid)
}
-static void (*super_post_startup_inferior) (struct target_ops *self,
- ptid_t ptid);
+x86_linux_nat_target::~x86_linux_nat_target ()
+{
+}
-static void
-x86_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid)
+void
+x86_linux_nat_target::post_startup_inferior (ptid_t ptid)
{
x86_cleanup_dregs ();
- super_post_startup_inferior (self, ptid);
+ linux_nat_target::post_startup_inferior (ptid);
}
#ifdef __x86_64__
@@ -112,8 +112,8 @@ x86_linux_child_post_startup_inferior (struct target_ops *self, ptid_t ptid)
/* Get Linux/x86 target description from running target. */
-static const struct target_desc *
-x86_linux_read_description (struct target_ops *ops)
+const struct target_desc *
+x86_linux_nat_target::read_description ()
{
int tid;
int is_64bit = 0;
@@ -255,11 +255,17 @@ x86_linux_read_description (struct target_ops *ops)
}
+int
+x86_linux_nat_target::supports_btrace (enum btrace_format format)
+{
+ return linux_supports_btrace (this, format);
+}
+
/* Enable branch tracing. */
-static struct btrace_target_info *
-x86_linux_enable_btrace (struct target_ops *self, ptid_t ptid,
- const struct btrace_config *conf)
+struct btrace_target_info *
+x86_linux_nat_target::enable_btrace (ptid_t ptid,
+ const struct btrace_config *conf)
{
struct btrace_target_info *tinfo;
@@ -275,9 +281,8 @@ x86_linux_enable_btrace (struct target_ops *self, ptid_t ptid,
/* Disable branch tracing. */
-static void
-x86_linux_disable_btrace (struct target_ops *self,
- struct btrace_target_info *tinfo)
+void
+x86_linux_nat_target::disable_btrace (struct btrace_target_info *tinfo)
{
enum btrace_error errcode = linux_disable_btrace (tinfo);
@@ -287,28 +292,25 @@ x86_linux_disable_btrace (struct target_ops *self,
/* Teardown branch tracing. */
-static void
-x86_linux_teardown_btrace (struct target_ops *self,
- struct btrace_target_info *tinfo)
+void
+x86_linux_nat_target::teardown_btrace (struct btrace_target_info *tinfo)
{
/* Ignore errors. */
linux_disable_btrace (tinfo);
}
-static enum btrace_error
-x86_linux_read_btrace (struct target_ops *self,
- struct btrace_data *data,
- struct btrace_target_info *btinfo,
- enum btrace_read_type type)
+enum btrace_error
+x86_linux_nat_target::read_btrace (struct btrace_data *data,
+ struct btrace_target_info *btinfo,
+ enum btrace_read_type type)
{
return linux_read_btrace (data, btinfo, type);
}
/* See to_btrace_conf in target.h. */
-static const struct btrace_config *
-x86_linux_btrace_conf (struct target_ops *self,
- const struct btrace_target_info *btinfo)
+const struct btrace_config *
+x86_linux_nat_target::btrace_conf (const struct btrace_target_info *btinfo)
{
return linux_btrace_conf (btinfo);
}
@@ -357,16 +359,12 @@ x86_linux_get_thread_area (pid_t pid, void *addr, unsigned int *base_addr)
}
-/* Create an x86 GNU/Linux target. */
+/* Add an x86 GNU/Linux target. */
-struct target_ops *
-x86_linux_create_target (void)
+void
+x86_linux_add_target (linux_nat_target *t)
{
- /* Fill in the generic GNU/Linux methods. */
- struct target_ops *t = linux_target ();
-
/* Initialize the debug register function vectors. */
- x86_use_watchpoints (t);
x86_dr_low.set_control = x86_linux_dr_set_control;
x86_dr_low.set_addr = x86_linux_dr_set_addr;
x86_dr_low.get_addr = x86_linux_dr_get_addr;
@@ -374,30 +372,10 @@ x86_linux_create_target (void)
x86_dr_low.get_control = x86_linux_dr_get_control;
x86_set_debug_register_length (sizeof (void *));
- /* Override the GNU/Linux inferior startup hook. */
- super_post_startup_inferior = t->to_post_startup_inferior;
- t->to_post_startup_inferior = x86_linux_child_post_startup_inferior;
-
- /* Add the description reader. */
- t->to_read_description = x86_linux_read_description;
-
- /* Add btrace methods. */
- t->to_supports_btrace = linux_supports_btrace;
- t->to_enable_btrace = x86_linux_enable_btrace;
- t->to_disable_btrace = x86_linux_disable_btrace;
- t->to_teardown_btrace = x86_linux_teardown_btrace;
- t->to_read_btrace = x86_linux_read_btrace;
- t->to_btrace_conf = x86_linux_btrace_conf;
-
- return t;
-}
-
-/* Add an x86 GNU/Linux target. */
-
-void
-x86_linux_add_target (struct target_ops *t)
-{
- linux_nat_add_target (t);
+ add_target (t);
+ /* XXXX Once these are converted to virtual methods in
+ linux_nat_target, this whole function can be converted to an
+ _initialize routine. */
linux_nat_set_new_thread (t, x86_linux_new_thread);
linux_nat_set_new_fork (t, x86_linux_new_fork);
linux_nat_set_forget_process (t, x86_forget_process);
diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h
index cbb19ac4c03..4b9a3b82816 100644
--- a/gdb/x86-linux-nat.h
+++ b/gdb/x86-linux-nat.h
@@ -20,6 +20,48 @@
#ifndef X86_LINUX_NAT_H
#define X86_LINUX_NAT_H 1
+#include "linux-nat.h"
+#include "x86-nat.h"
+
+struct x86_linux_nat_target : public x86_nat_target<linux_nat_target>
+{
+ virtual ~x86_linux_nat_target () OVERRIDE = 0;
+
+ /* Override the GNU/Linux inferior startup hook. */
+ void post_startup_inferior (ptid_t) OVERRIDE;
+
+ /* Add the description reader. */
+ const struct target_desc *read_description () OVERRIDE;
+
+ /* Add btrace methods. */
+ int supports_btrace (enum btrace_format format) OVERRIDE;
+
+ struct btrace_target_info *enable_btrace (ptid_t ptid,
+ const struct btrace_config *conf) OVERRIDE;
+ void disable_btrace (struct btrace_target_info *tinfo) OVERRIDE;
+ void teardown_btrace (struct btrace_target_info *tinfo) OVERRIDE;
+ enum btrace_error read_btrace (struct btrace_data *data,
+ struct btrace_target_info *btinfo,
+ enum btrace_read_type type) OVERRIDE;
+ const struct btrace_config *btrace_conf (const struct btrace_target_info *) OVERRIDE;
+
+ /* These two are rewired to low_ versions. linux-nat.c queries
+ stopped-by-watchpoint info as soon as an lwp stops (via the low_
+ methods) and caches the result, to be returned via the normal
+ non-low methods. */
+ int stopped_by_watchpoint () OVERRIDE
+ { return linux_nat_target::stopped_by_watchpoint (); }
+
+ int stopped_data_address (CORE_ADDR *addr_p) OVERRIDE
+ { return linux_nat_target::stopped_data_address (addr_p); }
+
+ int low_stopped_by_watchpoint () OVERRIDE
+ { return x86_nat_target::stopped_by_watchpoint (); }
+
+ int low_stopped_data_address (CORE_ADDR *addr_p) OVERRIDE
+ { return x86_nat_target::stopped_data_address (addr_p); }
+};
+
/* Helper for ps_get_thread_area. Sets BASE_ADDR to a pointer to
@@ -30,12 +72,8 @@ extern ps_err_e x86_linux_get_thread_area (pid_t pid, void *addr,
unsigned int *base_addr);
-/* Create an x86 GNU/Linux target. */
-
-extern struct target_ops *x86_linux_create_target (void);
-
/* Add an x86 GNU/Linux target. */
-extern void x86_linux_add_target (struct target_ops *t);
+extern void x86_linux_add_target (linux_nat_target *t);
#endif
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index b0315e2eafd..3df67e4128a 100644
--- a/gdb/x86-nat.c
+++ b/gdb/x86-nat.c
@@ -146,8 +146,8 @@ x86_cleanup_dregs (void)
address ADDR and whose length is LEN bytes. Watch memory accesses
of the type TYPE. Return 0 on success, -1 on failure. */
-static int
-x86_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
+int
+x86_insert_watchpoint (CORE_ADDR addr, int len,
enum target_hw_bp_type type, struct expression *cond)
{
struct x86_debug_reg_state *state
@@ -159,8 +159,8 @@ x86_insert_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
/* Remove a watchpoint that watched the memory region which starts at
address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */
-static int
-x86_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
+int
+x86_remove_watchpoint (CORE_ADDR addr, int len,
enum target_hw_bp_type type, struct expression *cond)
{
struct x86_debug_reg_state *state
@@ -172,9 +172,8 @@ x86_remove_watchpoint (struct target_ops *self, CORE_ADDR addr, int len,
/* Return non-zero if we can watch a memory region that starts at
address ADDR and whose length is LEN bytes. */
-static int
-x86_region_ok_for_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len)
+int
+x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -186,8 +185,8 @@ x86_region_ok_for_watchpoint (struct target_ops *self,
address associated with that break/watchpoint and return non-zero.
Otherwise, return zero. */
-static int
-x86_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
+int
+x86_stopped_data_address (CORE_ADDR *addr_p)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -198,8 +197,8 @@ x86_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
/* Return non-zero if the inferior has some watchpoint that triggered.
Otherwise return zero. */
-static int
-x86_stopped_by_watchpoint (struct target_ops *ops)
+int
+x86_stopped_by_watchpoint ()
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -210,9 +209,8 @@ x86_stopped_by_watchpoint (struct target_ops *ops)
/* Insert a hardware-assisted breakpoint at BP_TGT->reqstd_address.
Return 0 on success, EBUSY on failure. */
-static int
-x86_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt)
+int
+x86_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
@@ -225,8 +223,8 @@ x86_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
Return 0 on success, -1 on failure. */
-static int
-x86_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
+int
+x86_remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
struct x86_debug_reg_state *state
@@ -253,9 +251,8 @@ x86_remove_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
virtually unlimited number of watchpoints, due to debug register
sharing implemented via reference counts in x86-nat.c. */
-static int
-x86_can_use_hw_breakpoint (struct target_ops *self,
- enum bptype type, int cnt, int othertype)
+int
+x86_can_use_hw_breakpoint (enum bptype type, int cnt, int othertype)
{
return 1;
}
@@ -287,8 +284,8 @@ x86_use_watchpoints (struct target_ops *t)
/* After a watchpoint trap, the PC points to the instruction after the
one that caused the trap. Therefore we don't need to step over it.
But we do need to reset the status register to avoid another trap. */
+#if 0
t->to_have_continuable_watchpoint = 1;
-
t->to_can_use_hw_breakpoint = x86_can_use_hw_breakpoint;
t->to_region_ok_for_hw_watchpoint = x86_region_ok_for_watchpoint;
t->to_stopped_by_watchpoint = x86_stopped_by_watchpoint;
@@ -297,6 +294,7 @@ x86_use_watchpoints (struct target_ops *t)
t->to_remove_watchpoint = x86_remove_watchpoint;
t->to_insert_hw_breakpoint = x86_insert_hw_breakpoint;
t->to_remove_hw_breakpoint = x86_remove_hw_breakpoint;
+#endif
}
void
diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h
index 3e381825df0..d598f676e00 100644
--- a/gdb/x86-nat.h
+++ b/gdb/x86-nat.h
@@ -23,16 +23,12 @@
#ifndef X86_NAT_H
#define X86_NAT_H 1
+#include "breakpoint.h"
#include "nat/x86-dregs.h"
+#include "target.h"
/* Hardware-assisted breakpoints and watchpoints. */
-/* Add watchpoint methods to the provided target_ops.
- Targets using x86 family debug registers for watchpoints should call
- this. */
-struct target_ops;
-extern void x86_use_watchpoints (struct target_ops *);
-
/* Use this function to set x86_dr_low debug_register_length field
rather than setting it directly to check that the length is only
set once. It also enables the 'maint set/show show-debug-regs'
@@ -49,4 +45,62 @@ extern void x86_cleanup_dregs (void);
extern void x86_forget_process (pid_t pid);
+extern int x86_can_use_hw_breakpoint (enum bptype type, int cnt, int othertype);
+extern int x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len);
+extern int x86_stopped_by_watchpoint ();
+extern int x86_stopped_data_address (CORE_ADDR *addr_p);
+extern int x86_insert_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
+ struct expression *cond);
+extern int x86_remove_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
+ struct expression *cond);
+extern int x86_insert_hw_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt);
+extern int x86_remove_hw_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt);
+
+/* Convenience template used to add x86 watchpoints support to a
+ target. */
+
+template <class T>
+struct x86_nat_target : public T
+{
+ /* Hook in the x86 hardware watchpoints/breakpoints support. */
+
+ bool have_continuable_watchpoint () OVERRIDE
+ { return true; }
+
+ int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) OVERRIDE
+ { return x86_can_use_hw_breakpoint (type, cnt, othertype); }
+
+ int region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) OVERRIDE
+ { return x86_region_ok_for_hw_watchpoint (addr, len); }
+
+ int insert_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
+ struct expression *cond) OVERRIDE
+ { return x86_insert_watchpoint (addr, len, type, cond); }
+
+ int remove_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
+ struct expression *cond) OVERRIDE
+ { return x86_remove_watchpoint (addr, len, type, cond); }
+
+ int insert_hw_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt) OVERRIDE
+ { return x86_insert_hw_breakpoint (gdbarch, bp_tgt); }
+
+ int remove_hw_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt) OVERRIDE
+ { return x86_remove_hw_breakpoint (gdbarch, bp_tgt); }
+
+ int stopped_by_watchpoint () OVERRIDE
+ { return x86_stopped_by_watchpoint (); }
+
+ int stopped_data_address (CORE_ADDR *addr_p) OVERRIDE
+ { return x86_stopped_data_address (addr_p); }
+};
+
+
#endif /* X86_NAT_H */