summaryrefslogtreecommitdiff
path: root/gdb/tilegx-linux-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/tilegx-linux-nat.c')
-rw-r--r--gdb/tilegx-linux-nat.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/gdb/tilegx-linux-nat.c b/gdb/tilegx-linux-nat.c
index c0833cf74bd..5cdf74daf2f 100644
--- a/gdb/tilegx-linux-nat.c
+++ b/gdb/tilegx-linux-nat.c
@@ -22,6 +22,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "linux-nat.h"
+#include "inf-ptrace.h"
#include "nat/gdb_ptrace.h"
@@ -126,11 +127,7 @@ fetch_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
elf_gregset_t regs;
- int tid;
-
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
@@ -146,11 +143,7 @@ store_inferior_registers (struct target_ops *ops,
struct regcache *regcache, int regnum)
{
elf_gregset_t regs;
- int tid;
-
- tid = ptid_get_lwp (inferior_ptid);
- if (tid == 0)
- tid = ptid_get_pid (inferior_ptid);
+ pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) &regs) < 0)
perror_with_name (_("Couldn't get registers"));