Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Abhay Kandpal <abhay@linux.ibm.com>
To: gdb-patches@sourceware.org
Cc: aburgess@redhat.com, Ulrich.Weigand@de.ibm.com,
	cel@linux.ibm.com, abhay.k@ibm.com,
	Abhay Kandpal <abhay@linux.ibm.com>
Subject: [PATCH v1] gdb/testsuite: Fix skip-tree.exp for PowerPC post-call NOP
Date: Wed, 15 Apr 2026 00:51:44 -0500	[thread overview]
Message-ID: <20260415055144.2729164-1-abhay@linux.ibm.com> (raw)

The skip-tree.exp test was recently added in commit 5ed98c177f9a
and fails on PowerPC due to architectural differences in function
return handling.

On PowerPC64 ELFv2, calls to external functions are followed by a
`nop` instruction that serves as a placeholder for TOC pointer
restoration. Since this `nop` typically has no DWARF line entry,
`finish` reports the call line instead of the next line.

This patch adds a PowerPC-specific `next` command after `finish` in
skip-tree.exp to advance to the expected source line. This handles
the architectural difference without changing GDB's core behavior.

Tested on ppc64le, x86_64-linux.

gdb/testsuite/
	* gdb.base/skip-tree.exp (run_test): Add PowerPC-specific
	handling after `finish` command by issuing an extra `next`.
---
This patch is reg tested.

 gdb/testsuite/gdb.base/skip-tree.exp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.base/skip-tree.exp b/gdb/testsuite/gdb.base/skip-tree.exp
index dc93c4cef84..c2504e75979 100644
--- a/gdb/testsuite/gdb.base/skip-tree.exp
+++ b/gdb/testsuite/gdb.base/skip-tree.exp
@@ -140,8 +140,18 @@ proc run_test { file_glob skip_func1 skip_func2 skip_func3 skip_func4 \
 		"step into func$i"
 
 	    # Now finish the function, returning to the caller.
-	    gdb_test "finish" ".*" \
-		"finish from func$i"
+	    if { [istarget "powerpc*-*-*"] } {
+	    # On PowerPC, finish may land on call line due to post-call NOP
+	    # that lacks a DWARF line entry. We need an extra 'next' to reach
+	    # the next statement.
+		gdb_test "finish" ".*" \
+		    "finish from func$i"
+		gdb_test "next" ".*" \
+		    "next after finish from func$i"
+	    } else {
+		gdb_test "finish" ".*" \
+		    "finish from func$i"
+	    }
 	} else {
 	    # After skipping the function, on which line should we
 	    # stop, and what does the line look like.
-- 
2.47.3


             reply	other threads:[~2026-04-15  5:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15  5:51 Abhay Kandpal [this message]
2026-04-16 16:21 ` Andrew Burgess

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=20260415055144.2729164-1-abhay@linux.ibm.com \
    --to=abhay@linux.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=abhay.k@ibm.com \
    --cc=aburgess@redhat.com \
    --cc=cel@linux.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /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