From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id g1m5GqZrMGE+WgAAWB0awg (envelope-from ) for ; Thu, 02 Sep 2021 02:13:58 -0400 Received: by simark.ca (Postfix, from userid 112) id 4E8471EE22; Thu, 2 Sep 2021 02:13:58 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 148901EDDB for ; Thu, 2 Sep 2021 02:13:57 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 309F7385EC56 for ; Thu, 2 Sep 2021 06:13:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 309F7385EC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630563236; bh=tHX0lUgvlsXDbVgLllRVVxrJx8sAxHzqu2dV5PZShpQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=C4Sv6W207XVDSjjNAKxzLDG50CiOyUghV8/7tCDdlKQsVAqxVx5KLY9ohtDrgw/l6 sRpP8xZRYI5X1fEjpBKL/HOg6IGNaaV+VvgyVhdfMOqyuWWQlzOMHDkAQztLonT0mB cUy+8YTLU2EnKapfL9MPQdXiBFrfzNguFeF6MZps= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id EEBCB3857823 for ; Thu, 2 Sep 2021 06:13:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EEBCB3857823 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 2D07322575 for ; Thu, 2 Sep 2021 06:13:28 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 1AE551389C for ; Thu, 2 Sep 2021 06:13:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id zPBVBYhrMGEAKgAAGKfGzw (envelope-from ) for ; Thu, 02 Sep 2021 06:13:28 +0000 Date: Thu, 2 Sep 2021 08:13:26 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Add untested case in selftest_setup Message-ID: <20210902061325.GA29918@delia> 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, When building gdb with "-Wall -O2 -g -flto=auto", I run into: ... FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \ (got interactive prompt) FAIL: gdb.gdb/python-helper.exp: run until breakpoint at captured_main WARNING: Couldn't test self ... and similar in gdb.gdb/selftest.exp. The first FAIL in more detail: ... (gdb) break captured_main^M Function "captured_main" not defined.^M Make breakpoint pending on future shared library load? (y or [n]) n^M (gdb) FAIL: gdb.gdb/python-helper.exp: breakpoint in captured_main \ (got interactive prompt) ... The problem is that lto has optimized away the captured_main function and consequently the selftests dependent on that cannot run. Fix this by: - using gdb_breakpoint to detect failure to set the breakpoint - handling the failure to set a breakpoint by calling untested - not emitting the warning if we've already got untested such that we have: ... (gdb) UNTESTED: gdb.gdb/python-helper.exp: Cannot set breakpoint at \ captured_main, skipping testcase. ... Any comments? Thanks, - Tom [gdb/testsuite] Add untested case in selftest_setup gdb/testsuite/ChangeLog: 2021-09-02 Tom de Vries * lib/selftest-support.exp: Emit untested when not being able to set breakpoint. --- gdb/testsuite/lib/selftest-support.exp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp index 4b96bf4f5f6..325ea997d5e 100644 --- a/gdb/testsuite/lib/selftest-support.exp +++ b/gdb/testsuite/lib/selftest-support.exp @@ -40,6 +40,8 @@ proc find_gdb { arg } { # EXECUTABLE is the gdb to use. # FUNCTION is the function to break in, either captured_main # or captured_command_loop. +# Return 0 in case of success, -1 in case of failure, and -2 in case of +# skipping the test-case. proc selftest_setup { executable function } { global gdb_prompt @@ -73,14 +75,14 @@ proc selftest_setup { executable function } { if { $gdb_file_cmd_debug_info != "debug" } then { untested "no debug information, skipping testcase." - return -1 + return -2 } - # Set a breakpoint at main. Allow more than one location, as - # workaround for PR26096 - "gdb sets breakpoint at cold clone". - gdb_test "break $function" \ - "Breakpoint.*at.* (file.*, line|locations).*" \ - "breakpoint in $function" + # Set a breakpoint at $function. + if { [gdb_breakpoint $function "no-message"] != 1 } { + untested "Cannot set breakpoint at $function, skipping testcase." + return -2 + } # run yourself # It may take a very long time for the inferior gdb to start (lynx), @@ -165,7 +167,7 @@ proc do_self_tests {function body} { gdb_exit catch "remote_file host delete $file" - if {$result < 0} then { + if {$result == -1} then { warning "Couldn't test self" } }