diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/amd64-linux-nat.c | 6 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-init-x87-values.exp | 19 |
4 files changed, 34 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 77aab76..ee53e9c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-09-24 Tom de Vries <tdevries@suse.de> + + PR gdb/23815 + * amd64-linux-nat.c (amd64_linux_nat_target::fetch_registers): + Initialize xstateregs before ptrace PTRACE_GETREGSET call. + 2019-09-23 Dimitar Dimitrov <dimitar@dinux.eu> * NEWS: Mention new simulator port for PRU. diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 4f1c98a..d0328b6 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -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, diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 37e323f..706c5da 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-24 Tom de Vries <tdevries@suse.de> + + PR gdb/24598 + * gdb.arch/amd64-init-x87-values.exp: Add xfail. + 2019-09-22 Tom de Vries <tdevries@suse.de> * gdb.base/restore.exp: Allow register variables to be optimized out at diff --git a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp index cdf92dc..5fd18db 100644 --- a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp +++ b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp @@ -116,7 +116,7 @@ proc_with_prefix check_x87_regs_around_init {} { # nop that does not enable any FP features). Finally check that the # mxcsr register still has the value we set. proc_with_prefix check_setting_mxcsr_before_enable {} { - global binfile + global binfile gdb_prompt clean_restart ${binfile} @@ -127,7 +127,22 @@ proc_with_prefix check_setting_mxcsr_before_enable {} { gdb_test_no_output "set \$mxcsr=0x9f80" "set a new value for MXCSR" gdb_test "stepi" "fwait" "step forward one instruction for mxcsr test" - gdb_test "p/x \$mxcsr" " = 0x9f80" "check new value of MXCSR is still in place" + + set test "check new value of MXCSR is still in place" + set pass_pattern " = 0x9f80" + # 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 causes mxcsr not to be copied, in which case we get 0 instead of + # the just saved value. + set xfail_pattern " = 0x0" + gdb_test_multiple "p/x \$mxcsr" $test { + -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" { + pass $test + } + -re "\[\r\n\]*(?:$xfail_pattern)\[\r\n\]+$gdb_prompt $" { + xfail $test + } + } } # Start the test file, all FP features will be disabled. Set new |