From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 104EF3852767; Mon, 13 Jun 2022 15:20:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 104EF3852767 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb] Avoid warnings in cooked_{read, write}_test for m68hc11 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 208b57e53ed98106d20c7314e88d0a7225a8aa1d X-Git-Newrev: c722093960edc1291df0a19ab0136fdb8934bdc2 Message-Id: <20220613152011.104EF3852767@sourceware.org> Date: Mon, 13 Jun 2022 15:20:11 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2022 15:20:11 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc722093960ed= c1291df0a19ab0136fdb8934bdc2 commit c722093960edc1291df0a19ab0136fdb8934bdc2 Author: Tom de Vries Date: Mon Jun 13 17:20:07 2022 +0200 [gdb] Avoid warnings in cooked_{read,write}_test for m68hc11 =20 With --enable-targets=3Dall 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. ... =20 Likewise for regcache::cooked_write_test. =20 The warning has no use in the selftest context. =20 Fix this by skipping the specific selftests. =20 Tested on x86_64-linux. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29224 Diff: --- 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 @@ public: {} }; =20 +/* Return true if regcache::cooked_{read,write}_test should be skipped for + GDBARCH. */ + +static bool +selftest_skiparch (struct gdbarch *gdbarch) +{ + const char *name =3D 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") =3D=3D 0 + || strcmp (name, "m68hc12") =3D=3D 0 + || strcmp (name, "m68hc12:HCS12") =3D=3D 0); +} + /* Test regcache::cooked_read gets registers from raw registers and memory instead of target to_{fetch,store}_registers. */ =20 static void cooked_read_test (struct gdbarch *gdbarch) { + if (selftest_skiparch (gdbarch)) + return; + scoped_mock_context mockctx (gdbarch); =20 /* 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 ctx (gdbarch); readwrite_regcache readwrite (&ctx.mock_target, gdbarch);