From patchwork Mon Mar 13 16:20:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66298 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C6FBE3858004 for ; Mon, 13 Mar 2023 16:21:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6FBE3858004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678724476; bh=+bwcH1V97hi7/dcZZ6+pJoVVeIwldNxEiGDQNDzhZr8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gcJBNqMj/hSKg0aoScFV7/Dvnsn1OyoZD7y40Iww3/qbxN3LpT3xtUrnwN5pHdfAD gmKemueQBJRlIQiPQlQlV7jIuwQIJKNvQ2z9q4y9ocbyHvCrY/TFke3V4y4aOr58O8 xUOy7DV/13qKNbSpXKiyJIqcvtOLuLGjIS9SYNOY= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id AE8BB3858409 for ; Mon, 13 Mar 2023 16:20:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE8BB3858409 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 DFB8022ACD for ; Mon, 13 Mar 2023 16:20:51 +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 CDB0B13517 for ; Mon, 13 Mar 2023 16:20:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UN0jMWNND2QbDAAAMHmgww (envelope-from ) for ; Mon, 13 Mar 2023 16:20:51 +0000 To: gdb-patches@sourceware.org Subject: [pushed 1/8] [gdb/testsuite] Fix untested message in gdb.tui/corefile-run.exp Date: Mon, 13 Mar 2023 17:20:44 +0100 Message-Id: <20230313162051.488-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230313162051.488-1-tdevries@suse.de> References: <20230313162051.488-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP 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-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In test-case gdb.tui/corefile-run.exp, we have this bit: ... require !use_gdb_stub if { [target_info gdb_protocol] == "extended-remote" } { untested "not supported" return } ... So with target board native-gdbserver we get: ... UNSUPPORTED: gdb.tui/corefile-run.exp: require failed: !use_gdb_stub ... and with target board native-extended-gdbserver instead: ... UNTESTED: gdb.tui/corefile-run.exp: not supported ... Fix this by: - adding an optional argument target_description to proc target_can_use_run_cmd - handling the target_description == core && [target_info gdb_protocol] == "extended-remote" case in the proc - using require {target_can_use_run_cmd core} such that now in both cases we have: ... UNSUPPORTED: gdb.tui/corefile-run.exp: require failed: \ target_can_use_run_cmd core ... Tested on x86_64-linux. --- gdb/testsuite/gdb.tui/corefile-run.exp | 6 +----- gdb/testsuite/lib/gdb.exp | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp index 02606ee286d..2109a0ae3eb 100644 --- a/gdb/testsuite/gdb.tui/corefile-run.exp +++ b/gdb/testsuite/gdb.tui/corefile-run.exp @@ -29,11 +29,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { } # Only run on native boards. -require !use_gdb_stub -if { [target_info gdb_protocol] == "extended-remote" } { - untested "not supported" - return -} +require {target_can_use_run_cmd core} if { ![runto_main] } { return -1 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e2b08c64eae..23277c4ab79 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -385,13 +385,33 @@ proc delete_breakpoints {} { # Returns true iff the target supports using the "run" command. -proc target_can_use_run_cmd {} { +proc target_can_use_run_cmd { {target_description ""} } { + if { $target_description == "" } { + set have_core 0 + } elseif { $target_description == "core" } { + # We could try to figure this out by issuing an "info target" and + # checking for "Local core dump file:", but it would mean the proc + # would start requiring a current target. Also, uses while gdb + # produces non-standard output due to, say annotations would + # have to be moved around or eliminated, which would further limit + # usability. + set have_core 1 + } else { + error "invalid argument: $target_description" + } + if [target_info exists use_gdb_stub] { # In this case, when we connect, the inferior is already # running. return 0 } + if { $have_core && [target_info gdb_protocol] == "extended-remote" } { + # In this case, when we connect, the inferior is not running but + # cannot be made to run. + return 0 + } + # Assume yes. return 1 }