From 69324a74e344e640e0c2d4e76e4e4dfd3368cd76 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 26 Mar 2024 18:52:17 +0000 Subject: Revert "gdb/gdbserver: share x86/linux tdesc caching" This reverts commit 198ff6ff819c240545f9fc68b39636fd376d4ba9. --- gdb/amd64-linux-tdep.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'gdb/amd64-linux-tdep.c') diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index e149034..7e0900d 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -1579,6 +1579,37 @@ amd64_linux_record_signal (struct gdbarch *gdbarch, return 0; } +const target_desc * +amd64_linux_read_description (uint64_t xcr0_features_bit, bool is_x32) +{ + static target_desc *amd64_linux_tdescs \ + [2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/] = {}; + static target_desc *x32_linux_tdescs \ + [2/*AVX*/][2/*AVX512*/][2/*PKRU*/] = {}; + + target_desc **tdesc; + + if (is_x32) + { + tdesc = &x32_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0 ] + [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0]; + } + else + { + tdesc = &amd64_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_MPX) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0] + [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0]; + } + + if (*tdesc == NULL) + *tdesc = amd64_create_target_description (xcr0_features_bit, is_x32, + true, true); + + return *tdesc; +} + /* Get Linux/x86 target description from core dump. */ static const struct target_desc * -- cgit v1.1