diff options
author | Yao Qi <yao.qi@linaro.org> | 2017-01-26 14:29:19 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2017-01-26 14:29:19 +0000 |
commit | 79843d45f7633f33dca8b0a9999a1b0795b6b459 (patch) | |
tree | 7ffe7c205eb6011ec2565ae0db2253523590f1fc /gdb/selftest-arch.h | |
parent | 8cafda321ca8588a9e42d78d8713b031696405bc (diff) | |
download | gdb-79843d45f7633f33dca8b0a9999a1b0795b6b459.zip gdb-79843d45f7633f33dca8b0a9999a1b0795b6b459.tar.gz gdb-79843d45f7633f33dca8b0a9999a1b0795b6b459.tar.bz2 |
Disassembly unit test: disassemble one instruction
This patch adds one unit test, which disassemble one instruction for
every gdbarch if available. The test needs one valid instruction of
each gdbarch, and most of them are got from breakpoint instruction.
For the rest gdbarch whose breakpoint instruction isn't a valid
instruction, I copy one instruction from the gas/testsuite/gas/
directory.
I get the valid instruction of most gdbarch except ia64, mep, mips,
tic6x, and xtensa. People familiar with these arch should be easy
to extend the test.
In order to achieve "do the unit test for every gdbarch", I add
selftest-arch.[c,h], so that we can register a function pointer,
which has one argument gdbarch. selftest.c will iterate over all
gdbarches to call the registered function pointer.
gdb:
2017-01-26 Yao Qi <yao.qi@linaro.org>
* Makefile.in (SFILES): Add disasm-selftests.c and
selftest-arch.c.
(COMMON_OBS): Add disasm-selftests.o and selftest-arch.o.
* disasm-selftests.c: New file.
* selftest-arch.c: New file.
* selftest-arch.h: New file.
Diffstat (limited to 'gdb/selftest-arch.h')
-rw-r--r-- | gdb/selftest-arch.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/selftest-arch.h b/gdb/selftest-arch.h new file mode 100644 index 0000000..d1725cd --- /dev/null +++ b/gdb/selftest-arch.h @@ -0,0 +1,27 @@ +/* GDB self-test for each gdbarch. + 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/>. */ + +#ifndef SELFTEST_ARCH_H +#define SELFTEST_ARCH_H + +typedef void self_test_foreach_arch_function (struct gdbarch *); + +extern void + register_self_test_foreach_arch (self_test_foreach_arch_function *function); + +#endif /* SELFTEST_ARCH_H */ |