Merge remote-tracking branch 'origin/master' into amd-common
[deliverable/binutils-gdb.git] / gdb / amd64-linux-nat.c
index 4f1c98a0d1e17125b02d64453230eb6e06989aa5..27748ff9860081f577de143b1b197ab314dc2e4f 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for GNU/Linux x86-64.
 
-   Copyright (C) 2001-2019 Free Software Foundation, Inc.
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
    Contributed by Jiri Smid, SuSE Labs.
 
    This file is part of GDB.
@@ -238,6 +238,12 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
          char xstateregs[X86_XSTATE_MAX_SIZE];
          struct iovec iov;
 
+         /* Pre-4.14 kernels have a bug (fixed by commit 0852b374173b
+            "x86/fpu: Add FPU state copying quirk to handle XRSTOR failure on
+            Intel Skylake CPUs") that sometimes causes the mxcsr location in
+            xstateregs not to be copied by PTRACE_GETREGSET.  Make sure that
+            the location is at least initialized with a defined value.  */
+         memset (xstateregs, 0, sizeof (xstateregs));
          iov.iov_base = xstateregs;
          iov.iov_len = sizeof (xstateregs);
          if (ptrace (PTRACE_GETREGSET, tid,
@@ -377,7 +383,7 @@ ps_err_e
 ps_get_thread_area (struct ps_prochandle *ph,
                     lwpid_t lwpid, int idx, void **base)
 {
-  if (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 32)
+  if (gdbarch_bfd_arch_info (ph->thread->inf->gdbarch)->bits_per_word == 32)
     {
       unsigned int base_addr;
       ps_err_e result;
This page took 0.043028 seconds and 4 git commands to generate.