From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id ED26B3852767 for ; Mon, 13 Jun 2022 15:20:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED26B3852767 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C36BE1F37C for ; Mon, 13 Jun 2022 15:20:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B2DCC13443 for ; Mon, 13 Jun 2022 15:20:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id tPVzKtZVp2K9WAAAMHmgww (envelope-from ) for ; Mon, 13 Jun 2022 15:20:54 +0000 Message-ID: <0a72be99-01a1-79af-a807-b02028a00734@suse.de> Date: Mon, 13 Jun 2022 17:20:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: [committed][gdb] Avoid warnings in cooked_{read,write}_test for m68hc11 Content-Language: en-US To: gdb-patches@sourceware.org References: <20220607080158.GA11931@delia.home> From: Tom de Vries In-Reply-To: <20220607080158.GA11931@delia.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2022 15:20:58 -0000 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 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 ctx (gdbarch); > readwrite_regcache readwrite (&ctx.mock_target, gdbarch);