Enable support for the AArch64 dot-prod instruction in the Cortex A55 and A75 cpus.
[deliverable/binutils-gdb.git] / gdb / selftest-arch.c
CommitLineData
79843d45
YQ
1/* GDB self-test for each gdbarch.
2 Copyright (C) 2017 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#include "defs.h"
20
21#if GDB_SELF_TEST
22#include "selftest.h"
23#include "selftest-arch.h"
24#include "arch-utils.h"
25
7649770c
YQ
26namespace selftests {
27
79843d45
YQ
28static std::vector<self_test_foreach_arch_function *> gdbarch_tests;
29
30void
7649770c 31register_test_foreach_arch (self_test_foreach_arch_function *function)
79843d45
YQ
32{
33 gdbarch_tests.push_back (function);
34}
35
6d580b63
YQ
36void
37reset ()
38{
39 /* Clear GDB internal state. */
40 registers_changed ();
41 reinit_frame_cache ();
42}
43
79843d45
YQ
44static void
45tests_with_arch ()
46{
47 int failed = 0;
48
49 for (const auto &f : gdbarch_tests)
50 {
51 const char **arches = gdbarch_printable_names ();
52
53 for (int i = 0; arches[i] != NULL; i++)
54 {
55 if (strcmp ("fr300", arches[i]) == 0)
56 {
57 /* PR 20946 */
58 continue;
59 }
60 else if (strcmp ("powerpc:EC603e", arches[i]) == 0
61 || strcmp ("powerpc:e500mc", arches[i]) == 0
62 || strcmp ("powerpc:e500mc64", arches[i]) == 0
63 || strcmp ("powerpc:titan", arches[i]) == 0
64 || strcmp ("powerpc:vle", arches[i]) == 0
65 || strcmp ("powerpc:e5500", arches[i]) == 0
66 || strcmp ("powerpc:e6500", arches[i]) == 0)
67 {
68 /* PR 19797 */
69 continue;
70 }
71
72 QUIT;
73
74 TRY
75 {
76 struct gdbarch_info info;
77
78 gdbarch_info_init (&info);
79 info.bfd_arch_info = bfd_scan_arch (arches[i]);
80
81 struct gdbarch *gdbarch = gdbarch_find_by_info (info);
82 SELF_CHECK (gdbarch != NULL);
83 f (gdbarch);
84 }
85 CATCH (ex, RETURN_MASK_ERROR)
86 {
87 ++failed;
88 exception_fprintf (gdb_stderr, ex,
89 _("Self test failed: arch %s: "), arches[i]);
90 }
91 END_CATCH
7a3929c4 92
6d580b63 93 reset ();
79843d45
YQ
94 }
95 }
96
97 SELF_CHECK (failed == 0);
98}
99
100} // namespace selftests
101#endif /* GDB_SELF_TEST */
102
103/* Suppress warning from -Wmissing-prototypes. */
104extern initialize_file_ftype _initialize_selftests_foreach_arch;
105
106void
107_initialize_selftests_foreach_arch ()
108{
109#if GDB_SELF_TEST
7649770c 110 selftests::register_test (selftests::tests_with_arch);
79843d45
YQ
111#endif
112}
This page took 0.076807 seconds and 4 git commands to generate.