/* GNU/Linux on ARM native support.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of GDB.
#include "linux-nat.h"
#include "target-descriptions.h"
#include "auxv.h"
-#include "observer.h"
+#include "observable.h"
#include "gdbthread.h"
#include "arm-tdep.h"
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
/* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
/* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
/* Fetch the general registers. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
int ret, regno, tid;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
int ret, regno, tid;
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
{
gdb_byte regbuf[VFP_REGS_SIZE];
int ret, regno, tid;
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
{
gdb_byte regbuf[VFP_REGS_SIZE];
int ret, regno, tid;
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Get the thread id for the ptrace call. */
- tid = ptid_get_lwp (inferior_ptid);
+ tid = ptid_get_lwp (regcache_get_ptid (regcache));
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
arm_linux_fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (-1 == regno)
{
fetch_regs (regcache);
- fetch_fpregs (regcache);
if (tdep->have_wmmx_registers)
fetch_wmmx_regs (regcache);
if (tdep->vfp_register_count > 0)
fetch_vfp_regs (regcache);
+ if (tdep->have_fpa_registers)
+ fetch_fpregs (regcache);
}
- else
+ else
{
if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM)
fetch_regs (regcache);
fetch_wmmx_regs (regcache);
else if (tdep->vfp_register_count > 0
&& regno >= ARM_D0_REGNUM
- && regno <= ARM_D0_REGNUM + tdep->vfp_register_count)
+ && (regno < ARM_D0_REGNUM + tdep->vfp_register_count
+ || regno == ARM_FPSCR_REGNUM))
fetch_vfp_regs (regcache);
}
}
arm_linux_store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regno)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (-1 == regno)
{
store_regs (regcache);
- store_fpregs (regcache);
if (tdep->have_wmmx_registers)
store_wmmx_regs (regcache);
if (tdep->vfp_register_count > 0)
store_vfp_regs (regcache);
+ if (tdep->have_fpa_registers)
+ store_fpregs (regcache);
}
else
{
store_wmmx_regs (regcache);
else if (tdep->vfp_register_count > 0
&& regno >= ARM_D0_REGNUM
- && regno <= ARM_D0_REGNUM + tdep->vfp_register_count)
+ && (regno < ARM_D0_REGNUM + tdep->vfp_register_count
+ || regno == ARM_FPSCR_REGNUM))
store_vfp_regs (regcache);
}
}
lp->arch_private = info;
}
+/* Function to call when a thread is being deleted. */
+
+static void
+arm_linux_delete_thread (struct arch_lwp_info *arch_lwp)
+{
+ xfree (arch_lwp);
+}
+
/* Called when resuming a thread.
The hardware debug registers are updated when there is any change. */
*child_state = *parent_state;
}
-void _initialize_arm_linux_nat (void);
-
void
_initialize_arm_linux_nat (void)
{
/* Handle thread creation and exit. */
linux_nat_set_new_thread (t, arm_linux_new_thread);
+ linux_nat_set_delete_thread (t, arm_linux_delete_thread);
linux_nat_set_prepare_to_resume (t, arm_linux_prepare_to_resume);
/* Handle process creation and exit. */