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-09-05 Yao Qi <yao.qi@linaro.org>
* configure.srv: Set srv_i386_linux_regobj empty if $development
is false.
* linux-i386-ipa.c (initialize_low_tracepoint): Don't call
initialize_low_tdesc.
* linux-x86-low.c (initialize_low_arch): Wrap initialize_low_tdesc
with #if initialize_low_tdesc.
* linux-x86-tdesc-selftest.c: New file.
* linux-x86-tdesc.c: Move code to linux-x86-tdesc-selftest.c.
+2017-09-05 Yao Qi <yao.qi@linaro.org>
+
+ * configure.srv: Set srv_i386_linux_regobj empty if $development
+ is false.
+ * linux-i386-ipa.c (initialize_low_tracepoint): Don't call
+ initialize_low_tdesc.
+ * linux-x86-low.c (initialize_low_arch): Wrap initialize_low_tdesc
+ with #if initialize_low_tdesc.
+ * linux-x86-tdesc-selftest.c: New file.
+ * linux-x86-tdesc.c: Move code to linux-x86-tdesc-selftest.c.
+
2017-09-05 Yao Qi <yao.qi@linaro.org>
* Makefile.in (arch-i386.o): New rule.
srv_hostio_err_objs="hostio-errno.o"
srv_i386_regobj="i386.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"
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_x32_linux_regobj="x32-linux-ipa.o x32-avx-linux-ipa.o x32-avx-avx512-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"
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"
ipa_obj="${ipa_obj} i386-ipa.o"
;;
i[34567]86-*-lynxos*) srv_regobj="i386.o"
void
initialize_low_tracepoint (void)
{
- initialize_low_tdesc ();
-
initialize_fast_tracepoint_trampoline_buffer ();
}
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,
--- /dev/null
+/* 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 "common/selftest.h"
+#include "x86-xstate.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 tdesc {
+static void
+i386_tdesc_test ()
+{
+ struct
+ {
+ unsigned int mask;
+ const target_desc *tdesc;
+ } tdesc_tests[] = {
+ { X86_XSTATE_X87, tdesc_i386_mmx_linux },
+ { X86_XSTATE_SSE_MASK, tdesc_i386_linux },
+ { X86_XSTATE_AVX_MASK, tdesc_i386_avx_linux },
+ { X86_XSTATE_MPX_MASK, tdesc_i386_mpx_linux },
+ { X86_XSTATE_AVX_MPX_MASK, tdesc_i386_avx_mpx_linux },
+ { X86_XSTATE_AVX_AVX512_MASK, tdesc_i386_avx_avx512_linux },
+ { X86_XSTATE_AVX_MPX_AVX512_PKU_MASK, tdesc_i386_avx_mpx_avx512_pku_linux }
+ };
+
+ for (auto &elem : tdesc_tests)
+ {
+ const target_desc *tdesc = i386_linux_read_description (elem.mask);
+
+ SELF_CHECK (*tdesc == *elem.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 ();
+
+ selftests::register_test (selftests::tdesc::i386_tdesc_test);
+}
#include "arch/i386.h"
#include "common/x86-xstate.h"
-#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 struct target_desc *i386_tdescs[X86_TDESC_LAST] = { };
-#if defined GDB_SELF_TEST && !defined IN_PROCESS_AGENT
-#include "selftest.h"
-
-namespace selftests {
-namespace tdesc {
-static void
-i386_tdesc_test ()
-{
- struct
- {
- unsigned int mask;
- const target_desc *tdesc;
- } tdesc_tests[] = {
- { X86_XSTATE_X87, tdesc_i386_mmx_linux },
- { X86_XSTATE_SSE_MASK, tdesc_i386_linux },
- { X86_XSTATE_AVX_MASK, tdesc_i386_avx_linux },
- { X86_XSTATE_MPX_MASK, tdesc_i386_mpx_linux },
- { X86_XSTATE_AVX_MPX_MASK, tdesc_i386_avx_mpx_linux },
- { X86_XSTATE_AVX_AVX512_MASK, tdesc_i386_avx_avx512_linux },
- { X86_XSTATE_AVX_MPX_AVX512_PKU_MASK, tdesc_i386_avx_mpx_avx512_pku_linux }
- };
-
- for (auto &elem : tdesc_tests)
- {
- const target_desc *tdesc = i386_linux_read_description (elem.mask);
-
- SELF_CHECK (*tdesc == *elem.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 && !defined IN_PROCESS_AGENT
- selftests::register_test (selftests::tdesc::i386_tdesc_test);
-#endif
-#endif
-}
-
#if defined __i386__ || !defined IN_PROCESS_AGENT
/* Return the target description according to XCR0. */