Fix signal-while-stepping-over-bp-other-thread.exp on targets always in non-stop
[deliverable/binutils-gdb.git] / gdb / i386bsd-nat.c
index 4bee1594977916321186e5e925d40f13d725d3a4..ac8a19bb50915505540e46479f59d9356660782e 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for modern i386 BSD's.
 
-   Copyright (C) 2000-2014 Free Software Foundation, Inc.
+   Copyright (C) 2000-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -21,7 +21,6 @@
 #include "inferior.h"
 #include "regcache.h"
 
-#include "gdb_assert.h"
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/ptrace.h>
@@ -82,6 +81,10 @@ static int i386bsd_r_reg_offset[] =
    so that we try PT_GETXMMREGS the first time around.  */
 static int have_ptrace_xmmregs = -1;
 #endif
+
+#ifdef PT_GETXSTATE_INFO
+size_t i386bsd_xsave_len;
+#endif
 \f
 
 /* Supply the general-purpose registers in GREGS, to REGCACHE.  */
@@ -149,7 +152,24 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
       struct fpreg fpregs;
 #ifdef HAVE_PT_GETXMMREGS
       char xmmregs[512];
+#endif
+
+#ifdef PT_GETXSTATE_INFO
+      if (i386bsd_xsave_len != 0)
+       {
+         char *xstateregs;
+
+         xstateregs = alloca (i386bsd_xsave_len);
+         if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid),
+                     (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
+           perror_with_name (_("Couldn't get extended state status"));
 
+         i387_supply_xsave (regcache, -1, xstateregs);
+         return;
+       }
+#endif
+      
+#ifdef HAVE_PT_GETXMMREGS
       if (have_ptrace_xmmregs != 0
          && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid),
                    (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
@@ -159,18 +179,15 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
        }
       else
        {
+         have_ptrace_xmmregs = 0;
+#endif
           if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
                      (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
            perror_with_name (_("Couldn't get floating point status"));
 
          i387_supply_fsave (regcache, -1, &fpregs);
+#ifdef HAVE_PT_GETXMMREGS
        }
-#else
-      if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
-                 (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
-       perror_with_name (_("Couldn't get floating point status"));
-
-      i387_supply_fsave (regcache, -1, &fpregs);
 #endif
     }
 }
@@ -205,7 +222,28 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
       struct fpreg fpregs;
 #ifdef HAVE_PT_GETXMMREGS
       char xmmregs[512];
+#endif
+
+#ifdef PT_GETXSTATE_INFO
+      if (i386bsd_xsave_len != 0)
+       {
+         char *xstateregs;
+
+         xstateregs = alloca (i386bsd_xsave_len);
+         if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid),
+                     (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
+           perror_with_name (_("Couldn't get extended state status"));
 
+         i387_collect_xsave (regcache, -1, xstateregs, 0);
+
+         if (ptrace (PT_SETXSTATE, ptid_get_pid (inferior_ptid),
+                     (PTRACE_TYPE_ARG3) xstateregs, i386bsd_xsave_len) == -1)
+           perror_with_name (_("Couldn't write extended state status"));
+         return;
+       }
+#endif
+
+#ifdef HAVE_PT_GETXMMREGS
       if (have_ptrace_xmmregs != 0
          && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid),
                    (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
This page took 0.024075 seconds and 4 git commands to generate.