GNU Binutils with patches for OS216
Révision | 9cc5965083e96f0f86d3458d5397f8b2ba93fdcd (tree) |
---|---|
l'heure | 2017-08-21 19:18:14 |
Auteur | Yao Qi <yao.qi@lina...> |
Commiter | Yao Qi |
[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-07-07 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.
@@ -25,11 +25,16 @@ | ||
25 | 25 | srv_hostio_err_objs="hostio-errno.o" |
26 | 26 | |
27 | 27 | srv_i386_regobj="i386.o" |
28 | -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" | |
28 | + | |
29 | +if $development; then | |
30 | + 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" | |
31 | +else | |
32 | + srv_i386_linux_regobj="" | |
33 | +fi | |
34 | + | |
29 | 35 | srv_amd64_regobj="amd64.o" |
30 | 36 | 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" |
31 | 37 | |
32 | -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" | |
33 | 38 | 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" |
34 | 39 | ipa_x32_linux_regobj="x32-linux-ipa.o x32-avx-linux-ipa.o x32-avx-avx512-linux-ipa.o" |
35 | 40 | 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" |
@@ -131,7 +136,7 @@ case "${target}" in | ||
131 | 136 | srv_linux_regsets=yes |
132 | 137 | srv_linux_thread_db=yes |
133 | 138 | srv_linux_btrace=yes |
134 | - ipa_obj="${ipa_i386_linux_regobj} linux-i386-ipa.o linux-x86-tdesc-ipa.o" | |
139 | + ipa_obj="linux-i386-ipa.o linux-x86-tdesc-ipa.o" | |
135 | 140 | ipa_obj="${ipa_obj} i386-ipa.o" |
136 | 141 | ;; |
137 | 142 | i[34567]86-*-lynxos*) srv_regobj="i386.o" |
@@ -289,7 +289,5 @@ alloc_jump_pad_buffer (size_t size) | ||
289 | 289 | void |
290 | 290 | initialize_low_tracepoint (void) |
291 | 291 | { |
292 | - initialize_low_tdesc (); | |
293 | - | |
294 | 292 | initialize_fast_tracepoint_trampoline_buffer (); |
295 | 293 | } |
@@ -2969,7 +2969,9 @@ initialize_low_arch (void) | ||
2969 | 2969 | tdesc_amd64_linux_no_xml->xmltarget = xmltarget_amd64_linux_no_xml; |
2970 | 2970 | #endif |
2971 | 2971 | |
2972 | +#if GDB_SELF_TEST | |
2972 | 2973 | initialize_low_tdesc (); |
2974 | +#endif | |
2973 | 2975 | |
2974 | 2976 | tdesc_i386_linux_no_xml = XNEW (struct target_desc); |
2975 | 2977 | copy_target_description (tdesc_i386_linux_no_xml, |
@@ -0,0 +1,93 @@ | ||
1 | +/* Copyright (C) 2017 Free Software Foundation, Inc. | |
2 | + | |
3 | + This file is part of GDB. | |
4 | + | |
5 | + This program is free software; you can redistribute it and/or modify | |
6 | + it under the terms of the GNU General Public License as published by | |
7 | + the Free Software Foundation; either version 3 of the License, or | |
8 | + (at your option) any later version. | |
9 | + | |
10 | + This program is distributed in the hope that it will be useful, | |
11 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | + GNU General Public License for more details. | |
14 | + | |
15 | + You should have received a copy of the GNU General Public License | |
16 | + along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | + | |
18 | +#include "server.h" | |
19 | +#include "linux-x86-tdesc.h" | |
20 | +#include "tdesc.h" | |
21 | +#include "common/selftest.h" | |
22 | +#include "x86-xstate.h" | |
23 | + | |
24 | +/* Defined in auto-generated file i386-linux.c. */ | |
25 | +void init_registers_i386_linux (void); | |
26 | +extern const struct target_desc *tdesc_i386_linux; | |
27 | + | |
28 | +/* Defined in auto-generated file i386-mmx-linux.c. */ | |
29 | +void init_registers_i386_mmx_linux (void); | |
30 | +extern const struct target_desc *tdesc_i386_mmx_linux; | |
31 | + | |
32 | +/* Defined in auto-generated file i386-avx-linux.c. */ | |
33 | +void init_registers_i386_avx_linux (void); | |
34 | +extern const struct target_desc *tdesc_i386_avx_linux; | |
35 | + | |
36 | +/* Defined in auto-generated file i386-avx-mpx-linux.c. */ | |
37 | +void init_registers_i386_avx_mpx_linux (void); | |
38 | +extern const struct target_desc *tdesc_i386_avx_mpx_linux; | |
39 | + | |
40 | +/* Defined in auto-generated file i386-avx-avx512-linux.c. */ | |
41 | +void init_registers_i386_avx_avx512_linux (void); | |
42 | +extern const struct target_desc *tdesc_i386_avx_avx512_linux; | |
43 | + | |
44 | +/* Defined in auto-generated file i386-avx-mpx-avx512-linux.c. */ | |
45 | +void init_registers_i386_avx_mpx_avx512_pku_linux (void); | |
46 | +extern const struct target_desc *tdesc_i386_avx_mpx_avx512_pku_linux; | |
47 | + | |
48 | +/* Defined in auto-generated file i386-mpx-linux.c. */ | |
49 | +void init_registers_i386_mpx_linux (void); | |
50 | +extern const struct target_desc *tdesc_i386_mpx_linux; | |
51 | + | |
52 | +namespace selftests { | |
53 | +namespace tdesc { | |
54 | +static void | |
55 | +i386_tdesc_test () | |
56 | +{ | |
57 | + struct | |
58 | + { | |
59 | + unsigned int mask; | |
60 | + const target_desc *tdesc; | |
61 | + } tdesc_tests[] = { | |
62 | + { X86_XSTATE_X87, tdesc_i386_mmx_linux }, | |
63 | + { X86_XSTATE_SSE_MASK, tdesc_i386_linux }, | |
64 | + { X86_XSTATE_AVX_MASK, tdesc_i386_avx_linux }, | |
65 | + { X86_XSTATE_MPX_MASK, tdesc_i386_mpx_linux }, | |
66 | + { X86_XSTATE_AVX_MPX_MASK, tdesc_i386_avx_mpx_linux }, | |
67 | + { X86_XSTATE_AVX_AVX512_MASK, tdesc_i386_avx_avx512_linux }, | |
68 | + { X86_XSTATE_AVX_MPX_AVX512_PKU_MASK, tdesc_i386_avx_mpx_avx512_pku_linux } | |
69 | + }; | |
70 | + | |
71 | + for (auto &elem : tdesc_tests) | |
72 | + { | |
73 | + const target_desc *tdesc = i386_linux_read_description (elem.mask); | |
74 | + | |
75 | + SELF_CHECK (*tdesc == *elem.tdesc); | |
76 | + } | |
77 | +} | |
78 | +} | |
79 | +} // namespace selftests | |
80 | + | |
81 | +void | |
82 | +initialize_low_tdesc () | |
83 | +{ | |
84 | + init_registers_i386_linux (); | |
85 | + init_registers_i386_mmx_linux (); | |
86 | + init_registers_i386_avx_linux (); | |
87 | + init_registers_i386_mpx_linux (); | |
88 | + init_registers_i386_avx_mpx_linux (); | |
89 | + init_registers_i386_avx_avx512_linux (); | |
90 | + init_registers_i386_avx_mpx_avx512_pku_linux (); | |
91 | + | |
92 | + selftests::register_test (selftests::tdesc::i386_tdesc_test); | |
93 | +} |
@@ -23,90 +23,8 @@ | ||
23 | 23 | #include "arch/i386.h" |
24 | 24 | #include "common/x86-xstate.h" |
25 | 25 | |
26 | -#if defined __i386__ || !defined IN_PROCESS_AGENT | |
27 | - | |
28 | -/* Defined in auto-generated file i386-linux.c. */ | |
29 | -void init_registers_i386_linux (void); | |
30 | -extern const struct target_desc *tdesc_i386_linux; | |
31 | - | |
32 | -/* Defined in auto-generated file i386-mmx-linux.c. */ | |
33 | -void init_registers_i386_mmx_linux (void); | |
34 | -extern const struct target_desc *tdesc_i386_mmx_linux; | |
35 | - | |
36 | -/* Defined in auto-generated file i386-avx-linux.c. */ | |
37 | -void init_registers_i386_avx_linux (void); | |
38 | -extern const struct target_desc *tdesc_i386_avx_linux; | |
39 | - | |
40 | -/* Defined in auto-generated file i386-avx-mpx-linux.c. */ | |
41 | -void init_registers_i386_avx_mpx_linux (void); | |
42 | -extern const struct target_desc *tdesc_i386_avx_mpx_linux; | |
43 | - | |
44 | -/* Defined in auto-generated file i386-avx-avx512-linux.c. */ | |
45 | -void init_registers_i386_avx_avx512_linux (void); | |
46 | -extern const struct target_desc *tdesc_i386_avx_avx512_linux; | |
47 | - | |
48 | -/* Defined in auto-generated file i386-avx-mpx-avx512-linux.c. */ | |
49 | -void init_registers_i386_avx_mpx_avx512_pku_linux (void); | |
50 | -extern const struct target_desc *tdesc_i386_avx_mpx_avx512_pku_linux; | |
51 | - | |
52 | -/* Defined in auto-generated file i386-mpx-linux.c. */ | |
53 | -void init_registers_i386_mpx_linux (void); | |
54 | -extern const struct target_desc *tdesc_i386_mpx_linux; | |
55 | -#endif | |
56 | - | |
57 | 26 | static struct target_desc *i386_tdescs[X86_TDESC_LAST] = { }; |
58 | 27 | |
59 | -#if defined GDB_SELF_TEST && !defined IN_PROCESS_AGENT | |
60 | -#include "selftest.h" | |
61 | - | |
62 | -namespace selftests { | |
63 | -namespace tdesc { | |
64 | -static void | |
65 | -i386_tdesc_test () | |
66 | -{ | |
67 | - struct | |
68 | - { | |
69 | - unsigned int mask; | |
70 | - const target_desc *tdesc; | |
71 | - } tdesc_tests[] = { | |
72 | - { X86_XSTATE_X87, tdesc_i386_mmx_linux }, | |
73 | - { X86_XSTATE_SSE_MASK, tdesc_i386_linux }, | |
74 | - { X86_XSTATE_AVX_MASK, tdesc_i386_avx_linux }, | |
75 | - { X86_XSTATE_MPX_MASK, tdesc_i386_mpx_linux }, | |
76 | - { X86_XSTATE_AVX_MPX_MASK, tdesc_i386_avx_mpx_linux }, | |
77 | - { X86_XSTATE_AVX_AVX512_MASK, tdesc_i386_avx_avx512_linux }, | |
78 | - { X86_XSTATE_AVX_MPX_AVX512_PKU_MASK, tdesc_i386_avx_mpx_avx512_pku_linux } | |
79 | - }; | |
80 | - | |
81 | - for (auto &elem : tdesc_tests) | |
82 | - { | |
83 | - const target_desc *tdesc = i386_linux_read_description (elem.mask); | |
84 | - | |
85 | - SELF_CHECK (*tdesc == *elem.tdesc); | |
86 | - } | |
87 | -} | |
88 | -} | |
89 | -} // namespace selftests | |
90 | -#endif /* GDB_SELF_TEST */ | |
91 | - | |
92 | -void | |
93 | -initialize_low_tdesc () | |
94 | -{ | |
95 | -#if defined __i386__ || !defined IN_PROCESS_AGENT | |
96 | - init_registers_i386_linux (); | |
97 | - init_registers_i386_mmx_linux (); | |
98 | - init_registers_i386_avx_linux (); | |
99 | - init_registers_i386_mpx_linux (); | |
100 | - init_registers_i386_avx_mpx_linux (); | |
101 | - init_registers_i386_avx_avx512_linux (); | |
102 | - init_registers_i386_avx_mpx_avx512_pku_linux (); | |
103 | - | |
104 | -#if GDB_SELF_TEST && !defined IN_PROCESS_AGENT | |
105 | - selftests::register_test (selftests::tdesc::i386_tdesc_test); | |
106 | -#endif | |
107 | -#endif | |
108 | -} | |
109 | - | |
110 | 28 | #if defined __i386__ || !defined IN_PROCESS_AGENT |
111 | 29 | |
112 | 30 | /* Return the target description according to XCR0. */ |