This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] hppa-linux-nat: Use ptid from regcache instead of inferior_ptid


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=00204cf7da01d99205aacc994e5c594ed12bba64

commit 00204cf7da01d99205aacc994e5c594ed12bba64
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Fri Mar 17 13:55:53 2017 -0400

    hppa-linux-nat: Use ptid from regcache instead of inferior_ptid
    
    gdb/ChangeLog:
    
    	* hppa-linux-nat.c (fetch_register, store_register): Use ptid
    	from regcache.  Use get_ptrace_pid.

Diff:
---
 gdb/ChangeLog        |  5 +++++
 gdb/hppa-linux-nat.c | 15 +++++----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e4b1e5e..cae93e8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 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,
 	update doc.
 
diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c
index 17d9ced..c8eb93c 100644
--- a/gdb/hppa-linux-nat.c
+++ b/gdb/hppa-linux-nat.c
@@ -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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]