From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 1F3E2385841D for ; Mon, 28 Nov 2022 18:40:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F3E2385841D Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com X-ASG-Debug-ID: 1669660845-0c856e02a143f580001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id xJmL904Xz5E9saql (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Mon, 28 Nov 2022 13:40:45 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id 20923441D65; Mon, 28 Nov 2022 13:40:45 -0500 (EST) From: Simon Marchi X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Tiezhu Yang Subject: [PATCH gdb-12-branch 1/6] gdb: testsuite: add new gdb_attach to check "attach" command Date: Mon, 28 Nov 2022 13:40:37 -0500 X-ASG-Orig-Subj: [PATCH gdb-12-branch 1/6] gdb: testsuite: add new gdb_attach to check "attach" command Message-Id: <20221128184042.3781569-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221128184042.3781569-1-simon.marchi@efficios.com> References: <20221128184042.3781569-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1669660845 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 1418 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.102463 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3498.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_SOFTFAIL,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 List-Id: From: Tiezhu Yang 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 Change-Id: I553cf386cef60c67d38e331904b4aa01e132104a --- gdb/testsuite/lib/gdb.exp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 6f6acfe188a..819dfbfafca 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5151,6 +5151,32 @@ gdb_caching_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 + } + } + + return 0 +} + # Kill a progress previously started with spawn_wait_for_attach, and # reap its wait status. PROC_SPAWN_ID is the spawn id associated with # the process. -- 2.38.1