* [PATCH][gdb] Avoid warnings in cooked_{read,write}_test for m68hc11
@ 2022-06-07 8:02 Tom de Vries
2022-06-13 15:20 ` [committed][gdb] " Tom de Vries
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2022-06-07 8:02 UTC (permalink / raw)
To: gdb-patches
Hi,
With --enable-targets=all we have:
...
$ gdb -q -batch -ex "maint selftest"
...
Running selftest regcache::cooked_read_test::m68hc11.
warning: No frame soft register found in the symbol table.
Stack backtrace will not work.
Running selftest regcache::cooked_read_test::m68hc12.
warning: No frame soft register found in the symbol table.
Stack backtrace will not work.
Running selftest regcache::cooked_read_test::m68hc12:HCS12.
warning: No frame soft register found in the symbol table.
Stack backtrace will not work.
...
Likewise for regcache::cooked_write_test.
The warning has no use in the selftest context.
Fix this by skipping the specific selftests.
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29224
Any comments?
Thanks,
- Tom
[gdb] Avoid warnings in cooked_{read,write}_test for m68hc11
---
gdb/regcache.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 037659ef8fa..6fd4f86f4bf 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1812,12 +1812,34 @@ class readwrite_regcache : public regcache
{}
};
+/* 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))
+ return;
+
scoped_mock_context<target_ops_no_register> mockctx (gdbarch);
/* Test that read one raw register from regcache_no_target will go
@@ -1944,6 +1966,9 @@ cooked_read_test (struct gdbarch *gdbarch)
static void
cooked_write_test (struct gdbarch *gdbarch)
{
+ if (selftest_skiparch (gdbarch))
+ return;
+
/* Create a mock environment. A process_stratum target pushed. */
scoped_mock_context<target_ops_no_register> ctx (gdbarch);
readwrite_regcache readwrite (&ctx.mock_target, gdbarch);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [committed][gdb] Avoid warnings in cooked_{read,write}_test for m68hc11
2022-06-07 8:02 [PATCH][gdb] Avoid warnings in cooked_{read,write}_test for m68hc11 Tom de Vries
@ 2022-06-13 15:20 ` Tom de Vries
0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2022-06-13 15:20 UTC (permalink / raw)
To: gdb-patches
On 6/7/22 10:02, Tom de Vries via Gdb-patches wrote:
> Hi,
>
> With --enable-targets=all we have:
> ...
> $ gdb -q -batch -ex "maint selftest"
> ...
> Running selftest regcache::cooked_read_test::m68hc11.
> warning: No frame soft register found in the symbol table.
> Stack backtrace will not work.
> Running selftest regcache::cooked_read_test::m68hc12.
> warning: No frame soft register found in the symbol table.
> Stack backtrace will not work.
> Running selftest regcache::cooked_read_test::m68hc12:HCS12.
> warning: No frame soft register found in the symbol table.
> Stack backtrace will not work.
> ...
>
> Likewise for regcache::cooked_write_test.
>
> The warning has no use in the selftest context.
>
> Fix this by skipping the specific selftests.
>
> Tested on x86_64-linux.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29224
>
> Any comments?
>
Committed.
Thanks,
- Tom
> [gdb] Avoid warnings in cooked_{read,write}_test for m68hc11
>
> ---
> gdb/regcache.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/gdb/regcache.c b/gdb/regcache.c
> index 037659ef8fa..6fd4f86f4bf 100644
> --- a/gdb/regcache.c
> +++ b/gdb/regcache.c
> @@ -1812,12 +1812,34 @@ class readwrite_regcache : public regcache
> {}
> };
>
> +/* 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))
> + return;
> +
> scoped_mock_context<target_ops_no_register> mockctx (gdbarch);
>
> /* Test that read one raw register from regcache_no_target will go
> @@ -1944,6 +1966,9 @@ cooked_read_test (struct gdbarch *gdbarch)
> static void
> cooked_write_test (struct gdbarch *gdbarch)
> {
> + if (selftest_skiparch (gdbarch))
> + return;
> +
> /* Create a mock environment. A process_stratum target pushed. */
> scoped_mock_context<target_ops_no_register> ctx (gdbarch);
> readwrite_regcache readwrite (&ctx.mock_target, gdbarch);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-13 15:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 8:02 [PATCH][gdb] Avoid warnings in cooked_{read,write}_test for m68hc11 Tom de Vries
2022-06-13 15:20 ` [committed][gdb] " Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).