[Bug breakpoints/33989] [gdb/breakpoints] FAIL: gdb.python/py-finish-breakpoint-tailcall.exp: parent_frame=true: create finish breakpoint

"cvs-commit at gcc dot gnu.org via Gdb-prs" <[email protected]> Fri, 31 Jul 2026 14:50:20 +0000
Newsgroups gmane.comp.gdb.bugs.discuss
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=3D33989

--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <[email protected]>:

https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df100243d1f10=
2567e639d9e0c2c3da3185835b54

commit f100243d1f102567e639d9e0c2c3da3185835b54
Author: Tom de Vries <[email protected]>
Date:   Fri Jul 31 16:50:15 2026 +0200

    [gdb/testsuite] Fix gdb.python/py-finish-breakpoint-tailcall.exp with g=
cc
16

    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=3Dtrue: 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=3Dtrue: 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 =3D tailcall_function (42);
        43    result -=3D 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_functio=
n>
      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 aft=
er
the
    call is 43:
    ...
    File name                        Line number  Starting address    View=
=20=20=20
Stmt
    py-finish-breakpoint-tailcall.c           43          0x40102a=20=20=20=
=20=20=20=20=20=20=20=20=20=20
 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_functio=
n>
      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=
=20=20=20
Stmt
    py-finish-breakpoint-tailcall.c           43          0x40102a=20=20=20=
=20=20=20=20=20=20=20=20=20=20
 x
    py-finish-breakpoint-tailcall.c           44          0x40102a       1=
=20=20=20=20=20
 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 -=3D 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 com=
mit
    that introduced the test-case still makes the test-case fail.

    Approved-By: Andrew Burgess <[email protected]>

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D33989

--=20
You are receiving this mail because:
You are on the CC list for the bug.=