gdb/testsuite: fix skip-tree.exp test for PowerPC
The gdb.base/skip-tree.exp test was added in commit:
commit 5ed98c177f9a2381fe5c6ab873d05f1e5dcb8f7f
Date: Wed Feb 4 20:31:31 2026 +0000
gdb: introduce '**' for skip globs
This test currently 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 issue was reported here:
https://inbox.sourceware.org/gdb-patches/20260415055144.2729164-1-abhay@linux.ibm.com
The fix proposed there was to add a PowerPC specific check so that the
test would send a `next` command after using `finish` to advance to
the expected source line.
This commit actually takes a more general approach. After calling
`finish` we check which line we ended up on. If it was the caller
line then we send GDB a `next` to move to the expected line. If we
arrive directly at the next line, then no `next` is needed.
I've tested this change on x86-64, where no `next` is needed, and
PowerPC, where `next` is now used as required to get the test
passing.
To simplify the pattern matching in the exp file, I tweaked the source
file slightly. But adding a call to a dummy 'func5' it's now easy to
pattern match as we step through 'func1', 'func2', etc.
Co-Authored-By: Abhay Kandpal <abhay@linux.ibm.com>
2 files changed