aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/gdbarch-selftests.c3
-rw-r--r--gdb/regcache.c23
-rw-r--r--gdb/selftest-arch.c19
-rw-r--r--gdb/selftest-arch.h5
4 files changed, 29 insertions, 21 deletions
diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c
index 27b17d17..8f42557 100644
--- a/gdb/gdbarch-selftests.c
+++ b/gdb/gdbarch-selftests.c
@@ -127,6 +127,9 @@ register_to_value_test (struct gdbarch *gdbarch)
static void
register_name_test (struct gdbarch *gdbarch)
{
+ if (selftest_skip_warning_arch (gdbarch))
+ return;
+
scoped_mock_context<test_target_ops> mockctx (gdbarch);
/* Track the number of times each register name appears. */
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 5508778..ad72429 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1911,32 +1911,13 @@ public:
{}
};
-/* Return true if regcache::cooked_{read,write}_test should be skipped for
- GDBARCH. */
-
-static bool
-selftest_skiparch (struct gdbarch *gdbarch)
-{
- const char *name = gdbarch_bfd_arch_info (gdbarch)->printable_name;
-
- /* Avoid warning:
- Running selftest regcache::cooked_{read,write}_test::m68hc11.
- warning: No frame soft register found in the symbol table.
- Stack backtrace will not work.
- We could instead capture the output and then filter out the warning, but
- that seems more trouble than it's worth. */
- return (strcmp (name, "m68hc11") == 0
- || strcmp (name, "m68hc12") == 0
- || strcmp (name, "m68hc12:HCS12") == 0);
-}
-
/* Test regcache::cooked_read gets registers from raw registers and
memory instead of target to_{fetch,store}_registers. */
static void
cooked_read_test (struct gdbarch *gdbarch)
{
- if (selftest_skiparch (gdbarch))
+ if (selftest_skip_warning_arch (gdbarch))
return;
scoped_mock_context<target_ops_no_register> mockctx (gdbarch);
@@ -2074,7 +2055,7 @@ cooked_read_test (struct gdbarch *gdbarch)
static void
cooked_write_test (struct gdbarch *gdbarch)
{
- if (selftest_skiparch (gdbarch))
+ if (selftest_skip_warning_arch (gdbarch))
return;
/* Create a mock environment. A process_stratum target pushed. */
diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c
index 17eeba8..79889c0 100644
--- a/gdb/selftest-arch.c
+++ b/gdb/selftest-arch.c
@@ -108,5 +108,24 @@ reset ()
registers_changed ();
reinit_frame_cache ();
}
+
+/* See selftest-arch.h. */
+
+bool
+selftest_skip_warning_arch (struct gdbarch *gdbarch)
+{
+ const char *name = gdbarch_bfd_arch_info (gdbarch)->printable_name;
+
+ /* Avoid warning:
+ Running selftest <test>::m68hc11.
+ warning: No frame soft register found in the symbol table.
+ Stack backtrace will not work.
+ We could instead capture the output and then filter out the warning, but
+ that seems more trouble than it's worth. */
+ return (strcmp (name, "m68hc11") == 0
+ || strcmp (name, "m68hc12") == 0
+ || strcmp (name, "m68hc12:HCS12") == 0);
+}
+
} /* namespace selftests */
#endif /* GDB_SELF_TEST */
diff --git a/gdb/selftest-arch.h b/gdb/selftest-arch.h
index db11723..c6a85fa 100644
--- a/gdb/selftest-arch.h
+++ b/gdb/selftest-arch.h
@@ -29,6 +29,11 @@ namespace selftests
extern void
register_test_foreach_arch (const std::string &name,
self_test_foreach_arch_function *function);
+
+/* Return true if GDBARCH should be skipped in some selftests to avoid
+ warnings. */
+
+extern bool selftest_skip_warning_arch (struct gdbarch *gdbarch);
}
#endif /* GDB_SELFTEST_ARCH_H */