aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-06-06 19:27:46 +0200
committerTom de Vries <tdevries@suse.de>2022-06-06 19:27:46 +0200
commit38015f6710d67d700f34cfecc6d9fe5ae6241252 (patch)
tree562ca9c8f34e38d8b093261c6be7c8dfb9fd67ab /gdb
parent4ab19f4c9b3c838cd904a501b77148a459420b4c (diff)
downloadgdb-38015f6710d67d700f34cfecc6d9fe5ae6241252.zip
gdb-38015f6710d67d700f34cfecc6d9fe5ae6241252.tar.gz
gdb-38015f6710d67d700f34cfecc6d9fe5ae6241252.tar.bz2
[gdb] Name arch selftests more clearly
When running some all archs selftest I get: ... $ gdb -q -batch -ex "maint selftest unpack_field_as_long" Running selftest unpack_field_as_long::A6. ... By now I know that A6 is an arc architecture, but for others that's less clear. Fix this by using unpack_field_as_long::arc::A6 instead. This then introduces redundant names like arm::arm, so try to avoid those, though I'm not entirely convinced that that's worth the trouble. This introduces the following new names: ... +Running selftest unpack_field_as_long::am33_2::am33-2. +Running selftest unpack_field_as_long::arc::A6. +Running selftest unpack_field_as_long::arc::A7. +Running selftest unpack_field_as_long::arc::EM. +Running selftest unpack_field_as_long::arc::HS. +Running selftest unpack_field_as_long::arm::ep9312. +Running selftest unpack_field_as_long::arm::iwmmxt. +Running selftest unpack_field_as_long::arm::iwmmxt2. +Running selftest unpack_field_as_long::arm::xscale. +Running selftest unpack_field_as_long::bpf::xbpf. +Running selftest unpack_field_as_long::frv::fr400. +Running selftest unpack_field_as_long::frv::fr450. +Running selftest unpack_field_as_long::frv::fr500. +Running selftest unpack_field_as_long::frv::fr550. +Running selftest unpack_field_as_long::frv::simple. +Running selftest unpack_field_as_long::frv::tomcat. +Running selftest unpack_field_as_long::iq2000::iq10. +Running selftest unpack_field_as_long::m32c::m16c. +Running selftest unpack_field_as_long::mep::c5. +Running selftest unpack_field_as_long::mep::h1. +Running selftest unpack_field_as_long::nds32::n1. +Running selftest unpack_field_as_long::nds32::n1h. +Running selftest unpack_field_as_long::nds32::n1h_v2. +Running selftest unpack_field_as_long::nds32::n1h_v3. +Running selftest unpack_field_as_long::nds32::n1h_v3m. +Running selftest unpack_field_as_long::z80::ez80-adl. +Running selftest unpack_field_as_long::z80::ez80-z80. +Running selftest unpack_field_as_long::z80::gbz80. +Running selftest unpack_field_as_long::z80::r800. +Running selftest unpack_field_as_long::z80::z180. ... Tested on x86_64-linux.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/selftest-arch.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c
index 1fe0b2d..33d7875 100644
--- a/gdb/selftest-arch.c
+++ b/gdb/selftest-arch.c
@@ -63,20 +63,37 @@ foreach_arch_test_generator (const std::string &name,
if (skip_arch (arch))
continue;
+ struct gdbarch_info info;
+ info.bfd_arch_info = bfd_scan_arch (arch);
+ info.osabi = GDB_OSABI_NONE;
+
auto test_fn
= ([=] ()
{
- struct gdbarch_info info;
- info.bfd_arch_info = bfd_scan_arch (arch);
- info.osabi = GDB_OSABI_NONE;
struct gdbarch *gdbarch = gdbarch_find_by_info (info);
SELF_CHECK (gdbarch != NULL);
function (gdbarch);
reset ();
});
- tests.emplace_back (string_printf ("%s::%s", name.c_str (), arch),
- test_fn);
+ std::string id;
+
+ bool has_sep = strchr (arch, ':') != nullptr;
+ if (has_sep)
+ /* Avoid avr::avr:1. */
+ id = arch;
+ else if (strncasecmp (info.bfd_arch_info->arch_name, arch,
+ strlen (info.bfd_arch_info->arch_name)) == 0)
+ /* Avoid arm::arm. */
+ id = arch;
+ else
+ /* Use arc::A6 instead of A6. This still leaves us with an unfortunate
+ redundant id like am33_2::am33-2, but that doesn't seem worth the
+ effort to avoid. */
+ id = string_printf ("%s::%s", info.bfd_arch_info->arch_name, arch);
+
+ id = string_printf ("%s::%s", name.c_str (), id.c_str ());
+ tests.emplace_back (id, test_fn);
}
return tests;
}