/* Functions specific to running GDB native on HPPA running GNU/Linux.
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2017 Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "gdbcore.h"
#include "regcache.h"
-#include "gdb_string.h"
#include "inferior.h"
#include "target.h"
#include "linux-nat.h"
+#include "inf-ptrace.h"
#include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
#include <linux/version.h>
#include <asm/ptrace.h>
static void
fetch_register (struct regcache *regcache, int regno)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- int tid;
+ struct gdbarch *gdbarch = regcache->arch ();
+ pid_t tid;
int val;
if (gdbarch_cannot_fetch_register (gdbarch, regno))
return;
}
- /* GNU/Linux LWP ID's are process ID's. */
- tid = TIDGET (inferior_ptid);
- if (tid == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+ tid = get_ptrace_pid (regcache_get_ptid (regcache));
errno = 0;
val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
static void
store_register (const struct regcache *regcache, int regno)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
- int tid;
+ struct gdbarch *gdbarch = regcache->arch ();
+ pid_t tid;
int val;
if (gdbarch_cannot_store_register (gdbarch, regno))
return;
- /* GNU/Linux LWP ID's are process ID's. */
- tid = TIDGET (inferior_ptid);
- if (tid == 0)
- tid = PIDGET (inferior_ptid); /* Not a threaded program. */
+ tid = get_ptrace_pid (regcache_get_ptid (regcache));
errno = 0;
regcache_raw_collect (regcache, regno, &val);
if (-1 == regno)
{
for (regno = 0;
- regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno < gdbarch_num_regs (regcache->arch ());
regno++)
fetch_register (regcache, regno);
}
if (-1 == regno)
{
for (regno = 0;
- regno < gdbarch_num_regs (get_regcache_arch (regcache));
+ regno < gdbarch_num_regs (regcache->arch ());
regno++)
store_register (regcache, regno);
}
}
}
-void _initialize_hppa_linux_nat (void);
-
void
_initialize_hppa_linux_nat (void)
{