aboutsummaryrefslogtreecommitdiff
path: root/gdb/x86-linux-nat.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-07-26 12:36:42 +0100
committerYao Qi <yao.qi@linaro.org>2017-07-26 12:36:42 +0100
commit35b4818d03e8d63a926afb235a21c2cb64b14b23 (patch)
treed1a86883987c33bed2ba86552224a97e972f65ec /gdb/x86-linux-nat.c
parent8e2141c6fba6daea1555e042da9de49ec8b1977d (diff)
downloadgdb-35b4818d03e8d63a926afb235a21c2cb64b14b23.zip
gdb-35b4818d03e8d63a926afb235a21c2cb64b14b23.tar.gz
gdb-35b4818d03e8d63a926afb235a21c2cb64b14b23.tar.bz2
Centralize i386 linux target descriptions
This patch moves all the tdesc_i386*_linux target descriptions to a function i386_linux_read_description, which returns the right target description according to xcr0. This also remove the duplication in getting target descriptions in corefile and native target. gdb: 2017-07-26 Yao Qi <yao.qi@linaro.org> * i386-linux-tdep.c (i386_linux_read_description): New function. (i386_linux_core_read_description): Call i386_linux_read_description. * i386-linux-tdep.h (i386_linux_read_description): Declare. (tdesc_i386_linux, tdesc_i386_mmx_linux): Remove declarations. (tdesc_i386_avx_linux, tdesc_i386_mpx_linux): Likewise (tdesc_i386_avx_mpx_linux, tdesc_i386_avx_avx512_linux): Likewise. (tdesc_i386_avx_mpx_avx512_pku_linux): Likewise. * x86-linux-nat.c (x86_linux_read_description): Call i386_linux_read_description.
Diffstat (limited to 'gdb/x86-linux-nat.c')
-rw-r--r--gdb/x86-linux-nat.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 7362282..2c4afb1 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -153,7 +153,7 @@ x86_linux_read_description (struct target_ops *ops)
{
have_ptrace_getfpxregs = 0;
have_ptrace_getregset = TRIBOOL_FALSE;
- return tdesc_i386_mmx_linux;
+ return i386_linux_read_description (X86_XSTATE_X87_MASK);
}
}
#endif
@@ -230,21 +230,13 @@ x86_linux_read_description (struct target_ops *ops)
}
else
{
- switch (xcr0_features_bits)
- {
- case X86_XSTATE_AVX_MPX_AVX512_PKU_MASK:
- return tdesc_i386_avx_mpx_avx512_pku_linux;
- case X86_XSTATE_AVX_AVX512_MASK:
- return tdesc_i386_avx_avx512_linux;
- case X86_XSTATE_MPX_MASK:
- return tdesc_i386_mpx_linux;
- case X86_XSTATE_AVX_MPX_MASK:
- return tdesc_i386_avx_mpx_linux;
- case X86_XSTATE_AVX_MASK:
- return tdesc_i386_avx_linux;
- default:
- return tdesc_i386_linux;
- }
+ const struct target_desc * tdesc
+ = i386_linux_read_description (xcr0_features_bits);
+
+ if (tdesc == NULL)
+ tdesc = i386_linux_read_description (X86_XSTATE_SSE_MASK);
+
+ return tdesc;
}
gdb_assert_not_reached ("failed to return tdesc");