Change inferior thread list to be a thread map
[deliverable/binutils-gdb.git] / gdb / nat / ppc-linux.c
index 76b35740d4cc8457929a1142122d762c2d48a2bf..aa0a8df02155d340c9f1951a1ea5ad9cf51c51d2 100644 (file)
@@ -1,4 +1,4 @@
-/*Copyright (C) 2015 Free Software Foundation, Inc.
+/*Copyright (C) 2015-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -15,8 +15,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "common-defs.h"
+#include "gdbsupport/common-defs.h"
 #include "ppc-linux.h"
+#include "nat/gdb_ptrace.h"
 #include <elf.h>
 
 #ifdef HAVE_GETAUXVAL
@@ -53,7 +54,7 @@ ppc64_host_hwcap (unsigned long *valp)
 #endif /* HAVE_GETAUXVAL */
 }
 
-int
+static inline int
 ppc64_64bit_inferior_p (long msr)
 {
   unsigned long ppc_host_hwcap = 0;
@@ -73,3 +74,22 @@ ppc64_64bit_inferior_p (long msr)
 }
 
 #endif
+
+int
+ppc_linux_target_wordsize (int tid)
+{
+  int wordsize = 4;
+
+  /* Check for 64-bit inferior process.  This is the case when the host is
+     64-bit, and in addition the top bit of the MSR register is set.  */
+#ifdef __powerpc64__
+  long msr;
+
+  errno = 0;
+  msr = (long) ptrace (PTRACE_PEEKUSER, tid, PT_MSR * 8, 0);
+  if (errno == 0 && ppc64_64bit_inferior_p (msr))
+    wordsize = 8;
+#endif
+
+  return wordsize;
+}
This page took 0.026262 seconds and 4 git commands to generate.