From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/testsuite] Fix gdb.python/py-finish-breakpoint-tailcall.exp with gcc 16
Date: Fri, 31 Jul 2026 11:35:08 +0200 [thread overview]
Message-ID: <20260731093508.3717972-1-tdevries@suse.de> (raw)
On openSUSE Leap 16.0, with gcc 15.3.0, for test-case
gdb.python/py-finish-breakpoint-tailcall.exp I get:
...
(gdb) python MyFinishBreakpoint(frame)
Temporary breakpoint 2 at 0x40102a: file py-finish-breakpoint-tailcall.c, \
line 43.
(gdb) PASS: $exp: parent_frame=true: create finish breakpoint
...
And on openSUSE Tumbleweed, with gcc 16.1.1 I get instead:
...
(gdb) python MyFinishBreakpoint(frame)
Temporary breakpoint 2 at 0x40102a: file py-finish-breakpoint-tailcall.c, \
line 44.
(gdb) FAIL: $exp: parent_frame=true: create finish breakpoint
...
The only difference is in the line numbers, 43 and 44, both in main:
...
39 int
40 main (void)
41 {
42 int result = tailcall_function (42);
43 result -= global_var; /* Temporary breakpoint here. */
44 return result;
45 }
...
The executable is compiled with O2, and the code for main is different.
With gcc 15, we have:
...
0000000000401020 <main>:
401020: bf 2a 00 00 00 mov $0x2a,%edi
401025: e8 26 01 00 00 call 401150 <tailcall_function>
40102a: 8b 15 e0 2f 00 00 mov 0x2fe0(%rip),%edx
401030: 29 d0 sub %edx,%eax
401032: c3 ret
...
and the line number associated with 0x40102a, the first instruction after the
call is 43:
...
File name Line number Starting address View Stmt
py-finish-breakpoint-tailcall.c 43 0x40102a x
...
With gcc 16, the mov and sub have been merged:
...
0000000000401020 <main>:
401020: bf 2a 00 00 00 mov $0x2a,%edi
401025: e8 26 01 00 00 call 401150 <tailcall_function>
40102a: 2b 05 e0 2f 00 00 sub 0x2fe0(%rip),%eax
401030: c3 ret
...
and the line number info is different:
...
File name Line number Starting address View Stmt
py-finish-breakpoint-tailcall.c 43 0x40102a x
py-finish-breakpoint-tailcall.c 44 0x40102a 1 x
py-finish-breakpoint-tailcall.c 43 0x40102a 2
...
and gdb picks 44 in this case.
Fix this by merging lines 43 and 44 in the test-case:
...
- result -= global_var; /* Temporary breakpoint here. */
- return result;
+ return result - global_var; /* Temporary breakpoint here. */
...
Tested on x86_64-linux.
I've also verified that reverting the fix in commit e6bdfed6f5d ("gdb: fix
frame_unwind_caller_WHAT functions for inline and tail calls"), the commit
that introduced the test-case still makes the test-case fail.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33989
---
gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.c b/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.c
index d129d7e41b4..844ac1d2ea6 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.c
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.c
@@ -40,6 +40,5 @@ int
main (void)
{
int result = tailcall_function (42);
- result -= global_var; /* Temporary breakpoint here. */
- return result;
+ return result - global_var; /* Temporary breakpoint here. */
}
base-commit: 6d1be0b90e837e4c82eaaf6f9e8c7da7227902e1
--
2.51.0
next reply other threads:[~2026-07-31 9:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 9:35 Tom de Vries [this message]
2026-07-31 13:49 ` 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=20260731093508.3717972-1-tdevries@suse.de \
--to=tdevries@suse.de \
--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