aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/x86-linux-tdesc.c18
-rw-r--r--gdb/nat/x86-linux-tdesc.h5
2 files changed, 10 insertions, 13 deletions
diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c
index 05aa75d..c15a600 100644
--- a/gdb/nat/x86-linux-tdesc.c
+++ b/gdb/nat/x86-linux-tdesc.c
@@ -90,8 +90,13 @@ x86_linux_tdesc_for_tid (int tid, uint64_t *xcr0_storage,
if (ptrace (PTRACE_GETREGSET, tid,
(unsigned int) NT_X86_XSTATE, &iov) < 0)
{
+ /* Can't fetch the xcr0 value so pick a simple default. This
+ default has x87 and sse bits set. These bits are ignored for
+ amd64 and x32 targets, but are checked for on i386. Without
+ these bits being set we generate a completely empty tdesc for
+ i386 which will be rejected by GDB. */
have_ptrace_getregset = TRIBOOL_FALSE;
- *xcr0_storage = 0;
+ *xcr0_storage = X86_XSTATE_SSE_MASK;
}
else
{
@@ -112,15 +117,8 @@ x86_linux_tdesc_for_tid (int tid, uint64_t *xcr0_storage,
}
}
- /* Check the native XCR0 only if PTRACE_GETREGSET is available. If
- PTRACE_GETREGSET is not available then set xcr0_features_bits to
- zero so that the "no-features" descriptions are returned by the
- code below. */
- uint64_t xcr0_features_bits;
- if (have_ptrace_getregset == TRIBOOL_TRUE)
- xcr0_features_bits = *xcr0_storage & X86_XSTATE_ALL_MASK;
- else
- xcr0_features_bits = 0;
+ /* Use cached xcr0 value. */
+ uint64_t xcr0_features_bits = *xcr0_storage & X86_XSTATE_ALL_MASK;
#ifdef __x86_64__
if (is_64bit)
diff --git a/gdb/nat/x86-linux-tdesc.h b/gdb/nat/x86-linux-tdesc.h
index b7a4649..69df930 100644
--- a/gdb/nat/x86-linux-tdesc.h
+++ b/gdb/nat/x86-linux-tdesc.h
@@ -44,8 +44,7 @@ struct x86_xsave_layout;
i386_linux_read_description for cases when nullptr might be
returned. */
-extern const target_desc *
-x86_linux_tdesc_for_tid (int tid, uint64_t *xcr0_storage,
- x86_xsave_layout *xsave_layout_storage);
+extern const target_desc *x86_linux_tdesc_for_tid
+ (int tid, uint64_t *xcr0_storage, x86_xsave_layout *xsave_layout_storage);
#endif /* NAT_X86_LINUX_TDESC_H */