aboutsummaryrefslogtreecommitdiff
path: root/gdb/amd64-linux-tdep.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-09-05 09:54:54 +0100
committerYao Qi <yao.qi@linaro.org>2017-09-05 09:54:54 +0100
commitb4570e4b3032f9f4a508dbacd8136f79cf42c249 (patch)
tree70fa407b86a0a199898c92bf0dec5bbe7d99c2f2 /gdb/amd64-linux-tdep.c
parent6c73f67f9c545425befde590f06d690a068a69e2 (diff)
downloadgdb-b4570e4b3032f9f4a508dbacd8136f79cf42c249.zip
gdb-b4570e4b3032f9f4a508dbacd8136f79cf42c249.tar.gz
gdb-b4570e4b3032f9f4a508dbacd8136f79cf42c249.tar.bz2
Convert amd64-linux target descriptions
This patch changes amd64-linux target descriptions so that they can be dynamically generated in both GDB and GDBserver. gdb/gdbserver: 2017-09-05 Yao Qi <yao.qi@linaro.org> * Makefile.in (arch-amd64.o): New rule. * configure.srv: Append arch-amd64.o. * linux-amd64-ipa.c: Include common/x86-xstate.h. (get_ipa_tdesc): Call amd64_linux_read_description. (initialize_low_tracepoint): Don't call init_registers_x32_XXX and init_registers_amd64_XXX. * linux-x86-low.c (x86_linux_read_description): Call amd64_linux_read_description. (x86_get_ipa_tdesc_idx): Call amd64_get_ipa_tdesc_idx. (initialize_low_arch): Don't call init_registers_x32_XXX and init_registers_amd64_XXX. * linux-x86-tdesc-selftest.c: Declare init_registers_amd64_XXX and tdesc_amd64_XXX. [__x86_64__] (amd64_tdesc_test): New function. (initialize_low_tdesc) [__x86_64__]: Call init_registers_x32_XXX and init_registers_amd64_XXX. * linux-x86-tdesc.c: Include arch/amd64.h. (xcr0_to_tdesc_idx): New function. (i386_linux_read_description): New function. (amd64_get_ipa_tdesc_idx): New function. * linux-x86-tdesc.h (amd64_get_ipa_tdesc_idx): Declare. (amd64_get_ipa_tdesc): Declare. gdb: 2017-09-05 Yao Qi <yao.qi@linaro.org> * amd64-linux-tdep.c: Include arch/amd64.h. Don't include features/i386/*.c. (amd64_linux_read_description): Call amd64_create_target_description. * arch/amd64.c: New file. * arch/amd64.h: New file. * configure.tgt (x86_64-*-linux*): Append amd64.o. * Makefile.in (ALL_64_TARGET_OBS): Append amd64.o.
Diffstat (limited to 'gdb/amd64-linux-tdep.c')
-rw-r--r--gdb/amd64-linux-tdep.c44
1 files changed, 2 insertions, 42 deletions
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 7afa012..7fbd328 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -39,19 +39,9 @@
#include "solib-svr4.h"
#include "xml-syscall.h"
#include "glibc-tdep.h"
+#include "arch/amd64.h"
#include "target-descriptions.h"
-#include "features/i386/64bit-avx.c"
-#include "features/i386/64bit-avx512.c"
-#include "features/i386/64bit-core.c"
-#include "features/i386/64bit-linux.c"
-#include "features/i386/64bit-mpx.c"
-#include "features/i386/64bit-pkeys.c"
-#include "features/i386/64bit-segments.c"
-#include "features/i386/64bit-sse.c"
-
-#include "features/i386/x32-core.c"
-
/* The syscall's XML filename for i386. */
#define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
@@ -1599,37 +1589,7 @@ amd64_linux_read_description (uint64_t xcr0_features_bit, bool is_x32)
}
if (*tdesc == NULL)
- {
- *tdesc = allocate_target_description ();
-
- set_tdesc_architecture (*tdesc,
- is_x32 ? "i386:x64-32" : "i386:x86-64");
-
- set_tdesc_osabi (*tdesc, osabi_from_tdesc_string ("GNU/Linux"));
-
- long regnum = 0;
-
- if (is_x32)
- regnum = create_feature_i386_x32_core (*tdesc, regnum);
- else
- regnum = create_feature_i386_64bit_core (*tdesc, regnum);
-
- regnum = create_feature_i386_64bit_sse (*tdesc, regnum);
- regnum = create_feature_i386_64bit_linux (*tdesc, regnum);
- regnum = create_feature_i386_64bit_segments (*tdesc, regnum);
-
- if (xcr0_features_bit & X86_XSTATE_AVX)
- regnum = create_feature_i386_64bit_avx (*tdesc, regnum);
-
- if ((xcr0_features_bit & X86_XSTATE_MPX) && !is_x32)
- regnum = create_feature_i386_64bit_mpx (*tdesc, regnum);
-
- if (xcr0_features_bit & X86_XSTATE_AVX512)
- regnum = create_feature_i386_64bit_avx512 (*tdesc, regnum);
-
- if ((xcr0_features_bit & X86_XSTATE_PKRU) && !is_x32)
- regnum = create_feature_i386_64bit_pkeys (*tdesc, regnum);
- }
+ *tdesc = amd64_create_target_description (xcr0_features_bit, is_x32);
return *tdesc;
}