1/* This testcase is part of GDB, the GNU debugger. 2 3 Copyright 2015-2020 Free Software Foundation, Inc. 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 18typedef void (*testcase_ftype) (void); 19 20/* The arch-specific files need to implement both the initialize function 21 and define the testcases array. */ 22 23#if (defined __aarch64__) 24#include "insn-reverse-aarch64.c" 25#elif (defined __arm__) 26#include "insn-reverse-arm.c" 27#elif (defined __x86_64__) || (defined __i386__) 28#include "insn-reverse-x86.c" 29#else 30/* We get here if the current architecture being tested doesn't have any 31 record/replay instruction decoding tests implemented. */ 32static testcase_ftype testcases[] = {}; 33 34/* Dummy implementation in case this target doesn't have any record/replay 35 instruction decoding tests implemented. */ 36 37static void 38initialize (void) 39{ 40} 41#endif 42 43/* GDB will read n_testcases to know how many functions to test. The 44 functions are implemented in arch-specific files and the testcases 45 array is defined together with them. */ 46static int n_testcases = (sizeof (testcases) / sizeof (testcase_ftype)); 47 48int 49main () 50{ 51 int i = 0; 52 53 /* Initialize any required arch-specific bits. */ 54 initialize (); 55 56 for (i = 0; i < n_testcases; i++) 57 testcases[i] (); 58 59 return 0; 60} 61