+2017-03-17 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * hppa-linux-nat.c (fetch_register, store_register): Use ptid
+ from regcache. Use get_ptrace_pid.
+
2017-03-17 Simon Marchi <simon.marchi@polymtl.ca>
* corelow.c (get_core_register_section): Use ptid from regcache,
#include "inferior.h"
#include "target.h"
#include "linux-nat.h"
+#include "inf-ptrace.h"
#include <sys/procfs.h>
#include "nat/gdb_ptrace.h"
fetch_register (struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- int tid;
+ pid_t tid;
int val;
if (gdbarch_cannot_fetch_register (gdbarch, regno))
return;
}
- /* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (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);
store_register (const struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
- int tid;
+ pid_t tid;
int val;
if (gdbarch_cannot_store_register (gdbarch, regno))
return;
- /* GNU/Linux LWP ID's are process ID's. */
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid); /* Not a threaded program. */
+ tid = get_ptrace_pid (regcache_get_ptid (regcache));
errno = 0;
regcache_raw_collect (regcache, regno, &val);