diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-02-21 21:44:48 +0100 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-02-25 17:57:28 +0100 |
commit | ae91f6253926e4dadebcae90772f4f5a5bd06056 (patch) | |
tree | e637ff2e0a4e574714b9b389a505fcef72868d5a /gdb/gdbserver/linux-x86-low.c | |
parent | e0471c16c5ac8eddf49daf781248822f4a1ebc58 (diff) | |
download | gdb-ae91f6253926e4dadebcae90772f4f5a5bd06056.zip gdb-ae91f6253926e4dadebcae90772f4f5a5bd06056.tar.gz gdb-ae91f6253926e4dadebcae90772f4f5a5bd06056.tar.bz2 |
[PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
If gdbserver and IPA are using different tdesc, they will disagree
about 'R' trace packet size. This results in mangled traces.
To make sure they pick the same tdesc, gdbserver pokes the tdesc
(specified as an index in a target-specific list) into a global
variable in IPA. In theory, IPA could find out the tdesc on its
own, but that may be complex (in particular, I don't know how to
tell whether we have LAST_BREAK on s390 without messing with ptrace),
and we'd have to duplicate the logic.
Tested on i386 and x86_64. On i386, it fixes two FAILs in ftrace.exp.
On x86_64, these failures have been KFAILed - one of them works now,
but the other now fails due to an unrelated reason (ugh).
gdb/gdbserver/ChangeLog:
PR gdb/13808
* Makefile.in: Add i386-*-linux-ipa.o and amd64-*-linux-ipa.o.
* configure.srv: Ditto.
* linux-aarch64-ipa.c (get_ipa_tdesc): New function.
(initialize_low_tracepoint): Remove ipa_tdesc assignment.
* linux-amd64-ipa.c: Add "linux-x86-tdesc.h" include.
(init_registers_amd64_linux): Remove prototype.
(tdesc_amd64_linux): Remove declaration.
(get_ipa_tdesc): New function.
(initialize_low_tracepoint): Remove ipa_tdesc assignment,
initialize remaining tdescs.
* linux-i386-ipa.c: Add "linux-x86-tdesc.h" include.
(init_registers_i386_linux): Remove prototype.
(tdesc_i386_linux): Remove declaration.
(get_ipa_tdesc): New function.
(initialize_low_tracepoint): Remove ipa_tdesc assignment,
initialize remaining tdescs.
* linux-low.c (linux_get_ipa_tdesc_idx): New function.
(linux_target_ops): wire in linux_get_ipa_tdesc_idx.
* linux-low.h (struct linux_target_ops): Add get_ipa_tdesc_idx.
* linux-x86-low.c: Move tdesc declarations to linux-x86-tdesc.h.
(x86_get_ipa_tdesc_idx): New function.
(the_low_target): Wire in x86_get_ipa_tdesc_idx.
* linux-x86-tdesc.h: New file.
* target.h (struct target_ops): Add get_ipa_tdesc_idx.
(target_get_ipa_tdesc_idx): New macro.
* tracepoint.c (ipa_tdesc_idx): New macro.
(struct ipa_sym_addresses): Add addr_ipa_tdesc_idx.
(symbol_list): Add ipa_tdesc_idx.
(cmd_qtstart): Write ipa_tdesc_idx in the target.
(ipa_tdesc): Remove.
(ipa_tdesc_idx): New variable.
(get_context_regcache): Use get_ipa_tdesc.
(gdb_collect): Ditto.
(gdb_probe): Ditto.
* tracepoint.h (get_ipa_tdesc): New prototype.
(ipa_tdesc): Remove.
gdb/testsuite/ChangeLog:
PR gdb/13808
* gdb.trace/ftrace.exp (test_fast_tracepoints): Remove kfail.
Diffstat (limited to 'gdb/gdbserver/linux-x86-low.c')
-rw-r--r-- | gdb/gdbserver/linux-x86-low.c | 85 |
1 files changed, 34 insertions, 51 deletions
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 0c4954a..feaee92 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -45,57 +45,7 @@ #include "nat/linux-nat.h" #include "nat/x86-linux.h" #include "nat/x86-linux-dregs.h" - -#ifdef __x86_64__ -/* Defined in auto-generated file amd64-linux.c. */ -void init_registers_amd64_linux (void); -extern const struct target_desc *tdesc_amd64_linux; - -/* Defined in auto-generated file amd64-avx-linux.c. */ -void init_registers_amd64_avx_linux (void); -extern const struct target_desc *tdesc_amd64_avx_linux; - -/* Defined in auto-generated file amd64-avx512-linux.c. */ -void init_registers_amd64_avx512_linux (void); -extern const struct target_desc *tdesc_amd64_avx512_linux; - -/* Defined in auto-generated file amd64-mpx-linux.c. */ -void init_registers_amd64_mpx_linux (void); -extern const struct target_desc *tdesc_amd64_mpx_linux; - -/* Defined in auto-generated file x32-linux.c. */ -void init_registers_x32_linux (void); -extern const struct target_desc *tdesc_x32_linux; - -/* Defined in auto-generated file x32-avx-linux.c. */ -void init_registers_x32_avx_linux (void); -extern const struct target_desc *tdesc_x32_avx_linux; - -/* Defined in auto-generated file x32-avx512-linux.c. */ -void init_registers_x32_avx512_linux (void); -extern const struct target_desc *tdesc_x32_avx512_linux; - -#endif - -/* Defined in auto-generated file i386-linux.c. */ -void init_registers_i386_linux (void); -extern const struct target_desc *tdesc_i386_linux; - -/* Defined in auto-generated file i386-mmx-linux.c. */ -void init_registers_i386_mmx_linux (void); -extern const struct target_desc *tdesc_i386_mmx_linux; - -/* Defined in auto-generated file i386-avx-linux.c. */ -void init_registers_i386_avx_linux (void); -extern const struct target_desc *tdesc_i386_avx_linux; - -/* Defined in auto-generated file i386-avx512-linux.c. */ -void init_registers_i386_avx512_linux (void); -extern const struct target_desc *tdesc_i386_avx512_linux; - -/* Defined in auto-generated file i386-mpx-linux.c. */ -void init_registers_i386_mpx_linux (void); -extern const struct target_desc *tdesc_i386_mpx_linux; +#include "linux-x86-tdesc.h" #ifdef __x86_64__ static struct target_desc *tdesc_amd64_linux_no_xml; @@ -2891,6 +2841,38 @@ x86_supports_hardware_single_step (void) return 1; } +static int +x86_get_ipa_tdesc_idx (void) +{ + struct regcache *regcache = get_thread_regcache (current_thread, 0); + const struct target_desc *tdesc = regcache->tdesc; + +#ifdef __x86_64__ + if (tdesc == tdesc_amd64_linux || tdesc == tdesc_amd64_linux_no_xml + || tdesc == tdesc_x32_linux) + return X86_TDESC_SSE; + if (tdesc == tdesc_amd64_avx_linux || tdesc == tdesc_x32_avx_linux) + return X86_TDESC_AVX; + if (tdesc == tdesc_amd64_mpx_linux) + return X86_TDESC_MPX; + if (tdesc == tdesc_amd64_avx512_linux || tdesc == tdesc_x32_avx512_linux) + return X86_TDESC_AVX512; +#endif + + if (tdesc == tdesc_i386_mmx_linux) + return X86_TDESC_MMX; + if (tdesc == tdesc_i386_linux || tdesc == tdesc_i386_linux_no_xml) + return X86_TDESC_SSE; + if (tdesc == tdesc_i386_avx_linux) + return X86_TDESC_AVX; + if (tdesc == tdesc_i386_mpx_linux) + return X86_TDESC_MPX; + if (tdesc == tdesc_i386_avx512_linux) + return X86_TDESC_AVX512; + + return 0; +} + /* This is initialized assuming an amd64 target. x86_arch_setup will correct it for i386 or amd64 targets. */ @@ -2934,6 +2916,7 @@ struct linux_target_ops the_low_target = NULL, /* breakpoint_kind_from_current_state */ x86_supports_hardware_single_step, x86_get_syscall_trapinfo, + x86_get_ipa_tdesc_idx, }; void |