Disassembly unit test: disassemble one instruction
authorYao Qi <yao.qi@linaro.org>
Thu, 26 Jan 2017 14:29:19 +0000 (14:29 +0000)
committerYao Qi <yao.qi@linaro.org>
Thu, 26 Jan 2017 14:29:19 +0000 (14:29 +0000)
commit79843d45f7633f33dca8b0a9999a1b0795b6b459
tree7ffe7c205eb6011ec2565ae0db2253523590f1fc
parent8cafda321ca8588a9e42d78d8713b031696405bc
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.
gdb/ChangeLog
gdb/Makefile.in
gdb/disasm-selftests.c [new file with mode: 0644]
gdb/selftest-arch.c [new file with mode: 0644]
gdb/selftest-arch.h [new file with mode: 0644]