From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hy6RNrPiBmmbERkAWB0awg (envelope-from ) for ; Sun, 02 Nov 2025 00:48:51 -0400 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=FH9rIvd2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CF23D1E057; Sun, 02 Nov 2025 00:48:51 -0400 (EDT) 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 BED8D1E057 for ; Sun, 02 Nov 2025 00:48:50 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DDCB13858C31 for ; Sun, 2 Nov 2025 04:48:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDCB13858C31 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=FH9rIvd2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 28DCD3858D26 for ; Sun, 2 Nov 2025 04:47:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 28DCD3858D26 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 28DCD3858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762058879; cv=none; b=S/+ricOnrPEXJvLRqlo9B509znDI6rVXhWMDfhhi/yJOYHkdGwpvbu8Eg+vRXm/jnXQpM8wwfEcXSP7tnhxTDwPrStYrycu1e7WwndzyA3oiaANX6EQJ+YF5AyIo3q+2Ek9oWYlmn2AA1u9D8vAwLsGdIOBQv8dggtYF6s5BEn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762058879; c=relaxed/simple; bh=Q8GZ8IXvspEt1i1pFhQUC1nVWfYg6xHySqm0NapYEv8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KsjTakEuZa0BC6bv7aAd5ccVYLDC3vx5yajaAiVT3x1R2NIbZp6T0tUt6XiCjyL3jF58x34vjBl0eHUFrseQg0KRCq52WLid0O6HvEXXmsC21Px3O1fk9gCKUh6vf1Ph4uSw+Wd1aFUheWZqpio5brYTUxIecfxSs3oFwhmaF4k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28DCD3858D26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762058878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+PSCkz+q8fAULBueOpUZ+W32bKwmQiNrszgNL209188=; b=FH9rIvd2aWlWlZf8VffMd4S1GgddKjSDMTgLzRA9TEhHg5Eh3MgbXQHtYDmBtbQSE+bVa2 qlH6eTZY/FBGVBmInamH1KvbCBHp34IVTIz/A22jJZGDjFeJekF0gnW1GJGzMFXpnGsUiW T+XIxWC8/5R0zUSXNnIe/HdPRg1j85s= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-228-7bUnKzbwP5-XLZoaW-FCsw-1; Sun, 02 Nov 2025 00:47:22 -0400 X-MC-Unique: 7bUnKzbwP5-XLZoaW-FCsw-1 X-Mimecast-MFC-AGG-ID: 7bUnKzbwP5-XLZoaW-FCsw_1762058841 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A2BED1956095 for ; Sun, 2 Nov 2025 04:47:21 +0000 (UTC) Received: from f42-1.lan (unknown [10.22.64.25]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CF3AD1955BE3; Sun, 2 Nov 2025 04:47:20 +0000 (UTC) From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Kevin Buettner Subject: [PATCH] [gdb/testsuite] Fix gdb.base/inline-frame-cycle-unwind.exp for s390x Date: Sat, 1 Nov 2025 21:46:51 -0700 Message-ID: <20251102044651.502973-1-kevinb@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: TdWUXLZ8nK30Ieiu76Y7FnIru_0mftTjbXn-tsZmAx8_1762058841 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 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