aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-linux-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/i386-linux-nat.c')
-rw-r--r--gdb/i386-linux-nat.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index d1d32e1..b923e65 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -33,11 +33,22 @@
#include "i386-linux-tdep.h"
#include "x86-xstate.h"
-#include "linux-nat.h"
#include "x86-linux-nat.h"
#include "nat/linux-ptrace.h"
#include "inf-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;
+};
+
+static i386_linux_nat_target the_i386_linux_nat_target;
+
/* 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
@@ -446,9 +457,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)
{
pid_t tid;
@@ -478,7 +488,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;
}
@@ -524,9 +534,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)
{
pid_t tid;
@@ -635,9 +644,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;
@@ -706,16 +714,8 @@ i386_linux_resume (struct target_ops *ops,
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 = &the_i386_linux_nat_target;
/* Add the target. */
- x86_linux_add_target (t);
+ x86_linux_add_target (linux_target);
}