2019-02-15 Tom Tromey <tromey@adacore.com>
+ * sparc-ravenscar-thread.c (struct sparc_ravenscar_ops): Derive
+ from ravenscar_arch_ops.
+ (sparc_ravenscar_ops::fetch_registers)
+ (sparc_ravenscar_ops::store_registers): Now methods.
+ (sparc_ravenscar_prepare_to_store): Remove.
+ (sparc_ravenscar_ops): Redefine.
+ * ravenscar-thread.h (struct ravenscar_arch_ops): Add virtual
+ methods and destructor. Remove members.
+ * ravenscar-thread.c (ravenscar_thread_target::fetch_registers)
+ (ravenscar_thread_target::store_registers)
+ (ravenscar_thread_target::prepare_to_store): Update.
+ * ppc-ravenscar-thread.c (ppc_ravenscar_generic_prepare_to_store):
+ Remove.
+ (struct ppc_ravenscar_powerpc_ops): Derive from
+ ravenscar_arch_ops.
+ (ppc_ravenscar_powerpc_ops::fetch_registers)
+ (ppc_ravenscar_powerpc_ops::store_registers): Now methods.
+ (ppc_ravenscar_powerpc_ops): Redefine.
+ (struct ppc_ravenscar_e500_ops): Derive from ravenscar_arch_ops.
+ (ppc_ravenscar_e500_ops::fetch_registers)
+ (ppc_ravenscar_e500_ops::store_registers): Now methods.
+ (ppc_ravenscar_e500_ops): Redefine.
+ * aarch64-ravenscar-thread.c
+ (aarch64_ravenscar_generic_prepare_to_store): Remove.
+ (struct aarch64_ravenscar_ops): Derive from ravenscar_arch_ops.
+ (aarch64_ravenscar_fetch_registers)
+ (aarch64_ravenscar_store_registers): Now methods.
+ (aarch64_ravenscar_ops): Redefine.
+
+2019-02-15 Tom Tromey <tromey@adacore.com>
+
* ravenscar-thread.c (ravenscar_thread_target::stopped_by_sw_breakpoint)
(ravenscar_thread_target::stopped_by_hw_breakpoint)
(ravenscar_thread_target::stopped_by_watchpoint)
}
}
-/* to_prepare_to_store when inferior_ptid is different from the running
- thread. */
-
-static void
-aarch64_ravenscar_generic_prepare_to_store (struct regcache *regcache)
-{
- /* Nothing to do. */
-}
-
/* to_store_registers when inferior_ptid is different from the running
thread. */
ARRAY_SIZE (aarch64_context_offsets),
};
-/* Implement the to_fetch_registers ravenscar_arch_ops method
- for most Aarch64 targets. */
-
-static void
-aarch64_ravenscar_fetch_registers (struct regcache *regcache, int regnum)
+struct aarch64_ravenscar_ops : public ravenscar_arch_ops
{
- aarch64_ravenscar_generic_fetch_registers
- (&aarch64_reg_info, regcache, regnum);
-}
-
-/* Implement the to_store_registers ravenscar_arch_ops method
- for most Aarch64 targets. */
-
-static void
-aarch64_ravenscar_store_registers (struct regcache *regcache, int regnum)
-{
- aarch64_ravenscar_generic_store_registers
- (&aarch64_reg_info, regcache, regnum);
-}
+ void fetch_registers (struct regcache *regcache, int regnum) override
+ {
+ aarch64_ravenscar_generic_fetch_registers
+ (&aarch64_reg_info, regcache, regnum);
+ }
+
+ void store_registers (struct regcache *regcache, int regnum) override
+ {
+ aarch64_ravenscar_generic_store_registers
+ (&aarch64_reg_info, regcache, regnum);
+ }
+};
/* The ravenscar_arch_ops vector for most Aarch64 targets. */
-static struct ravenscar_arch_ops aarch64_ravenscar_ops =
-{
- aarch64_ravenscar_fetch_registers,
- aarch64_ravenscar_store_registers,
- aarch64_ravenscar_generic_prepare_to_store
-};
+static struct aarch64_ravenscar_ops aarch64_ravenscar_ops;
/* Register aarch64_ravenscar_ops in GDBARCH. */
}
}
-/* to_prepare_to_store when inferior_ptid is different from the running
- thread. */
-
-static void
-ppc_ravenscar_generic_prepare_to_store (struct regcache *regcache)
-{
- /* Nothing to do. */
-}
-
/* to_store_registers when inferior_ptid is different from the running
thread. */
ARRAY_SIZE (powerpc_context_offsets),
};
-/* Implement the to_fetch_registers ravenscar_arch_ops method
- for most PowerPC targets. */
+struct ppc_ravenscar_powerpc_ops : public ravenscar_arch_ops
+{
+ void fetch_registers (struct regcache *, int) override;
+ void store_registers (struct regcache *, int) override;
+};
-static void
-ppc_ravenscar_powerpc_fetch_registers (struct regcache *regcache, int regnum)
+void
+ppc_ravenscar_powerpc_ops::fetch_registers (struct regcache *regcache, int regnum)
{
ppc_ravenscar_generic_fetch_registers (&ppc_reg_info, regcache, regnum);
}
-/* Implement the to_store_registers ravenscar_arch_ops method
- for most PowerPC targets. */
-
-static void
-ppc_ravenscar_powerpc_store_registers (struct regcache *regcache, int regnum)
+void
+ppc_ravenscar_powerpc_ops::store_registers (struct regcache *regcache, int regnum)
{
ppc_ravenscar_generic_store_registers (&ppc_reg_info, regcache, regnum);
}
/* The ravenscar_arch_ops vector for most PowerPC targets. */
-static struct ravenscar_arch_ops ppc_ravenscar_powerpc_ops =
-{
- ppc_ravenscar_powerpc_fetch_registers,
- ppc_ravenscar_powerpc_store_registers,
- ppc_ravenscar_generic_prepare_to_store
-};
+static struct ppc_ravenscar_powerpc_ops ppc_ravenscar_powerpc_ops;
/* Register ppc_ravenscar_powerpc_ops in GDBARCH. */
ARRAY_SIZE (e500_context_offsets),
};
-/* Implement the to_fetch_registers ravenscar_arch_ops method
- for E500 targets. */
+struct ppc_ravenscar_e500_ops : public ravenscar_arch_ops
+{
+ void fetch_registers (struct regcache *, int) override;
+ void store_registers (struct regcache *, int) override;
+};
-static void
-ppc_ravenscar_e500_fetch_registers (struct regcache *regcache, int regnum)
+void
+ppc_ravenscar_e500_ops::fetch_registers (struct regcache *regcache, int regnum)
{
ppc_ravenscar_generic_fetch_registers (&e500_reg_info, regcache, regnum);
}
/* Implement the to_store_registers ravenscar_arch_ops method
for E500 targets. */
-static void
-ppc_ravenscar_e500_store_registers (struct regcache *regcache, int regnum)
+void
+ppc_ravenscar_e500_ops::store_registers (struct regcache *regcache, int regnum)
{
ppc_ravenscar_generic_store_registers (&e500_reg_info, regcache, regnum);
}
/* The ravenscar_arch_ops vector for E500 targets. */
-static struct ravenscar_arch_ops ppc_ravenscar_e500_ops =
-{
- ppc_ravenscar_e500_fetch_registers,
- ppc_ravenscar_e500_store_registers,
- ppc_ravenscar_generic_prepare_to_store
-};
+static struct ppc_ravenscar_e500_ops ppc_ravenscar_e500_ops;
/* Register ppc_ravenscar_e500_ops in GDBARCH. */
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
- arch_ops->to_fetch_registers (regcache, regnum);
+ arch_ops->fetch_registers (regcache, regnum);
}
else
beneath ()->fetch_registers (regcache, regnum);
struct ravenscar_arch_ops *arch_ops
= gdbarch_ravenscar_ops (gdbarch);
- arch_ops->to_store_registers (regcache, regnum);
+ arch_ops->store_registers (regcache, regnum);
}
else
beneath ()->store_registers (regcache, regnum);
&& is_ravenscar_task (ptid)
&& !ravenscar_task_is_currently_active (ptid))
{
- struct gdbarch *gdbarch = regcache->arch ();
- struct ravenscar_arch_ops *arch_ops
- = gdbarch_ravenscar_ops (gdbarch);
-
- arch_ops->to_prepare_to_store (regcache);
+ /* Nothing. */
}
else
beneath ()->prepare_to_store (regcache);
struct ravenscar_arch_ops
{
- void (*to_fetch_registers) (struct regcache *, int);
- void (*to_store_registers) (struct regcache *, int);
- void (*to_prepare_to_store) (struct regcache *);
+ virtual ~ravenscar_arch_ops ()
+ {
+ }
+
+ virtual void fetch_registers (struct regcache *, int) = 0;
+ virtual void store_registers (struct regcache *, int) = 0;
};
#endif /* !defined (RAVENSCAR_THREAD_H) */
#include "ravenscar-thread.h"
#include "sparc-ravenscar-thread.h"
-static void sparc_ravenscar_fetch_registers (struct regcache *regcache,
- int regnum);
-static void sparc_ravenscar_store_registers (struct regcache *regcache,
- int regnum);
-static void sparc_ravenscar_prepare_to_store (struct regcache *regcache);
+struct sparc_ravenscar_ops : public ravenscar_arch_ops
+{
+ void fetch_registers (struct regcache *, int) override;
+ void store_registers (struct regcache *, int) override;
+};
/* Register offsets from a referenced address (exempli gratia the
Thread_Descriptor). The referenced address depends on the register
/* to_fetch_registers when inferior_ptid is different from the running
thread. */
-static void
-sparc_ravenscar_fetch_registers (struct regcache *regcache, int regnum)
+void
+sparc_ravenscar_ops::fetch_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
const int sp_regnum = gdbarch_sp_regnum (gdbarch);
}
}
-/* to_prepare_to_store when inferior_ptid is different from the running
- thread. */
-
-static void
-sparc_ravenscar_prepare_to_store (struct regcache *regcache)
-{
- /* Nothing to do. */
-}
-
/* to_store_registers when inferior_ptid is different from the running
thread. */
-static void
-sparc_ravenscar_store_registers (struct regcache *regcache, int regnum)
+void
+sparc_ravenscar_ops::store_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
int buf_size = register_size (gdbarch, regnum);
buf_size);
}
-static struct ravenscar_arch_ops sparc_ravenscar_ops =
-{
- sparc_ravenscar_fetch_registers,
- sparc_ravenscar_store_registers,
- sparc_ravenscar_prepare_to_store
-};
+static struct sparc_ravenscar_ops sparc_ravenscar_ops;
/* Register ravenscar_arch_ops in GDBARCH. */