Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.base/inline-frame-cycle-unwind.exp for s390x (alternative)
Date: Sat, 24 Jan 2026 16:19:35 -0700	[thread overview]
Message-ID: <20260124161834.6c4bac92@f42-mesa-1> (raw)
In-Reply-To: <20251211133946.962934-1-tdevries@suse.de>

Hi Tom,

On Thu, 11 Dec 2025 14:39:46 +0100
Tom de Vries <tdevries@suse.de> wrote:

> With test-case gdb.base/inline-frame-cycle-unwind.exp on s390x-linux, I
> run into:
> ...
>  (gdb) bt^M
>  #0  inline_func () at inline-frame-cycle-unwind.c:49^M
>  #1  normal_func () at inline-frame-cycle-unwind.c:32^M
>  #2  0x000000000100065c in inline_func () at
> inline-frame-cycle-unwind.c:45^M #3  normal_func () at
> inline-frame-cycle-unwind.c:32^M Backtrace stopped: previous frame
> identical to this frame (corrupt stack?)^M (gdb) FAIL: $exp: bt: cycle at
> level 5: backtrace when the unwind is broken \ at frame 5
> ...
> 
> In contrast, on x86_64-linux, I get:
> ...
>  (gdb) bt^M
>  #0  inline_func () at inline-frame-cycle-unwind.c:49^M
>  #1  normal_func () at inline-frame-cycle-unwind.c:32^M
>  #2  0x0000000000401157 in inline_func () at
> inline-frame-cycle-unwind.c:45^M #3  normal_func () at
> inline-frame-cycle-unwind.c:32^M #4  0x0000000000401157 in inline_func ()
> at inline-frame-cycle-unwind.c:45^M #5  normal_func () at
> inline-frame-cycle-unwind.c:32^M Backtrace stopped: previous frame
> identical to this frame (corrupt stack?)^M (gdb) PASS: $exp: bt: cycle at
> level 5: backtrace when the unwind is broken \ at frame 5
> ...
> 
> AFAIU, the mechanism of the test is as follows: the custom unwinder
> produces the frame-id for frame #5 at frame #4.  Consequently, when
> arriving at frame #5, a cycle is detected.
> 
> [ It took me a while to understand this because of the following
> off-by-one confusion: for frame #0, we get pending_frame.level() == 1.
> So when stop_at_level == 5, the custom unwinder calculates a frame-id for
> frame #4, not frame #5.  But the frame-id it calculates is the one for
> frame #5, so unwinding will stop at frame #5 because the frame-ids for
> frame #4 and frame #5 are identical. ]
> 
> This relies on the test-case to calculate the offending frame-id, and the
> problem on s390x is that that calculation is incorrect.
> 
> Fix this by using "maint print frame-id" to get all frame-ids, and using
> those instead.

Thanks for looking into this.  I like this approach better the one
that I took - fixing the frame-id source so the test works uniformly
across architectures is cleaner than adjusting expectations
per architecture.

One issue: I think that your patch leaves some dead code in the
Python file.  With stack_adjust no longer used, it seems to me that
the following should be removed:

1. The variable declaration / initialization:

   stack_adjust = None

2. The check:

    if stack_adjust is None:
      raise gdb.GdbError("invalid stack_adjust")

3. The computation at module load time:

    f0 = gdb.newest_frame()
    f1 = f0.older()
    f2 = f1.older()
    f0_sp = f0.read_register("sp")
    f2_sp = f2.read_register("sp")
    stack_adjust = f2_sp - f0_sp

Kevin


      parent reply	other threads:[~2026-01-24 23:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 13:39 Tom de Vries
2026-01-03 15:12 ` [PING][PATCH] " Tom de Vries
2026-01-19 18:36   ` [PING^2][PATCH] " Tom de Vries
2026-01-20 10:38 ` [PATCH] " Andrew Burgess
2026-01-20 14:30 ` Andrew Burgess
2026-01-20 20:38   ` Andrew Burgess
2026-01-21 13:09     ` Tom de Vries
2026-01-21 13:32   ` Tom de Vries
2026-01-21 16:50     ` Andrew Burgess
2026-01-24 23:19 ` Kevin Buettner [this message]

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=20260124161834.6c4bac92@f42-mesa-1 \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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