From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id FKMUMiyTOGLPIAAAWB0awg (envelope-from ) for ; Mon, 21 Mar 2022 11:01:00 -0400 Received: by simark.ca (Postfix, from userid 112) id C4BF11F3CE; Mon, 21 Mar 2022 11:01:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 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 0673F1F0BB for ; Mon, 21 Mar 2022 11:01:00 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A5926385EC57 for ; Mon, 21 Mar 2022 15:00:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5926385EC57 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1647874859; bh=gbcSjW5jq7g0VS97D0jA9sQeOEmWOfSEG87UMKO/uYM=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=K6xambac427rquR25tsNOtJQXxiERLc/M3ha78P9odQ1B8PDdvfQUMRerydQuAsmK e0nQmL8nfw6A9ju0RbxDzoMbBERh80+ykft+JMjpSkY5h9DympfiFGyUh5ySRvoXb/ GKN0lHIO04qY3C/NTAivW4WFj0ZDlLFH+O4HVnvY= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 605D43858403 for ; Mon, 21 Mar 2022 15:00:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 605D43858403 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 22LF0Qgp018545 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Mar 2022 11:00:31 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 22LF0Qgp018545 Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4B8FE1F0BB; Mon, 21 Mar 2022 11:00:26 -0400 (EDT) Message-ID: <54270fdb-4067-4be9-7621-e12f2d2e2361@polymtl.ca> Date: Mon, 21 Mar 2022 11:00:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4 2/4] gdb: testsuite: add new gdb_attach to check "attach" command Content-Language: tl To: Tiezhu Yang , gdb-patches@sourceware.org References: <1647655887-13964-1-git-send-email-yangtiezhu@loongson.cn> <1647655887-13964-3-git-send-email-yangtiezhu@loongson.cn> In-Reply-To: <1647655887-13964-3-git-send-email-yangtiezhu@loongson.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 21 Mar 2022 15:00:26 +0000 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: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Pedro Alves Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-03-18 22:11, Tiezhu Yang wrote: > This commit adds new gdb_attach to centralize the failure checking of > "attach" command. Return 0 if attach failed, otherwise return 1. > > Signed-off-by: Tiezhu Yang > --- > gdb/testsuite/lib/gdb.exp | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 89dcd0a..149a1c3 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -5111,6 +5111,30 @@ proc can_spawn_for_attach { } { > return 1 > } > > +# Centralize the failure checking of "attach" command. > +# Return 0 if attach failed, otherwise return 1. > + > +proc gdb_attach { testpid args } { > + parse_args { > + {pattern ""} > + } > + > + if { [llength $args] != 0 } { > + error "Unexpected arguments: $args" > + } > + > + gdb_test_multiple "attach $testpid" "attach" { > + -re -wrap "Attaching to.*ptrace: Operation not permitted\\." { > + unsupported "$gdb_test_name (Operation not permitted)" > + return 0 > + } > + -re -wrap "$pattern" { > + pass $gdb_test_name > + return 1 > + } > + } > +} I guess we need a "return 0" at the end of the function, in case the test does fail? Simon