From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IJbnFhMGn2KEKQsAWB0awg (envelope-from ) for ; Tue, 07 Jun 2022 04:02:27 -0400 Received: by simark.ca (Postfix, from userid 112) id 5A7521E222; Tue, 7 Jun 2022 04:02:27 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=X20yvd9k; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DE8FA1E220 for ; Tue, 7 Jun 2022 04:02:26 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 45391382CCBB for ; Tue, 7 Jun 2022 08:02:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 45391382CCBB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1654588946; bh=SWMT8z6K1FLPeH4cS6C71Obacsd2Ifz6HsX29TxSw/8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=X20yvd9kH8359Rt69w9CI3w843Sh2mMYnFyqwh8lD9DM3aSmdtSfz2LQaCvLIVmV6 tpnd00vlSYg7lcBjNXro8Z4SJgIARxSw/VviazIGz7BNzWWKoXwnmTv3sBc9Gw9js9 i/eg3JtlWG9qqVwU3GlYfRh4mV9DuoAagEaTWVJU= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 1EB2A382CCA9 for ; Tue, 7 Jun 2022 08:02:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1EB2A382CCA9 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-out1.suse.de (Postfix) with ESMTPS id 3FC9521B50 for ; Tue, 7 Jun 2022 08:02:02 +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 2C9FC13A88 for ; Tue, 7 Jun 2022 08:02:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aSO5CfoFn2JzCwAAMHmgww (envelope-from ) for ; Tue, 07 Jun 2022 08:02:02 +0000 Date: Tue, 7 Jun 2022 10:02:00 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb] Avoid warnings in cooked_{read,write}_test for m68hc11 Message-ID: <20220607080158.GA11931@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "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 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);