From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3AD543888825 for ; Fri, 18 Mar 2022 20:43:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3AD543888825 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-17-p7vuQ7N6PympxSmMpdeDLQ-1; Fri, 18 Mar 2022 16:43:56 -0400 X-MC-Unique: p7vuQ7N6PympxSmMpdeDLQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CEBAF811E80; Fri, 18 Mar 2022 20:43:55 +0000 (UTC) Received: from f35-zws-1 (unknown [10.2.18.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 506D6403373; Fri, 18 Mar 2022 20:43:55 +0000 (UTC) Date: Fri, 18 Mar 2022 13:43:53 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org, Tiezhu Yang Subject: Re: [PATCH v5 2/2] gdb: testsuite: fix wrong expected result in attach-pie-noexec.exp Message-ID: <20220318134353.5dd21787@f35-zws-1> In-Reply-To: <20220318130723.469573af@f35-zws-1> References: <1645584316-5375-1-git-send-email-yangtiezhu@loongson.cn> <1645584316-5375-3-git-send-email-yangtiezhu@loongson.cn> <20220318130723.469573af@f35-zws-1> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Fri, 18 Mar 2022 20:43:59 -0000 I've spent a few more minutes looking at the current version of can_spawn_for_attach. The latter part of it currently looks like this: ... gdb_test_multiple "attach $test_pid" "can spawn for attach" { -re -wrap "Attaching to process $test_pid\r\n.*No executable file now.*" { pass $gdb_test_name kill_wait_spawned_process $test_spawn_id return 1 } -re -wrap "Attaching to process $test_pid\r\n.*ptrace: Operation not permitted\\." { unsupported "$gdb_test_name (Operation not permitted)" kill_wait_spawned_process $test_spawn_id return 0 } -re -wrap "Attaching to process $test_pid\r\n.*Attaching to process $test_pid failed" { unsupported "$gdb_test_name (Attaching to process failed)" kill_wait_spawned_process $test_spawn_id return 0 } -re -wrap "Attaching to process $test_pid\r\n.*XML support was disabled at compile time.*" { pass $gdb_test_name kill_wait_spawned_process $test_spawn_id return 1 } -re "A program is being debugged already. Kill it. .y or n. " { send_gdb "y\n" exp_continue } } kill_wait_spawned_process $test_spawn_id # Assume yes. return 1 } Note that there are return statements for all but one of the gdb_test_multiple cases with a final return (assuming yes) at the end of the proc. Assuming "yes" seems wrong to me; when gdb_test_multiple fails (due to not matching any of the explicit REs), it'll FAIL. I think we should be returning 0 when that happens. However, this means that you'll need to match all cases which should pass and return 1 for those cases. I also think you revisit Pedro's remarks regarding caching procs passing or failing here: https://sourceware.org/pipermail/gdb-patches/2022-March/186311.html Kevin