[gdb/testsuite] Register test for each arch separately in register_test_foreach_arch
authorTom de Vries <tdevries@suse.de>
Mon, 20 Sep 2021 22:41:26 +0000 (00:41 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 20 Sep 2021 22:41:26 +0000 (00:41 +0200)
commitff1c1bb9be3ed77fdabe594d977a9ccc67870fd0
treeb993c2cd39176c63aab5b78c2a0f742125860533
parentc45a683f8f9195bf7cc53bc645a20092c7155629
[gdb/testsuite] Register test for each arch separately in register_test_foreach_arch

In gdb/disasm-selftests.c we have:
...
  selftests::register_test_foreach_arch ("print_one_insn",
                                         selftests::print_one_insn_test);
...
and we get:
...
$ gdb -q -batch -ex "maint selftest print_one_insn" 2>&1 \
  | grep ^Running
Running selftest print_one_insn.
$
...

Change the semantics register_test_foreach_arch such that a version of
print_one_insn is registered for each architecture, such that we have:
...
$ gdb -q -batch -ex "maint selftest print_one_insn" 2>&1 \
  | grep ^Running
Running selftest print_one_insn::A6.
Running selftest print_one_insn::A7.
Running selftest print_one_insn::ARC600.
  ...
$
...

This makes it f.i. possible to do:
...
$ gdb -q -batch a.out -ex "maint selftest print_one_insn::armv8.1-m.main"
Running selftest print_one_insn::armv8.1-m.main.
Self test failed: self-test failed at src/gdb/disasm-selftests.c:165
Ran 1 unit tests, 1 failed
...

Tested on x86_64-linux with an --enable-targets=all build.
gdb/selftest-arch.c