Eliminate obstack_printf
[binutils-gdb.git] / gdb / s390-linux-nat.c
index 687502c87c064b430ed13c65311f771e33c30492..90c73c44cd8f83f809a72106179b2931caf3aee5 100644 (file)
@@ -1,5 +1,5 @@
 /* S390 native-dependent code for GDB, the GNU debugger.
-   Copyright (C) 2001-2016 Free Software Foundation, Inc.
+   Copyright (C) 2001-2017 Free Software Foundation, Inc.
 
    Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
    for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@@ -39,6 +39,8 @@
 #include <sys/procfs.h>
 #include <sys/ucontext.h>
 #include <elf.h>
+#include <algorithm>
+#include "inf-ptrace.h"
 
 /* Per-thread arch-specific data.  */
 
@@ -369,7 +371,7 @@ static void
 s390_linux_fetch_inferior_registers (struct target_ops *ops,
                                     struct regcache *regcache, int regnum)
 {
-  int tid = s390_inferior_tid ();
+  pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
 
   if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
     fetch_regs (regcache, tid);
@@ -412,7 +414,7 @@ static void
 s390_linux_store_inferior_registers (struct target_ops *ops,
                                     struct regcache *regcache, int regnum)
 {
-  int tid = s390_inferior_tid ();
+  pid_t tid = get_ptrace_pid (regcache_get_ptid (regcache));
 
   if (regnum == -1 || S390_IS_GREGSET_REGNUM (regnum))
     store_regs (regcache, tid, regnum);