aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-05-26 12:38:38 +0100
committerYao Qi <yao.qi@linaro.org>2017-06-20 11:34:14 +0100
commitebcb4b51ab645f72c5e20a8c91c9cbf0db10e7f8 (patch)
tree6e7e04410b821497372652d974f5a5970ede55eb
parenta4bee91020b69b3782e23f018e279799524702e8 (diff)
downloadgdb-ebcb4b51ab645f72c5e20a8c91c9cbf0db10e7f8.zip
gdb-ebcb4b51ab645f72c5e20a8c91c9cbf0db10e7f8.tar.gz
gdb-ebcb4b51ab645f72c5e20a8c91c9cbf0db10e7f8.tar.bz2
[GDBserver] Use pre-generated tdesc as test
Now, these *-generate.c files are only used in GDBserver for unit test. If $development is false (in release), these *-generate.c files won't be used at all. gdb/gdbserver: 2017-05-26 Yao Qi <yao.qi@linaro.org> * configure.srv: Set srv_i386_linux_regobj empty if $development is false. * linux-x86-tdesc.c: TODO.
-rw-r--r--gdb/gdbserver/configure.srv11
-rw-r--r--gdb/gdbserver/linux-i386-ipa.c2
-rw-r--r--gdb/gdbserver/linux-x86-low.c2
-rw-r--r--gdb/gdbserver/linux-x86-tdesc-selftest.c100
-rw-r--r--gdb/gdbserver/linux-x86-tdesc.c89
5 files changed, 110 insertions, 94 deletions
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index 1a5801a..d437bc6 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -25,11 +25,16 @@
srv_hostio_err_objs="hostio-errno.o"
srv_i386_regobj="i386.o i386-avx.o i386-avx-avx512.o i386-avx-mpx-avx512-pku.o i386-mpx.o i386-avx-mpx.o i386-mmx.o"
-srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx-avx512-linux.o i386-avx-mpx-avx512-pku-linux.o i386-mpx-linux.o i386-avx-mpx-linux.o i386-mmx-linux.o"
+
+if $development; then
+ srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx-avx512-linux.o i386-avx-mpx-avx512-pku-linux.o i386-mpx-linux.o i386-avx-mpx-linux.o i386-mmx-linux.o linux-x86-tdesc-selftest.o"
+else
+ srv_i386_linux_regobj=""
+fi
+
srv_amd64_regobj="amd64.o amd64-avx.o amd64-avx-avx512.o amd64-avx-mpx-avx512-pku.o amd64-mpx.o amd64-avx-mpx.o x32.o x32-avx.o x32-avx-avx512.o"
srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx-avx512-linux.o amd64-avx-mpx-avx512-pku-linux.o amd64-mpx-linux.o amd64-avx-mpx-linux.o x32-linux.o x32-avx-linux.o x32-avx-avx512-linux.o"
-ipa_i386_linux_regobj="i386-linux-ipa.o i386-avx-linux-ipa.o i386-avx-mpx-linux-ipa.o i386-avx-avx512-linux-ipa.o i386-avx-mpx-avx512-pku-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-avx-mpx-linux-ipa.o amd64-avx-avx512-linux-ipa.o amd64-avx-mpx-avx512-pku-linux-ipa.o amd64-mpx-linux-ipa.o"
ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o"
@@ -129,7 +134,7 @@ case "${target}" in
srv_linux_regsets=yes
srv_linux_thread_db=yes
srv_linux_btrace=yes
- ipa_obj="${ipa_i386_linux_regobj} linux-i386-ipa.o linux-x86-tdesc-ipa.o"
+ ipa_obj="linux-i386-ipa.o linux-x86-tdesc-ipa.o"
;;
i[34567]86-*-lynxos*) srv_regobj="i386.o"
srv_tgtobj="lynx-low.o lynx-i386-low.o fork-child.o fork-inferior.o"
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdb/gdbserver/linux-i386-ipa.c
index bca3fdb..1804d41 100644
--- a/gdb/gdbserver/linux-i386-ipa.c
+++ b/gdb/gdbserver/linux-i386-ipa.c
@@ -262,7 +262,5 @@ alloc_jump_pad_buffer (size_t size)
void
initialize_low_tracepoint (void)
{
- initialize_low_tdesc ();
-
initialize_fast_tracepoint_trampoline_buffer ();
}
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index f5d4aa1..7744d3b 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -2985,7 +2985,9 @@ initialize_low_arch (void)
tdesc_amd64_linux_no_xml->xmltarget = xmltarget_amd64_linux_no_xml;
#endif
+#if GDB_SELF_TEST
initialize_low_tdesc ();
+#endif
tdesc_i386_linux_no_xml = XNEW (struct target_desc);
copy_target_description (tdesc_i386_linux_no_xml,
diff --git a/gdb/gdbserver/linux-x86-tdesc-selftest.c b/gdb/gdbserver/linux-x86-tdesc-selftest.c
new file mode 100644
index 0000000..31f5240
--- /dev/null
+++ b/gdb/gdbserver/linux-x86-tdesc-selftest.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2017 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/>. */
+
+#include "server.h"
+#include "linux-x86-tdesc.h"
+#include "tdesc.h"
+#include "../selftest.h"
+
+/* 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-avx-mpx-linux.c. */
+void init_registers_i386_avx_mpx_linux (void);
+extern const struct target_desc *tdesc_i386_avx_mpx_linux;
+
+/* Defined in auto-generated file i386-avx-avx512-linux.c. */
+void init_registers_i386_avx_avx512_linux (void);
+extern const struct target_desc *tdesc_i386_avx_avx512_linux;
+
+/* Defined in auto-generated file i386-avx-mpx-avx512-linux.c. */
+void init_registers_i386_avx_mpx_avx512_pku_linux (void);
+extern const struct target_desc *tdesc_i386_avx_mpx_avx512_pku_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;
+
+namespace selftests {
+namespace gdbserver {
+static void
+i386_tdesc_test ()
+{
+ const struct target_desc *tdesc = i386_get_ipa_tdesc (X86_TDESC_MMX);
+
+ SELF_CHECK (*tdesc == *tdesc_i386_mmx_linux);
+ delete tdesc;
+
+ tdesc = i386_get_ipa_tdesc (X86_TDESC_SSE);
+ SELF_CHECK (*tdesc == *tdesc_i386_linux);
+ delete tdesc;
+
+ tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX);
+ SELF_CHECK (*tdesc == *tdesc_i386_avx_linux);
+ delete tdesc;
+
+ tdesc = i386_get_ipa_tdesc (X86_TDESC_MPX);
+ SELF_CHECK (*tdesc == *tdesc_i386_mpx_linux);
+ delete tdesc;
+
+ tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX_MPX);
+ SELF_CHECK (*tdesc == *tdesc_i386_avx_mpx_linux);
+ delete tdesc;
+
+ tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX_AVX512);
+ SELF_CHECK (*tdesc == *tdesc_i386_avx_avx512_linux);
+ delete tdesc;
+
+ tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX_MPX_AVX512_PKU);
+ SELF_CHECK (*tdesc == *tdesc_i386_avx_mpx_avx512_pku_linux);
+ delete tdesc;
+}
+}
+} // namespace selftests
+
+void
+initialize_low_tdesc ()
+{
+ init_registers_i386_linux ();
+ init_registers_i386_mmx_linux ();
+ init_registers_i386_avx_linux ();
+ init_registers_i386_mpx_linux ();
+ init_registers_i386_avx_mpx_linux ();
+ init_registers_i386_avx_avx512_linux ();
+ init_registers_i386_avx_mpx_avx512_pku_linux ();
+
+ register_self_test (selftests::gdbserver::i386_tdesc_test);
+}
diff --git a/gdb/gdbserver/linux-x86-tdesc.c b/gdb/gdbserver/linux-x86-tdesc.c
index 0dc5275..2e4079a 100644
--- a/gdb/gdbserver/linux-x86-tdesc.c
+++ b/gdb/gdbserver/linux-x86-tdesc.c
@@ -29,97 +29,8 @@
#include "../features/i386/32bit-mpx.c"
#include "../features/i386/32bit-pkeys.c"
-#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-avx-mpx-linux.c. */
-void init_registers_i386_avx_mpx_linux (void);
-extern const struct target_desc *tdesc_i386_avx_mpx_linux;
-
-/* Defined in auto-generated file i386-avx-avx512-linux.c. */
-void init_registers_i386_avx_avx512_linux (void);
-extern const struct target_desc *tdesc_i386_avx_avx512_linux;
-
-/* Defined in auto-generated file i386-avx-mpx-avx512-linux.c. */
-void init_registers_i386_avx_mpx_avx512_pku_linux (void);
-extern const struct target_desc *tdesc_i386_avx_mpx_avx512_pku_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
-
static const struct target_desc *i386_tdescs[X86_TDESC_LAST] = { };
-#if defined GDB_SELF_TEST && !defined IN_PROCESS_AGENT
-#include "selftest.h"
-
-namespace selftests {
-namespace gdbserver {
-static void
-i386_tdesc_test ()
-{
- const struct target_desc *tdesc = i386_get_ipa_tdesc (X86_TDESC_MMX);
-
- SELF_CHECK (*tdesc == *tdesc_i386_mmx_linux);
- delete tdesc;
-
- tdesc = i386_get_ipa_tdesc (X86_TDESC_SSE);
- SELF_CHECK (*tdesc == *tdesc_i386_linux);
- delete tdesc;
-
- tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX);
- SELF_CHECK (*tdesc == *tdesc_i386_avx_linux);
- delete tdesc;
-
- tdesc = i386_get_ipa_tdesc (X86_TDESC_MPX);
- SELF_CHECK (*tdesc == *tdesc_i386_mpx_linux);
- delete tdesc;
-
- tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX_MPX);
- SELF_CHECK (*tdesc == *tdesc_i386_avx_mpx_linux);
- delete tdesc;
-
- tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX_AVX512);
- SELF_CHECK (*tdesc == *tdesc_i386_avx_avx512_linux);
- delete tdesc;
-
- tdesc = i386_get_ipa_tdesc (X86_TDESC_AVX_MPX_AVX512_PKU);
- SELF_CHECK (*tdesc == *tdesc_i386_avx_mpx_avx512_pku_linux);
- delete tdesc;
-}
-}
-} // namespace selftests
-#endif /* GDB_SELF_TEST */
-
-void
-initialize_low_tdesc ()
-{
-#if defined __i386__ || !defined IN_PROCESS_AGENT
- init_registers_i386_linux ();
- init_registers_i386_mmx_linux ();
- init_registers_i386_avx_linux ();
- init_registers_i386_mpx_linux ();
- init_registers_i386_avx_mpx_linux ();
- init_registers_i386_avx_avx512_linux ();
- init_registers_i386_avx_mpx_avx512_pku_linux ();
-
-#if GDB_SELF_TEST
- register_self_test (selftests::gdbserver::i386_tdesc_test);
-#endif
-#endif
-}
-
const struct target_desc *
i386_get_ipa_tdesc (int idx)
{