* [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
@ 2016-02-21 21:17 Marcin Kościelnicki
2016-02-23 15:19 ` Antoine Tremblay
2016-02-25 13:08 ` Pedro Alves
0 siblings, 2 replies; 10+ messages in thread
From: Marcin Kościelnicki @ 2016-02-21 21:17 UTC (permalink / raw)
To: gdb-patches; +Cc: antoine.tremblay, Marcin Kościelnicki
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.
(write_inferior_integer) Add forward declaration.
(tracepoint_look_up_symbols): 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.
---
I'd appreciate testing on aarch64. Nothing should change there, since
it only has one tdesc, but I could still make some stupid typo.
Antoine: it seems I'm creating more work for you again, sorry :)
gdb/gdbserver/ChangeLog | 41 ++++++++++++++++++
gdb/gdbserver/Makefile.in | 21 ++++++++++
gdb/gdbserver/configure.srv | 4 +-
gdb/gdbserver/linux-aarch64-ipa.c | 7 +++-
gdb/gdbserver/linux-amd64-ipa.c | 22 +++++++++-
gdb/gdbserver/linux-i386-ipa.c | 28 ++++++++++---
gdb/gdbserver/linux-low.c | 10 +++++
gdb/gdbserver/linux-low.h | 3 ++
gdb/gdbserver/linux-x86-low.c | 85 +++++++++++++++-----------------------
gdb/gdbserver/linux-x86-tdesc.h | 85 ++++++++++++++++++++++++++++++++++++++
gdb/gdbserver/target.h | 7 ++++
gdb/gdbserver/tracepoint.c | 29 ++++++++++---
gdb/gdbserver/tracepoint.h | 4 +-
gdb/testsuite/ChangeLog | 5 +++
gdb/testsuite/gdb.trace/ftrace.exp | 1 -
15 files changed, 282 insertions(+), 70 deletions(-)
create mode 100644 gdb/gdbserver/linux-x86-tdesc.h
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 326c769..011d6d0 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,44 @@
+2016-02-21 Marcin KoÅcielnicki <koriakin@0x04.net>
+
+ 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.
+ (write_inferior_integer) Add forward declaration.
+ (tracepoint_look_up_symbols): 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.
+
2016-02-17 Marcin KoÅcielnicki <koriakin@0x04.net>
* linux-s390-low.c (s390_supports_z_point_type): New function.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 1e874e3..257e9bf 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -495,6 +495,18 @@ regcache-ipa.o: regcache.c
i386-linux-ipa.o: i386-linux.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
+i386-mmx-linux-ipa.o: i386-mmx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+i386-avx-linux-ipa.o: i386-avx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+i386-mpx-linux-ipa.o: i386-mpx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+i386-avx512-linux-ipa.o: i386-avx512-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
linux-i386-ipa.o: linux-i386-ipa.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
@@ -504,6 +516,15 @@ linux-amd64-ipa.o: linux-amd64-ipa.c
amd64-linux-ipa.o: amd64-linux.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
+amd64-avx-linux-ipa.o: amd64-avx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+amd64-mpx-linux-ipa.o: amd64-mpx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+amd64-avx512-linux-ipa.o: amd64-avx512-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
linux-aarch64-ipa.o: linux-aarch64-ipa.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index a54b9e7..a89b1d1 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -29,8 +29,8 @@ srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx512-linux.o i386-mp
srv_amd64_regobj="amd64.o amd64-avx.o amd64-avx512.o amd64-mpx.o x32.o x32-avx.o x32-avx512.o"
srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx512-linux.o amd64-mpx-linux.o x32-linux.o x32-avx-linux.o x32-avx512-linux.o"
-ipa_i386_linux_regobj=i386-linux-ipa.o
-ipa_amd64_linux_regobj=amd64-linux-ipa.o
+ipa_i386_linux_regobj="i386-linux-ipa.o i386-avx-linux-ipa.o i386-avx512-linux-ipa.o i386-mpx-linux-ipa.o i386-mmx-linux-ipa.o"
+ipa_amd64_linux_regobj="amd64-linux-ipa.o amd64-avx-linux-ipa.o amd64-avx512-linux-ipa.o amd64-mpx-linux-ipa.o"
srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml i386/32bit-avx512.xml i386/32bit-mpx.xml"
srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml i386/64bit-avx512.xml i386/x32-core.xml i386/64bit-mpx.xml"
diff --git a/gdb/gdbserver/linux-aarch64-ipa.c b/gdb/gdbserver/linux-aarch64-ipa.c
index 758708d..5fee1ca 100644
--- a/gdb/gdbserver/linux-aarch64-ipa.c
+++ b/gdb/gdbserver/linux-aarch64-ipa.c
@@ -143,9 +143,14 @@ gdb_agent_get_raw_reg (const unsigned char *raw_regs, int regnum)
+ aarch64_ft_collect_regmap[regnum] * FT_CR_SIZE);
}
+const struct target_desc *
+get_ipa_tdesc (int idx)
+{
+ return tdesc_aarch64;
+}
+
void
initialize_low_tracepoint (void)
{
init_registers_aarch64 ();
- ipa_tdesc = tdesc_aarch64;
}
diff --git a/gdb/gdbserver/linux-amd64-ipa.c b/gdb/gdbserver/linux-amd64-ipa.c
index 2eeedcd..8fdfc37 100644
--- a/gdb/gdbserver/linux-amd64-ipa.c
+++ b/gdb/gdbserver/linux-amd64-ipa.c
@@ -20,6 +20,7 @@
#include "server.h"
#include "tracepoint.h"
+#include "linux-x86-tdesc.h"
/* Defined in auto-generated file amd64-linux.c. */
void init_registers_amd64_linux (void);
@@ -166,9 +167,28 @@ supply_static_tracepoint_registers (struct regcache *regcache,
#endif /* HAVE_UST */
+const struct target_desc *
+get_ipa_tdesc (int idx)
+{
+ switch (idx) {
+ case X86_TDESC_MMX: /* Should not happen. */
+ case X86_TDESC_SSE:
+ return tdesc_amd64_linux;
+ case X86_TDESC_AVX:
+ return tdesc_amd64_avx_linux;
+ case X86_TDESC_MPX:
+ return tdesc_amd64_mpx_linux;
+ case X86_TDESC_AVX512:
+ default:
+ return tdesc_amd64_avx512_linux;
+ }
+}
+
void
initialize_low_tracepoint (void)
{
init_registers_amd64_linux ();
- ipa_tdesc = tdesc_amd64_linux;
+ init_registers_amd64_avx_linux ();
+ init_registers_amd64_mpx_linux ();
+ init_registers_amd64_avx512_linux ();
}
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdb/gdbserver/linux-i386-ipa.c
index 11dc038..148908d 100644
--- a/gdb/gdbserver/linux-i386-ipa.c
+++ b/gdb/gdbserver/linux-i386-ipa.c
@@ -21,6 +21,7 @@
#include "server.h"
#include <sys/mman.h>
#include "tracepoint.h"
+#include "linux-x86-tdesc.h"
/* GDB register numbers. */
@@ -47,10 +48,6 @@ enum i386_gdb_regnum
#define i386_num_regs 16
-/* Defined in auto-generated file i386-linux.c. */
-void init_registers_i386_linux (void);
-extern const struct target_desc *tdesc_i386_linux;
-
#define FT_CR_EAX 15
#define FT_CR_ECX 14
#define FT_CR_EDX 13
@@ -247,10 +244,31 @@ initialize_fast_tracepoint_trampoline_buffer (void)
}
}
+const struct target_desc *
+get_ipa_tdesc (int idx)
+{
+ switch (idx) {
+ case X86_TDESC_MMX:
+ return tdesc_i386_mmx_linux;
+ case X86_TDESC_SSE:
+ return tdesc_i386_linux;
+ case X86_TDESC_AVX:
+ return tdesc_i386_avx_linux;
+ case X86_TDESC_MPX:
+ return tdesc_i386_mpx_linux;
+ case X86_TDESC_AVX512:
+ default:
+ return tdesc_i386_avx512_linux;
+ }
+}
+
void
initialize_low_tracepoint (void)
{
+ init_registers_i386_mmx_linux ();
init_registers_i386_linux ();
- ipa_tdesc = tdesc_i386_linux;
+ init_registers_i386_avx_linux ();
+ init_registers_i386_mpx_linux ();
+ init_registers_i386_avx512_linux ();
initialize_fast_tracepoint_trampoline_buffer ();
}
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 8b025bd..a142c2c 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6432,6 +6432,15 @@ linux_supports_catch_syscall (void)
}
static int
+linux_get_ipa_tdesc_idx (void)
+{
+ if (the_low_target.get_ipa_tdesc_idx == NULL)
+ return 0;
+
+ return (*the_low_target.get_ipa_tdesc_idx) ();
+}
+
+static int
linux_supports_tracepoints (void)
{
if (*the_low_target.supports_tracepoints == NULL)
@@ -7408,6 +7417,7 @@ static struct target_ops linux_target_ops = {
linux_breakpoint_kind_from_current_state,
linux_supports_software_single_step,
linux_supports_catch_syscall,
+ linux_get_ipa_tdesc_idx,
};
#ifdef HAVE_LINUX_REGSETS
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 4ec8550..d4946c1 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -246,6 +246,9 @@ struct linux_target_ops
due to SYSCALL_SIGTRAP. */
void (*get_syscall_trapinfo) (struct regcache *regcache,
int *sysno, int *sysret);
+
+ /* See target.h. */
+ int (*get_ipa_tdesc_idx) (void);
};
extern struct linux_target_ops the_low_target;
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
diff --git a/gdb/gdbserver/linux-x86-tdesc.h b/gdb/gdbserver/linux-x86-tdesc.h
new file mode 100644
index 0000000..4e172f5
--- /dev/null
+++ b/gdb/gdbserver/linux-x86-tdesc.h
@@ -0,0 +1,85 @@
+/* Low level support for x86 (i386 and x86-64), shared between gdbserver
+ and IPA.
+
+ Copyright (C) 2016 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+enum x86_linux_tdesc {
+ X86_TDESC_MMX = 0,
+ X86_TDESC_SSE = 1,
+ X86_TDESC_AVX = 2,
+ X86_TDESC_MPX = 3,
+ X86_TDESC_AVX512 = 4,
+};
+
+#ifdef __x86_64__
+
+#if defined __LP64__ || !defined IN_PROCESS_AGENT
+/* 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;
+#endif
+
+#if defined __ILP32__ || !defined IN_PROCESS_AGENT
+/* 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
+
+#endif
+
+#if defined __i386__ || !defined IN_PROCESS_AGENT
+/* 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;
+#endif
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 5af2051..4c14c20 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -471,6 +471,9 @@ struct target_ops
/* Return 1 if the target supports catch syscall, 0 (or leave the
callback NULL) otherwise. */
int (*supports_catch_syscall) (void);
+
+ /* Return tdesc index for IPA. */
+ int (*get_ipa_tdesc_idx) (void);
};
extern struct target_ops *the_target;
@@ -550,6 +553,10 @@ int kill_inferior (int);
(the_target->supports_catch_syscall ? \
(*the_target->supports_catch_syscall) () : 0)
+#define target_get_ipa_tdesc_idx() \
+ (the_target->get_ipa_tdesc_idx \
+ ? (*the_target->get_ipa_tdesc_idx) () : 0)
+
#define target_supports_tracepoints() \
(the_target->supports_tracepoints \
? (*the_target->supports_tracepoints) () : 0)
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index e7c18fd..687669e 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -134,6 +134,7 @@ trace_vdebug (const char *fmt, ...)
# define ust_loaded IPA_SYM_EXPORTED_NAME (ust_loaded)
# define helper_thread_id IPA_SYM_EXPORTED_NAME (helper_thread_id)
# define cmd_buf IPA_SYM_EXPORTED_NAME (cmd_buf)
+# define ipa_tdesc_idx IPA_SYM_EXPORTED_NAME (ipa_tdesc_idx)
#endif
#ifndef IN_PROCESS_AGENT
@@ -171,6 +172,7 @@ struct ipa_sym_addresses
CORE_ADDR addr_get_trace_state_variable_value;
CORE_ADDR addr_set_trace_state_variable_value;
CORE_ADDR addr_ust_loaded;
+ CORE_ADDR addr_ipa_tdesc_idx;
};
static struct
@@ -207,11 +209,13 @@ static struct
IPA_SYM(get_trace_state_variable_value),
IPA_SYM(set_trace_state_variable_value),
IPA_SYM(ust_loaded),
+ IPA_SYM(ipa_tdesc_idx),
};
static struct ipa_sym_addresses ipa_sym_addrs;
static int read_inferior_integer (CORE_ADDR symaddr, int *val);
+static int write_inferior_integer (CORE_ADDR symaddr, int val);
/* Returns true if both the in-process agent library and the static
tracepoints libraries are loaded in the inferior, and agent has
@@ -328,6 +332,14 @@ tracepoint_look_up_symbols (void)
}
}
+ /* Tell IPA about the correct tdesc. */
+ if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
+ target_get_ipa_tdesc_idx ()))
+ {
+ internal_error (__FILE__, __LINE__,
+ "Error setting ipa_tdesc_idx variable in lib");
+ }
+
agent_look_up_symbols (NULL);
}
@@ -4694,19 +4706,20 @@ collect_data_at_step (struct tracepoint_hit_ctx *ctx,
#endif
#ifdef IN_PROCESS_AGENT
-/* The target description used by the IPA. Given that the IPA library
- is built for a specific architecture that is loaded into the
- inferior, there only needs to be one such description per
- build. */
-const struct target_desc *ipa_tdesc;
+/* The target description index for IPA. Passed from gdbserver, used
+ to select ipa_tdesc. */
+EXTERN_C_PUSH
+IP_AGENT_EXPORT_VAR int ipa_tdesc_idx;
+EXTERN_C_POP
#endif
static struct regcache *
get_context_regcache (struct tracepoint_hit_ctx *ctx)
{
struct regcache *regcache = NULL;
-
#ifdef IN_PROCESS_AGENT
+ const struct target_desc *ipa_tdesc = get_ipa_tdesc (ipa_tdesc_idx);
+
if (ctx->type == fast_tracepoint)
{
struct fast_tracepoint_ctx *fctx = (struct fast_tracepoint_ctx *) ctx;
@@ -5779,11 +5792,13 @@ IP_AGENT_EXPORT_FUNC void
gdb_collect (struct tracepoint *tpoint, unsigned char *regs)
{
struct fast_tracepoint_ctx ctx;
+ const struct target_desc *ipa_tdesc;
/* Don't do anything until the trace run is completely set up. */
if (!tracing)
return;
+ ipa_tdesc = get_ipa_tdesc (ipa_tdesc_idx);
ctx.base.type = fast_tracepoint;
ctx.regs = regs;
ctx.regcache_initted = 0;
@@ -6629,6 +6644,7 @@ gdb_probe (const struct marker *mdata, void *probe_private,
{
struct tracepoint *tpoint;
struct static_tracepoint_ctx ctx;
+ const struct target_desc *ipa_tdesc;
/* Don't do anything until the trace run is completely set up. */
if (!tracing)
@@ -6637,6 +6653,7 @@ gdb_probe (const struct marker *mdata, void *probe_private,
return;
}
+ ipa_tdesc = get_ipa_tdesc (ipa_tdesc_idx);
ctx.base.type = static_tracepoint;
ctx.regcache_initted = 0;
ctx.regs = regs;
diff --git a/gdb/gdbserver/tracepoint.h b/gdb/gdbserver/tracepoint.h
index cab89cf..e30f4f7 100644
--- a/gdb/gdbserver/tracepoint.h
+++ b/gdb/gdbserver/tracepoint.h
@@ -124,6 +124,7 @@ int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc);
#ifdef IN_PROCESS_AGENT
void initialize_low_tracepoint (void);
+const struct target_desc *get_ipa_tdesc (int idx);
void supply_fast_tracepoint_registers (struct regcache *regcache,
const unsigned char *regs);
void supply_static_tracepoint_registers (struct regcache *regcache,
@@ -131,9 +132,6 @@ void supply_static_tracepoint_registers (struct regcache *regcache,
CORE_ADDR pc);
void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
char *errmsg);
-
-extern const struct target_desc *ipa_tdesc;
-
#else
void stop_tracing (void);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5676cac..733c3ec 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-21 Marcin KoÅcielnicki <koriakin@0x04.net>
+
+ PR gdb/13808
+ * gdb.trace/ftrace.exp (test_fast_tracepoints): Remove kfail.
+
2016-02-18 Iain Buclaw <ibuclaw@gdcproject.org>
* lib/future.exp: Add D support.
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index 15ad7e7..3a94471 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -132,7 +132,6 @@ proc test_fast_tracepoints {} {
gdb_test "tfind pc *set_point" "Found trace frame .*" \
"tfind set_point frame, first time"
- setup_kfail "gdb/13808" "x86_64-*-linux*"
gdb_test "print globvar" " = 1"
gdb_test "tfind pc *set_point" "Found trace frame .*" \
--
2.7.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-21 21:17 [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA Marcin Kościelnicki
@ 2016-02-23 15:19 ` Antoine Tremblay
2016-02-25 13:08 ` Pedro Alves
1 sibling, 0 replies; 10+ messages in thread
From: Antoine Tremblay @ 2016-02-23 15:19 UTC (permalink / raw)
To: Marcin Kościelnicki; +Cc: gdb-patches, antoine.tremblay
Marcin KoÅcielnicki writes:
>
> Antoine: it seems I'm creating more work for you again, sorry :)
On the contrary you're saving me work, thanks :)
Patch LGTM.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-21 21:17 [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA Marcin Kościelnicki
2016-02-23 15:19 ` Antoine Tremblay
@ 2016-02-25 13:08 ` Pedro Alves
2016-02-25 13:39 ` Marcin Kościelnicki
1 sibling, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2016-02-25 13:08 UTC (permalink / raw)
To: Marcin Kościelnicki, gdb-patches; +Cc: antoine.tremblay
On 02/21/2016 09:17 PM, Marcin KoÅcielnicki wrote:
> 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).
Thanks.
I realized this grows each traceframe's size, probably several
times fold on x86, given the size/number of vector registers.
It'd be nice to avoid this.
- One way would be to actually respect the ax's register masks.
- Another way would be to trim recorded regblock sizes up until the
last recordable register in the tdesc. So if when reading back the
traceframe, the regblock is shorter than expected, just treat the
missing registers as unavailable.
BTW, do we print the not-actually-collected-in-fast-tracepoint registers
as <unavailable>, or as zero's?
It'd also be nice to be able to actually collect the now tdesc-accessible
registers, but that runs into the register size problems discussed earlier.
Plus, we probably wouldn't want to _always_ collect everything.
I haven't analyzed the actual traceframe size impact, but I guess we can
consider those orthogonal optimization problems, as without this fix, things
just don't work.
One thing that wasn't super obvious in the patch is why do several different
target descriptions in gdbserver map to a single description in the IPA?
I noticed several new functions with missing entry comment.
> +const struct target_desc *
> +get_ipa_tdesc (int idx)
> +{
> + switch (idx) {
> + case X86_TDESC_MMX: /* Should not happen. */
...
> +const struct target_desc *
> +get_ipa_tdesc (int idx)
> +{
> + switch (idx) {
'{' goes on next line (and then reindent).
> @@ -328,6 +332,14 @@ tracepoint_look_up_symbols (void)
> }
> }
>
> + /* Tell IPA about the correct tdesc. */
> + if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
> + target_get_ipa_tdesc_idx ()))
> + {
> + internal_error (__FILE__, __LINE__,
> + "Error setting ipa_tdesc_idx variable in lib");
> + }
Failure to write to the inferior should never be an internal error.
The inferior might vanish, e.g., because it was SIGKILL'ed from
outside gdbserver.
> +
> agent_look_up_symbols (NULL);
> }
>
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-25 13:08 ` Pedro Alves
@ 2016-02-25 13:39 ` Marcin Kościelnicki
2016-02-25 14:46 ` Pedro Alves
0 siblings, 1 reply; 10+ messages in thread
From: Marcin Kościelnicki @ 2016-02-25 13:39 UTC (permalink / raw)
To: Pedro Alves, gdb-patches; +Cc: antoine.tremblay
On 25/02/16 14:08, Pedro Alves wrote:
> On 02/21/2016 09:17 PM, Marcin KoÅcielnicki wrote:
>> 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).
>
> Thanks.
>
> I realized this grows each traceframe's size, probably several
> times fold on x86, given the size/number of vector registers.
> It'd be nice to avoid this.
>
> - One way would be to actually respect the ax's register masks.
>
> - Another way would be to trim recorded regblock sizes up until the
> last recordable register in the tdesc. So if when reading back the
> traceframe, the regblock is shorter than expected, just treat the
> missing registers as unavailable.
Both of these require changing trace frame format - currently the
regblock size is shared for all tracepoints in file (ie. both trap and
fast tracepoints), but #1 sounds like the way to go.
>
> BTW, do we print the not-actually-collected-in-fast-tracepoint registers
> as <unavailable>, or as zero's?
Zeros - there's no way in the trace frame format to mark them unavailable.
>
> It'd also be nice to be able to actually collect the now tdesc-accessible
> registers, but that runs into the register size problems discussed earlier.
> Plus, we probably wouldn't want to _always_ collect everything.
Well, they do work for trap tracepoints... but yeah.
>
> I haven't analyzed the actual traceframe size impact, but I guess we can
> consider those orthogonal optimization problems, as without this fix, things
> just don't work.
>
> One thing that wasn't super obvious in the patch is why do several different
> target descriptions in gdbserver map to a single description in the IPA?
They're basically the same tdesc's for different ABIs (i386 vs x32 vs
x64). Since IPA is single-ABI, it's not necessary for the enum to
encode the ABI. I'll add a comment to linux-x86-tdesc.h.
>
> I noticed several new functions with missing entry comment.
OK, will fix these.
>
>> +const struct target_desc *
>> +get_ipa_tdesc (int idx)
>> +{
>> + switch (idx) {
>> + case X86_TDESC_MMX: /* Should not happen. */
>
> ...
>
>> +const struct target_desc *
>> +get_ipa_tdesc (int idx)
>> +{
>> + switch (idx) {
>
> '{' goes on next line (and then reindent).
>
>
>
>> @@ -328,6 +332,14 @@ tracepoint_look_up_symbols (void)
>> }
>> }
>>
>> + /* Tell IPA about the correct tdesc. */
>> + if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
>> + target_get_ipa_tdesc_idx ()))
>> + {
>> + internal_error (__FILE__, __LINE__,
>> + "Error setting ipa_tdesc_idx variable in lib");
>> + }
>
> Failure to write to the inferior should never be an internal error.
> The inferior might vanish, e.g., because it was SIGKILL'ed from
> outside gdbserver.
Fair enough. The file is littered with internal errors in such cases
though (I just copied one of them), what should be done for these?
>
>> +
>> agent_look_up_symbols (NULL);
>> }
>>
>
> Thanks,
> Pedro Alves
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-25 13:39 ` Marcin Kościelnicki
@ 2016-02-25 14:46 ` Pedro Alves
2016-02-25 15:39 ` Marcin Kościelnicki
0 siblings, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2016-02-25 14:46 UTC (permalink / raw)
To: Marcin Kościelnicki, gdb-patches; +Cc: antoine.tremblay
On 02/25/2016 01:38 PM, Marcin KoÅcielnicki wrote:
>> Failure to write to the inferior should never be an internal error.
>> The inferior might vanish, e.g., because it was SIGKILL'ed from
>> outside gdbserver.
>
> Fair enough. The file is littered with internal errors in such cases
> though (I just copied one of them),
Indeed. Looks like the younger version of myself hadn't realized
that mistake back then.
> what should be done for these?
Normal error, most probably.
BTW, it looks a bit out of place to write to the IPA
in tracepoint_look_up_symbols. Any reason we don't do this
in cmd_qtstart, where we download all other things?
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-25 14:46 ` Pedro Alves
@ 2016-02-25 15:39 ` Marcin Kościelnicki
2016-02-25 16:46 ` Pedro Alves
2016-03-02 15:50 ` Yao Qi
0 siblings, 2 replies; 10+ messages in thread
From: Marcin Kościelnicki @ 2016-02-25 15:39 UTC (permalink / raw)
To: palves; +Cc: gdb-patches, antoine.tremblay, Marcin Kościelnicki
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.
---
Added fixes as per comments. I've also changed the default branch of
get_ipa_tdesc to raise an internal error, just in case. As for
cmd_qtstart, it seems as a better place indeed, I missed it before.
gdb/gdbserver/ChangeLog | 40 +++++++++++++++++
gdb/gdbserver/Makefile.in | 21 +++++++++
gdb/gdbserver/configure.srv | 4 +-
gdb/gdbserver/linux-aarch64-ipa.c | 11 ++++-
gdb/gdbserver/linux-amd64-ipa.c | 28 +++++++++++-
gdb/gdbserver/linux-i386-ipa.c | 35 ++++++++++++---
gdb/gdbserver/linux-low.c | 10 +++++
gdb/gdbserver/linux-low.h | 3 ++
gdb/gdbserver/linux-x86-low.c | 85 +++++++++++++++---------------------
gdb/gdbserver/linux-x86-tdesc.h | 89 ++++++++++++++++++++++++++++++++++++++
gdb/gdbserver/target.h | 7 +++
gdb/gdbserver/tracepoint.c | 27 +++++++++---
gdb/gdbserver/tracepoint.h | 4 +-
gdb/testsuite/ChangeLog | 5 +++
gdb/testsuite/gdb.trace/ftrace.exp | 1 -
15 files changed, 300 insertions(+), 70 deletions(-)
create mode 100644 gdb/gdbserver/linux-x86-tdesc.h
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 3ec48fa..a9759b7 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,43 @@
+2016-02-25 Marcin KoÅcielnicki <koriakin@0x04.net>
+
+ 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.
+
2016-02-24 Pedro Alves <palves@redhat.com>
* linux-low.c (check_stopped_by_breakpoint): Rename to ...
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 1e874e3..257e9bf 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -495,6 +495,18 @@ regcache-ipa.o: regcache.c
i386-linux-ipa.o: i386-linux.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
+i386-mmx-linux-ipa.o: i386-mmx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+i386-avx-linux-ipa.o: i386-avx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+i386-mpx-linux-ipa.o: i386-mpx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+i386-avx512-linux-ipa.o: i386-avx512-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
linux-i386-ipa.o: linux-i386-ipa.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
@@ -504,6 +516,15 @@ linux-amd64-ipa.o: linux-amd64-ipa.c
amd64-linux-ipa.o: amd64-linux.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
+amd64-avx-linux-ipa.o: amd64-avx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+amd64-mpx-linux-ipa.o: amd64-mpx-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
+amd64-avx512-linux-ipa.o: amd64-avx512-linux.c
+ $(IPAGENT_COMPILE) $<
+ $(POSTCOMPILE)
linux-aarch64-ipa.o: linux-aarch64-ipa.c
$(IPAGENT_COMPILE) $<
$(POSTCOMPILE)
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index a54b9e7..a89b1d1 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -29,8 +29,8 @@ srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx512-linux.o i386-mp
srv_amd64_regobj="amd64.o amd64-avx.o amd64-avx512.o amd64-mpx.o x32.o x32-avx.o x32-avx512.o"
srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx512-linux.o amd64-mpx-linux.o x32-linux.o x32-avx-linux.o x32-avx512-linux.o"
-ipa_i386_linux_regobj=i386-linux-ipa.o
-ipa_amd64_linux_regobj=amd64-linux-ipa.o
+ipa_i386_linux_regobj="i386-linux-ipa.o i386-avx-linux-ipa.o i386-avx512-linux-ipa.o i386-mpx-linux-ipa.o i386-mmx-linux-ipa.o"
+ipa_amd64_linux_regobj="amd64-linux-ipa.o amd64-avx-linux-ipa.o amd64-avx512-linux-ipa.o amd64-mpx-linux-ipa.o"
srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml i386/32bit-avx512.xml i386/32bit-mpx.xml"
srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml i386/64bit-avx512.xml i386/x32-core.xml i386/64bit-mpx.xml"
diff --git a/gdb/gdbserver/linux-aarch64-ipa.c b/gdb/gdbserver/linux-aarch64-ipa.c
index 758708d..f1eaa70 100644
--- a/gdb/gdbserver/linux-aarch64-ipa.c
+++ b/gdb/gdbserver/linux-aarch64-ipa.c
@@ -143,9 +143,18 @@ gdb_agent_get_raw_reg (const unsigned char *raw_regs, int regnum)
+ aarch64_ft_collect_regmap[regnum] * FT_CR_SIZE);
}
+/* Return target_desc to use for IPA, given the tdesc index passed by
+ gdbserver. Index is ignored, since we have only one tdesc
+ at the moment. */
+
+const struct target_desc *
+get_ipa_tdesc (int idx)
+{
+ return tdesc_aarch64;
+}
+
void
initialize_low_tracepoint (void)
{
init_registers_aarch64 ();
- ipa_tdesc = tdesc_aarch64;
}
diff --git a/gdb/gdbserver/linux-amd64-ipa.c b/gdb/gdbserver/linux-amd64-ipa.c
index 2eeedcd..2dca943 100644
--- a/gdb/gdbserver/linux-amd64-ipa.c
+++ b/gdb/gdbserver/linux-amd64-ipa.c
@@ -20,6 +20,7 @@
#include "server.h"
#include "tracepoint.h"
+#include "linux-x86-tdesc.h"
/* Defined in auto-generated file amd64-linux.c. */
void init_registers_amd64_linux (void);
@@ -166,9 +167,34 @@ supply_static_tracepoint_registers (struct regcache *regcache,
#endif /* HAVE_UST */
+/* Return target_desc to use for IPA, given the tdesc index passed by
+ gdbserver. */
+
+const struct target_desc *
+get_ipa_tdesc (int idx)
+{
+ switch (idx)
+ {
+ case X86_TDESC_SSE:
+ return tdesc_amd64_linux;
+ case X86_TDESC_AVX:
+ return tdesc_amd64_avx_linux;
+ case X86_TDESC_MPX:
+ return tdesc_amd64_mpx_linux;
+ case X86_TDESC_AVX512:
+ return tdesc_amd64_avx512_linux;
+ default:
+ internal_error (__FILE__, __LINE__,
+ "unknown ipa tdesc index: %d", idx);
+ return tdesc_amd64_linux;
+ }
+}
+
void
initialize_low_tracepoint (void)
{
init_registers_amd64_linux ();
- ipa_tdesc = tdesc_amd64_linux;
+ init_registers_amd64_avx_linux ();
+ init_registers_amd64_mpx_linux ();
+ init_registers_amd64_avx512_linux ();
}
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdb/gdbserver/linux-i386-ipa.c
index 11dc038..4860012 100644
--- a/gdb/gdbserver/linux-i386-ipa.c
+++ b/gdb/gdbserver/linux-i386-ipa.c
@@ -21,6 +21,7 @@
#include "server.h"
#include <sys/mman.h>
#include "tracepoint.h"
+#include "linux-x86-tdesc.h"
/* GDB register numbers. */
@@ -47,10 +48,6 @@ enum i386_gdb_regnum
#define i386_num_regs 16
-/* Defined in auto-generated file i386-linux.c. */
-void init_registers_i386_linux (void);
-extern const struct target_desc *tdesc_i386_linux;
-
#define FT_CR_EAX 15
#define FT_CR_ECX 14
#define FT_CR_EDX 13
@@ -247,10 +244,38 @@ initialize_fast_tracepoint_trampoline_buffer (void)
}
}
+/* Return target_desc to use for IPA, given the tdesc index passed by
+ gdbserver. */
+
+const struct target_desc *
+get_ipa_tdesc (int idx)
+{
+ switch (idx)
+ {
+ case X86_TDESC_MMX:
+ return tdesc_i386_mmx_linux;
+ case X86_TDESC_SSE:
+ return tdesc_i386_linux;
+ case X86_TDESC_AVX:
+ return tdesc_i386_avx_linux;
+ case X86_TDESC_MPX:
+ return tdesc_i386_mpx_linux;
+ case X86_TDESC_AVX512:
+ return tdesc_i386_avx512_linux;
+ default:
+ internal_error (__FILE__, __LINE__,
+ "unknown ipa tdesc index: %d", idx);
+ return tdesc_i386_linux;
+ }
+}
+
void
initialize_low_tracepoint (void)
{
+ init_registers_i386_mmx_linux ();
init_registers_i386_linux ();
- ipa_tdesc = tdesc_i386_linux;
+ init_registers_i386_avx_linux ();
+ init_registers_i386_mpx_linux ();
+ init_registers_i386_avx512_linux ();
initialize_fast_tracepoint_trampoline_buffer ();
}
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 5e7560f..983b2d1 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -6406,6 +6406,15 @@ linux_supports_catch_syscall (void)
}
static int
+linux_get_ipa_tdesc_idx (void)
+{
+ if (the_low_target.get_ipa_tdesc_idx == NULL)
+ return 0;
+
+ return (*the_low_target.get_ipa_tdesc_idx) ();
+}
+
+static int
linux_supports_tracepoints (void)
{
if (*the_low_target.supports_tracepoints == NULL)
@@ -7382,6 +7391,7 @@ static struct target_ops linux_target_ops = {
linux_breakpoint_kind_from_current_state,
linux_supports_software_single_step,
linux_supports_catch_syscall,
+ linux_get_ipa_tdesc_idx,
};
#ifdef HAVE_LINUX_REGSETS
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 4ec8550..d4946c1 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -246,6 +246,9 @@ struct linux_target_ops
due to SYSCALL_SIGTRAP. */
void (*get_syscall_trapinfo) (struct regcache *regcache,
int *sysno, int *sysret);
+
+ /* See target.h. */
+ int (*get_ipa_tdesc_idx) (void);
};
extern struct linux_target_ops the_low_target;
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
diff --git a/gdb/gdbserver/linux-x86-tdesc.h b/gdb/gdbserver/linux-x86-tdesc.h
new file mode 100644
index 0000000..33fdc27
--- /dev/null
+++ b/gdb/gdbserver/linux-x86-tdesc.h
@@ -0,0 +1,89 @@
+/* Low level support for x86 (i386 and x86-64), shared between gdbserver
+ and IPA.
+
+ Copyright (C) 2016 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Note: since IPA obviously knows what ABI it's running on (i386 vs x86_64
+ vs x32), it's sufficient to pass only the register set here. This,
+ together with the ABI known at IPA compile time, maps to a tdesc. */
+
+enum x86_linux_tdesc {
+ X86_TDESC_MMX = 0,
+ X86_TDESC_SSE = 1,
+ X86_TDESC_AVX = 2,
+ X86_TDESC_MPX = 3,
+ X86_TDESC_AVX512 = 4,
+};
+
+#ifdef __x86_64__
+
+#if defined __LP64__ || !defined IN_PROCESS_AGENT
+/* 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;
+#endif
+
+#if defined __ILP32__ || !defined IN_PROCESS_AGENT
+/* 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
+
+#endif
+
+#if defined __i386__ || !defined IN_PROCESS_AGENT
+/* 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;
+#endif
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 5af2051..4c14c20 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -471,6 +471,9 @@ struct target_ops
/* Return 1 if the target supports catch syscall, 0 (or leave the
callback NULL) otherwise. */
int (*supports_catch_syscall) (void);
+
+ /* Return tdesc index for IPA. */
+ int (*get_ipa_tdesc_idx) (void);
};
extern struct target_ops *the_target;
@@ -550,6 +553,10 @@ int kill_inferior (int);
(the_target->supports_catch_syscall ? \
(*the_target->supports_catch_syscall) () : 0)
+#define target_get_ipa_tdesc_idx() \
+ (the_target->get_ipa_tdesc_idx \
+ ? (*the_target->get_ipa_tdesc_idx) () : 0)
+
#define target_supports_tracepoints() \
(the_target->supports_tracepoints \
? (*the_target->supports_tracepoints) () : 0)
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index e7c18fd..92d7f1f 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -134,6 +134,7 @@ trace_vdebug (const char *fmt, ...)
# define ust_loaded IPA_SYM_EXPORTED_NAME (ust_loaded)
# define helper_thread_id IPA_SYM_EXPORTED_NAME (helper_thread_id)
# define cmd_buf IPA_SYM_EXPORTED_NAME (cmd_buf)
+# define ipa_tdesc_idx IPA_SYM_EXPORTED_NAME (ipa_tdesc_idx)
#endif
#ifndef IN_PROCESS_AGENT
@@ -171,6 +172,7 @@ struct ipa_sym_addresses
CORE_ADDR addr_get_trace_state_variable_value;
CORE_ADDR addr_set_trace_state_variable_value;
CORE_ADDR addr_ust_loaded;
+ CORE_ADDR addr_ipa_tdesc_idx;
};
static struct
@@ -207,6 +209,7 @@ static struct
IPA_SYM(get_trace_state_variable_value),
IPA_SYM(set_trace_state_variable_value),
IPA_SYM(ust_loaded),
+ IPA_SYM(ipa_tdesc_idx),
};
static struct ipa_sym_addresses ipa_sym_addrs;
@@ -3211,6 +3214,13 @@ cmd_qtstart (char *packet)
*packet = '\0';
+ /* Tell IPA about the correct tdesc. */
+ if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
+ target_get_ipa_tdesc_idx ()))
+ {
+ error ("Error setting ipa_tdesc_idx variable in lib");
+ }
+
/* Start out empty. */
if (agent_loaded_p ())
write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, 0);
@@ -4694,19 +4704,20 @@ collect_data_at_step (struct tracepoint_hit_ctx *ctx,
#endif
#ifdef IN_PROCESS_AGENT
-/* The target description used by the IPA. Given that the IPA library
- is built for a specific architecture that is loaded into the
- inferior, there only needs to be one such description per
- build. */
-const struct target_desc *ipa_tdesc;
+/* The target description index for IPA. Passed from gdbserver, used
+ to select ipa_tdesc. */
+EXTERN_C_PUSH
+IP_AGENT_EXPORT_VAR int ipa_tdesc_idx;
+EXTERN_C_POP
#endif
static struct regcache *
get_context_regcache (struct tracepoint_hit_ctx *ctx)
{
struct regcache *regcache = NULL;
-
#ifdef IN_PROCESS_AGENT
+ const struct target_desc *ipa_tdesc = get_ipa_tdesc (ipa_tdesc_idx);
+
if (ctx->type == fast_tracepoint)
{
struct fast_tracepoint_ctx *fctx = (struct fast_tracepoint_ctx *) ctx;
@@ -5779,11 +5790,13 @@ IP_AGENT_EXPORT_FUNC void
gdb_collect (struct tracepoint *tpoint, unsigned char *regs)
{
struct fast_tracepoint_ctx ctx;
+ const struct target_desc *ipa_tdesc;
/* Don't do anything until the trace run is completely set up. */
if (!tracing)
return;
+ ipa_tdesc = get_ipa_tdesc (ipa_tdesc_idx);
ctx.base.type = fast_tracepoint;
ctx.regs = regs;
ctx.regcache_initted = 0;
@@ -6629,6 +6642,7 @@ gdb_probe (const struct marker *mdata, void *probe_private,
{
struct tracepoint *tpoint;
struct static_tracepoint_ctx ctx;
+ const struct target_desc *ipa_tdesc;
/* Don't do anything until the trace run is completely set up. */
if (!tracing)
@@ -6637,6 +6651,7 @@ gdb_probe (const struct marker *mdata, void *probe_private,
return;
}
+ ipa_tdesc = get_ipa_tdesc (ipa_tdesc_idx);
ctx.base.type = static_tracepoint;
ctx.regcache_initted = 0;
ctx.regs = regs;
diff --git a/gdb/gdbserver/tracepoint.h b/gdb/gdbserver/tracepoint.h
index cab89cf..e30f4f7 100644
--- a/gdb/gdbserver/tracepoint.h
+++ b/gdb/gdbserver/tracepoint.h
@@ -124,6 +124,7 @@ int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc);
#ifdef IN_PROCESS_AGENT
void initialize_low_tracepoint (void);
+const struct target_desc *get_ipa_tdesc (int idx);
void supply_fast_tracepoint_registers (struct regcache *regcache,
const unsigned char *regs);
void supply_static_tracepoint_registers (struct regcache *regcache,
@@ -131,9 +132,6 @@ void supply_static_tracepoint_registers (struct regcache *regcache,
CORE_ADDR pc);
void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
char *errmsg);
-
-extern const struct target_desc *ipa_tdesc;
-
#else
void stop_tracing (void);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index b3681f2..556b572 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2016-02-25 Marcin KoÅcielnicki <koriakin@0x04.net>
+ PR gdb/13808
+ * gdb.trace/ftrace.exp (test_fast_tracepoints): Remove kfail.
+
+2016-02-25 Marcin KoÅcielnicki <koriakin@0x04.net>
+
* gdb.trace/ftrace.exp: Remove unnecessary target check.
2016-02-25 Marcin KoÅcielnicki <koriakin@0x04.net>
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index 0cdbd89..a1d4771 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -130,7 +130,6 @@ proc test_fast_tracepoints {} {
gdb_test "tfind pc *set_point" "Found trace frame .*" \
"tfind set_point frame, first time"
- setup_kfail "gdb/13808" "x86_64-*-linux*"
gdb_test "print globvar" " = 1"
gdb_test "tfind pc *set_point" "Found trace frame .*" \
--
2.7.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-25 15:39 ` Marcin Kościelnicki
@ 2016-02-25 16:46 ` Pedro Alves
2016-02-25 16:59 ` Marcin Kościelnicki
2016-03-02 15:50 ` Yao Qi
1 sibling, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2016-02-25 16:46 UTC (permalink / raw)
To: Marcin Kościelnicki; +Cc: gdb-patches, antoine.tremblay
On 02/25/2016 03:39 PM, Marcin KoÅcielnicki wrote:
>
> + /* Tell IPA about the correct tdesc. */
> + if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
> + target_get_ipa_tdesc_idx ()))
> + {
> + error ("Error setting ipa_tdesc_idx variable in lib");
> + }
> +
No {}s for single-line statement.
Otherwise OK.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-25 16:46 ` Pedro Alves
@ 2016-02-25 16:59 ` Marcin Kościelnicki
0 siblings, 0 replies; 10+ messages in thread
From: Marcin Kościelnicki @ 2016-02-25 16:59 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, antoine.tremblay
On 25/02/16 17:46, Pedro Alves wrote:
> On 02/25/2016 03:39 PM, Marcin KoÅcielnicki wrote:
>>
>> + /* Tell IPA about the correct tdesc. */
>> + if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
>> + target_get_ipa_tdesc_idx ()))
>> + {
>> + error ("Error setting ipa_tdesc_idx variable in lib");
>> + }
>> +
>
> No {}s for single-line statement.
>
> Otherwise OK.
>
> Thanks,
> Pedro Alves
>
Thanks, pushed.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA.
2016-02-25 15:39 ` Marcin Kościelnicki
2016-02-25 16:46 ` Pedro Alves
@ 2016-03-02 15:50 ` Yao Qi
2016-03-02 16:21 ` [PATCH] [OBV] gdbserver: Only write ipa_tdesc_idx if agent is actually loaded Marcin Kościelnicki
1 sibling, 1 reply; 10+ messages in thread
From: Yao Qi @ 2016-03-02 15:50 UTC (permalink / raw)
To: Marcin Kościelnicki; +Cc: palves, gdb-patches, antoine.tremblay
Marcin Kościelnicki <koriakin@0x04.net> writes:
Hi Marcin,
> 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).
This patch causes many gdb.trace/ tests regressions, shown by buildbot,
http://gdb-build.sergiodj.net/builders/Debian-i686-native-gdbserver/builds/3005
http://gdb-build.sergiodj.net/builders/Debian-i686-native-gdbserver/builds/3005
can you take a look?
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] [OBV] gdbserver: Only write ipa_tdesc_idx if agent is actually loaded.
2016-03-02 15:50 ` Yao Qi
@ 2016-03-02 16:21 ` Marcin Kościelnicki
0 siblings, 0 replies; 10+ messages in thread
From: Marcin Kościelnicki @ 2016-03-02 16:21 UTC (permalink / raw)
To: qiyaoltc; +Cc: palves, gdb-patches, antoine.tremblay, Marcin Kościelnicki
Fixes rather embarassing gdb.trace regressions.
gdb/gdbserver/ChangeLog:
* tracepoint.c (cmd_qtstart): Only set ipa_tdesc_idx if agent
is actually loaded.
---
Whoops, now that's a brown paper bag bug. Pushed as obvious.
gdb/gdbserver/ChangeLog | 5 +++++
gdb/gdbserver/tracepoint.c | 11 +++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 4c8df3f..40150d7 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-02 Marcin KoÅcielnicki <koriakin@0x04.net>
+
+ * tracepoint.c (cmd_qtstart): Only set ipa_tdesc_idx if agent
+ is actually loaded.
+
2016-02-25 Marcin KoÅcielnicki <koriakin@0x04.net>
* linux-s390-low.c (s390_num_regs_3264): Define on 31-bit too.
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index dbd0b46..383fb71 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -3214,10 +3214,13 @@ cmd_qtstart (char *packet)
*packet = '\0';
- /* Tell IPA about the correct tdesc. */
- if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
- target_get_ipa_tdesc_idx ()))
- error ("Error setting ipa_tdesc_idx variable in lib");
+ if (agent_loaded_p ())
+ {
+ /* Tell IPA about the correct tdesc. */
+ if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
+ target_get_ipa_tdesc_idx ()))
+ error ("Error setting ipa_tdesc_idx variable in lib");
+ }
/* Start out empty. */
if (agent_loaded_p ())
--
2.7.1
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-03-02 16:21 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-21 21:17 [PATCH] [PR gdb/13808] gdb.trace: Pass tdesc selected in gdbserver to IPA Marcin Kościelnicki
2016-02-23 15:19 ` Antoine Tremblay
2016-02-25 13:08 ` Pedro Alves
2016-02-25 13:39 ` Marcin Kościelnicki
2016-02-25 14:46 ` Pedro Alves
2016-02-25 15:39 ` Marcin Kościelnicki
2016-02-25 16:46 ` Pedro Alves
2016-02-25 16:59 ` Marcin Kościelnicki
2016-03-02 15:50 ` Yao Qi
2016-03-02 16:21 ` [PATCH] [OBV] gdbserver: Only write ipa_tdesc_idx if agent is actually loaded Marcin Kościelnicki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).