hppa-linux-nat: Use ptid from regcache instead of inferior_ptid
authorSimon Marchi <simon.marchi@polymtl.ca>
Fri, 17 Mar 2017 17:55:53 +0000 (13:55 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 17 Mar 2017 17:55:53 +0000 (13:55 -0400)
gdb/ChangeLog:

* hppa-linux-nat.c (fetch_register, store_register): Use ptid
from regcache.  Use get_ptrace_pid.

gdb/ChangeLog
gdb/hppa-linux-nat.c

index e4b1e5e091f89297ca80116b4486063d3d5a30c3..cae93e8dd2f03ac254334bc1be69d006eb6b9d0d 100644 (file)
@@ -1,3 +1,8 @@
+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,
index 17d9ced9e5c51535cdfb179500dcd6889828619c..c8eb93c51c00a827d9f0f5859ce9eecc0720ef7c 100644 (file)
@@ -23,6 +23,7 @@
 #include "inferior.h"
 #include "target.h"
 #include "linux-nat.h"
+#include "inf-ptrace.h"
 
 #include <sys/procfs.h>
 #include "nat/gdb_ptrace.h"
@@ -213,7 +214,7 @@ static void
 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))
@@ -222,10 +223,7 @@ fetch_register (struct regcache *regcache, int 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);
@@ -243,16 +241,13 @@ static void
 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);
This page took 0.027157 seconds and 4 git commands to generate.