From: Simon Marchi <simark@simark.ca>
To: Kevin Buettner <kevinb@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.base/inline-frame-cycle-unwind.exp for s390x
Date: Tue, 9 Dec 2025 14:53:59 -0500 [thread overview]
Message-ID: <0a18d3d7-8687-43cf-9598-90ab52af86bd@simark.ca> (raw)
In-Reply-To: <20251208125338.02cc248e@f41-zbm-amd>
On 12/8/25 2:53 PM, Kevin Buettner wrote:
> Ping.
>
> On Sat, 1 Nov 2025 21:46:51 -0700
> Kevin Buettner <kevinb@redhat.com> 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.
I can't comment on the s390x-specific details, but code-wise the patch
LGTM. Tom de Vries might have an opinion, he was doing some s390x fixes
recently.
Some nits below.
>> ---
>> .../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
Unexpected `#` by itself above.
>> @@ -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
Likewise.
Simon
next prev parent reply other threads:[~2025-12-09 19:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-02 4:46 Kevin Buettner
2025-12-08 19:53 ` Kevin Buettner
2025-12-09 19:53 ` Simon Marchi [this message]
2025-12-11 13:50 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0a18d3d7-8687-43cf-9598-90ab52af86bd@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox