1 /* GDB self-test for each gdbarch.
2 Copyright (C) 2017 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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/>. */
23 #include "selftest-arch.h"
24 #include "arch-utils.h"
28 static std::vector
<self_test_foreach_arch_function
*> gdbarch_tests
;
31 register_test_foreach_arch (self_test_foreach_arch_function
*function
)
33 gdbarch_tests
.push_back (function
);
39 /* Clear GDB internal state. */
41 reinit_frame_cache ();
49 for (const auto &f
: gdbarch_tests
)
51 const char **arches
= gdbarch_printable_names ();
53 for (int i
= 0; arches
[i
] != NULL
; i
++)
55 if (strcmp ("fr300", arches
[i
]) == 0)
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)
76 struct gdbarch_info info
;
78 gdbarch_info_init (&info
);
79 info
.bfd_arch_info
= bfd_scan_arch (arches
[i
]);
81 struct gdbarch
*gdbarch
= gdbarch_find_by_info (info
);
82 SELF_CHECK (gdbarch
!= NULL
);
85 CATCH (ex
, RETURN_MASK_ERROR
)
88 exception_fprintf (gdb_stderr
, ex
,
89 _("Self test failed: arch %s: "), arches
[i
]);
97 SELF_CHECK (failed
== 0);
100 } // namespace selftests
101 #endif /* GDB_SELF_TEST */
103 /* Suppress warning from -Wmissing-prototypes. */
104 extern initialize_file_ftype _initialize_selftests_foreach_arch
;
107 _initialize_selftests_foreach_arch ()
110 selftests::register_test (selftests::tests_with_arch
);