Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v1] gdb/testsuite: Fix skip-tree.exp for PowerPC post-call NOP
@ 2026-04-15  5:51 Abhay Kandpal
  2026-04-16 16:21 ` Andrew Burgess
  0 siblings, 1 reply; 2+ messages in thread
From: Abhay Kandpal @ 2026-04-15  5:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: aburgess, Ulrich.Weigand, cel, abhay.k, Abhay Kandpal

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-16 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-15  5:51 [PATCH v1] gdb/testsuite: Fix skip-tree.exp for PowerPC post-call NOP Abhay Kandpal
2026-04-16 16:21 ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox