summaryrefslogtreecommitdiff
path: root/gdb/inf-ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/inf-ptrace.c')
-rw-r--r--gdb/inf-ptrace.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 431a36b8c72..61d24269a81 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -708,7 +708,8 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
CORE_ADDR addr;
size_t size;
PTRACE_TYPE_RET *buf;
- int pid, i;
+ pid_t pid;
+ int i;
/* This isn't really an address, but ptrace thinks of it as one. */
addr = inf_ptrace_register_u_offset (gdbarch, regnum, 0);
@@ -719,11 +720,7 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
return;
}
- /* Cater for systems like GNU/Linux, that implement threads as
- separate processes. */
- pid = ptid_get_lwp (inferior_ptid);
- if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = get_ptrace_pid (regcache_get_ptid (regcache));
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
@@ -769,7 +766,8 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
CORE_ADDR addr;
size_t size;
PTRACE_TYPE_RET *buf;
- int pid, i;
+ pid_t pid;
+ int i;
/* This isn't really an address, but ptrace thinks of it as one. */
addr = inf_ptrace_register_u_offset (gdbarch, regnum, 1);
@@ -777,11 +775,7 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
|| gdbarch_cannot_store_register (gdbarch, regnum))
return;
- /* Cater for systems like GNU/Linux, that implement threads as
- separate processes. */
- pid = ptid_get_lwp (inferior_ptid);
- if (pid == 0)
- pid = ptid_get_pid (inferior_ptid);
+ pid = get_ptrace_pid (regcache_get_ptid (regcache));
size = register_size (gdbarch, regnum);
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);