From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id xxdOMjwuN2nSJyUAWB0awg (envelope-from ) for ; Mon, 08 Dec 2025 14:59:56 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VDOl4jju; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C0FB71E0B3; Mon, 08 Dec 2025 14:59:56 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DD58D1E08D for ; Mon, 08 Dec 2025 14:59:55 -0500 (EST) ARC-Filter: OpenARC Filter v1.0.0 server2.sourceware.org C74333858D2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=38.145.34.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1765223989; cv=none; b=j9s6jZGZRFO3abK4pY8CR+HyfxoDn0sVSoKJyWcu28Agig/179XG0PbNai3M6XBkp77CmIxy+tWTEjCEwd1KexrwQcQtqfeP92+IvWIPaKtq7TJHJTMhDOrr7u8yfxNkwHOWRqYHfrgkherFtg84yi3qyEtyaOtYT1TKNT8hxds= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1765223989; c=relaxed/simple; bh=OvDgVtfW0Sj+VjQrHenLxjMUJcRT/kAWm0bLp/1QPTo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=cZiXTFupW+QvaEPHnBlOiXiDxJbsFc9OjC61893vPjJqnfmVVXTFMDHgtwJlZDKZucaC3Znooc9b9fZEKY/QYQAVpAbIy10NyD2Ob914KwnxBRRJfwBt4CtFf35zNDZLhruCNXJgr8yot/trRfnjPY8Qj5Z23CeJTQ14uuhuzac= ARC-Authentication-Results: i=2; server2.sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VDOl4jju; arc=none smtp.remote-ip=170.10.129.124 DKIM-Filter: OpenDKIM Filter v2.11.0 server2.sourceware.org C74333858D2A Authentication-Results: server2.sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VDOl4jju Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 15FCF4AA0843 for ; Mon, 8 Dec 2025 19:54:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15FCF4AA0843 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VDOl4jju Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 6D5EA48EFFB6 for ; Mon, 8 Dec 2025 19:54:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6D5EA48EFFB6 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6D5EA48EFFB6 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765223662; cv=none; b=CGi80aEouYYvKidbXvxAdZ9W6LOpNsCF9mORJO+D5HJhBlfK/d8lm3X60on2ca4E6Ck4b513WggwJj95m05GSW1l/A+KJM/jyJC69jyFmA59veq4UxPsJF5FIkKQDLrM9yh090A3TfrjA7GkF1vtLs/EDiz6KMs2Cj00OzGaGEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765223662; c=relaxed/simple; bh=OvDgVtfW0Sj+VjQrHenLxjMUJcRT/kAWm0bLp/1QPTo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=gfFipjBTDfCCTFNSqPEEgY8wpRS1x8ikt+j2UQM+ny5gxxEV+FsAvu22SlB8CZP3I+1EbWSQTrCpfbrQ6JCh01ZgbdpNOIVbOUbLpUNfQIq8XQvNMTIoOBPMVjndhPSKnlLSMyx0AMTgROdfj8XsB/Avadc8gfUHWhMfFcT1GnM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D5EA48EFFB6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765223661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ArhWs0D/5WLMJYmTUCdIeq1SebaT/Xhmz1Zyrm/tFz8=; b=VDOl4jju9tFFbyZH7Ia3teZyi7HKQXpRYEPjb0z8pUA4Y8R6J6D+vwZ/LErvrNVhygxckK oUbczqdA+6zZC9o0McacY8BS0MT2TTqNrm6mMnDUYFu87u83CNvxAvudv4n56cssxv5sVS HydlR3xmz22n4kWlE8hA+WBqXJwzWDo= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-fHSorLtdMROGSgU6Pq1DjQ-1; Mon, 08 Dec 2025 14:54:20 -0500 X-MC-Unique: fHSorLtdMROGSgU6Pq1DjQ-1 X-Mimecast-MFC-AGG-ID: fHSorLtdMROGSgU6Pq1DjQ_1765223659 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 11CC41828AA5 for ; Mon, 8 Dec 2025 19:54:01 +0000 (UTC) Received: from f41-zbm-amd (unknown [10.22.88.34]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 225A9180044F for ; Mon, 8 Dec 2025 19:53:48 +0000 (UTC) Date: Mon, 8 Dec 2025 12:53:38 -0700 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.base/inline-frame-cycle-unwind.exp for s390x Message-ID: <20251208125338.02cc248e@f41-zbm-amd> In-Reply-To: <20251102044651.502973-1-kevinb@redhat.com> References: <20251102044651.502973-1-kevinb@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: YiTt6hDPWAfc25V89w5vHz7Ef-U1l4HaGaYHJja5mI0_1765223659 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Ping. On Sat, 1 Nov 2025 21:46:51 -0700 Kevin Buettner wrote: > This commit fixes six failures for s390x due to a fundamental > difference in unwinding behavior between s390x and other > architectures: > > FAIL: gdb.base/inline-frame-cycle-unwind.exp: bt: cycle at level 5: > backtrace when the unwind is broken at frame 5 > FAIL: gdb.base/inline-frame-cycle-unwind.exp: bt: cycle at level 3: > backtrace when the unwind is broken at frame 3 > FAIL: gdb.base/inline-frame-cycle-unwind.exp: bt: cycle at level 1: > backtrace when the unwind is broken at frame 1 > FAIL: gdb.base/inline-frame-cycle-unwind.exp: bt -no-filters: cycle at level 5: > backtrace when the unwind is broken at frame 5 > FAIL: gdb.base/inline-frame-cycle-unwind.exp: bt -no-filters: cycle at level 3: > backtrace when the unwind is broken at frame 3 > FAIL: gdb.base/inline-frame-cycle-unwind.exp: bt -no-filters: cycle at level 1: > backtrace when the unwind is broken at frame 1 > > The core issue is that on s390x, the Canonical Frame Address (CFA) for > a function points *into the caller's stack frame*, whereas on x86_64 > or aarch64 the CFA points *within the current function's frame*. This > architectural difference causes cycle detection to occur later on > s390x. > > The patch resolves this by: > - Making expected backtrace output architecture-specific. > - For non-s390x targets: expecting the full set of frames up to the > specified level. > - For s390x: expecting fewer frames before detecting the cycle > (e.g., level 5 shows 3 frames instead of 5). > - Skipping the cycle at level 1 test entirely on s390x since it cannot > be detected at that frame. > > Tested using recent Fedora releases on s390x, x86_64, and aarch64. > --- > .../gdb.base/inline-frame-cycle-unwind.exp | 81 +++++++++++++------ > 1 file changed, 57 insertions(+), 24 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp > index 7fc47af624f..ccd86eb79ab 100644 > --- a/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp > +++ b/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.exp > @@ -92,15 +92,31 @@ foreach bt_cmd { "bt" "bt -no-filters" } { > gdb_test_no_output "python stop_at_level=5" > gdb_test "maint flush register-cache" \ > "Register cache flushed\\." > + > + # Frames expected on all targets > + set exp [list \ > + "#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]*" \ > + "#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]*" \ > + "#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]*" \ > + "#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]*"] > + > + # Additional frames required on non-s390x targets > + if {![istarget "s390x*-*-*"]} { > + lappend exp \ > + "#4 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]*" \ > + "#5 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]*" > + } > + # > + # The final line that should appear for every target > + lappend exp \ > + "Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)" > + > + # Convert the list to the single string that gdb_test_lines expects. > + # (This is equivalent to [multi_line {*}$exp]). > + set expected [join $exp "\r\n"] > + > gdb_test_lines "$bt_cmd" "backtrace when the unwind is broken at frame 5" \ > - [multi_line \ > - "#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \ > - "#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \ > - "#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \ > - "#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \ > - "#4 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \ > - "#5 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \ > - "Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"] > + $expected > } > > with_test_prefix "cycle at level 3" { > @@ -108,25 +124,42 @@ foreach bt_cmd { "bt" "bt -no-filters" } { > gdb_test_no_output "python stop_at_level=3" > gdb_test "maint flush register-cache" \ > "Register cache flushed\\." > + # Frames expected on all targets > + set exp [list \ > + "#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]*" \ > + "#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]*"] > + > + # Additional frames required on non-s390x targets > + if {![istarget "s390x*-*-*"]} { > + lappend exp \ > + "#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]*" \ > + "#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]*" > + } > + # > + # The final line that should appear for every target > + lappend exp \ > + "Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)" > + > + # Convert the list to the single string that gdb_test_lines expects. > + # (This is equivalent to [multi_line {*}$exp]). > + set expected [join $exp "\r\n"] > + > gdb_test_lines "$bt_cmd" "backtrace when the unwind is broken at frame 3" \ > - [multi_line \ > - "#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \ > - "#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \ > - "#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \ > - "#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \ > - "Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"] > + $expected > } > > - with_test_prefix "cycle at level 1" { > - # Arrange to introduce a stack cycle at frame 1. > - gdb_test_no_output "python stop_at_level=1" > - gdb_test "maint flush register-cache" \ > - "Register cache flushed\\." > - gdb_test_lines "$bt_cmd" "backtrace when the unwind is broken at frame 1" \ > - [multi_line \ > - "#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \ > - "#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \ > - "Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"] > + if {![istarget "s390x*-*-*"]} { > + with_test_prefix "cycle at level 1" { > + # Arrange to introduce a stack cycle at frame 1. > + gdb_test_no_output "python stop_at_level=1" > + gdb_test "maint flush register-cache" \ > + "Register cache flushed\\." > + gdb_test_lines "$bt_cmd" "backtrace when the unwind is broken at frame 1" \ > + [multi_line \ > + "#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \ > + "#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \ > + "Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"] > + } > } > > # Flush the register cache (which also flushes the frame cache) so we > -- > 2.51.0 >