Remove some cleanups from search_minsyms_for_name
[deliverable/binutils-gdb.git] / gdb / hppa-linux-nat.c
index cb5a2c6aaa491ed573468363deb8488303d656b0..ddcee03cb4a67ce7a8331d0d4160efaebdeee8a5 100644 (file)
@@ -1,7 +1,6 @@
 /* Functions specific to running GDB native on HPPA running GNU/Linux.
 
-   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2004-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "defs.h"
 #include "gdbcore.h"
 #include "regcache.h"
-#include "gdb_string.h"
 #include "inferior.h"
 #include "target.h"
 #include "linux-nat.h"
+#include "inf-ptrace.h"
 
 #include <sys/procfs.h>
-#include <sys/ptrace.h>
+#include "nat/gdb_ptrace.h"
 #include <linux/version.h>
 
 #include <asm/ptrace.h>
@@ -214,8 +213,8 @@ static const int greg_map[] =
 static void
 fetch_register (struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  int tid;
+  struct gdbarch *gdbarch = regcache->arch ();
+  pid_t tid;
   int val;
 
   if (gdbarch_cannot_fetch_register (gdbarch, regno))
@@ -224,10 +223,7 @@ fetch_register (struct regcache *regcache, int regno)
       return;
     }
 
-  /* GNU/Linux LWP ID's are process ID's.  */
-  tid = TIDGET (inferior_ptid);
-  if (tid == 0)
-    tid = PIDGET (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);
@@ -244,17 +240,14 @@ fetch_register (struct regcache *regcache, int regno)
 static void
 store_register (const struct regcache *regcache, int regno)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  int tid;
+  struct gdbarch *gdbarch = regcache->arch ();
+  pid_t tid;
   int val;
 
   if (gdbarch_cannot_store_register (gdbarch, regno))
     return;
 
-  /* GNU/Linux LWP ID's are process ID's.  */
-  tid = TIDGET (inferior_ptid);
-  if (tid == 0)
-    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
+  tid = get_ptrace_pid (regcache_get_ptid (regcache));
 
   errno = 0;
   regcache_raw_collect (regcache, regno, &val);
@@ -276,7 +269,7 @@ hppa_linux_fetch_inferior_registers (struct target_ops *ops,
   if (-1 == regno)
     {
       for (regno = 0;
-          regno < gdbarch_num_regs (get_regcache_arch (regcache));
+          regno < gdbarch_num_regs (regcache->arch ());
           regno++)
         fetch_register (regcache, regno);
     }
@@ -297,7 +290,7 @@ hppa_linux_store_inferior_registers (struct target_ops *ops,
   if (-1 == regno)
     {
       for (regno = 0;
-          regno < gdbarch_num_regs (get_regcache_arch (regcache));
+          regno < gdbarch_num_regs (regcache->arch ());
           regno++)
        store_register (regcache, regno);
     }
@@ -384,8 +377,6 @@ fill_fpregset (const struct regcache *regcache,
    }
 }
 
-void _initialize_hppa_linux_nat (void);
-
 void
 _initialize_hppa_linux_nat (void)
 {
This page took 0.027723 seconds and 4 git commands to generate.