]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Handle erroneous DW_AT_call_return_pc
authorTom Tromey <tromey@adacore.com>
Wed, 8 Mar 2023 17:58:35 +0000 (10:58 -0700)
committerTom Tromey <tromey@adacore.com>
Fri, 21 Apr 2023 13:14:22 +0000 (07:14 -0600)
commit9df25c346f5517c0228d067c68ee2f6bfe1728ad
treea4996b2b7c579cdd89e00e27d82e399c480bf5c8
parent532d55c0ab4bda1d5da90c6301c7d28ddd98ad18
Handle erroneous DW_AT_call_return_pc

On PPC64, with the test case included in an earlier patch, we found
that "finish" would still not correctly find the return value via
entry values.

The issue is simple.  The compiler emits:

   0x00000000100032b8 <+28>: bl      0x1000320c <pck__create_large>
   0x00000000100032bc <+32>: nop
   0x00000000100032c0 <+36>: li      r9,42

... but the DWARF says:

    <162a>   DW_AT_call_return_pc: 0x100032c0

That is, the declared return PC is one instruction past the actual
return PC.

This patch adds a new arch hook to handle this scenario, and
implements it for PPC64.  Some care is taken so that GDB will continue
to work if this compiler bug is fixed.  A GCC patch is here:

    https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613336.html

No check for 'nop' is done, as subsequent discussion revealed that the
linker might replace this with another instruction.
gdb/arch-utils.c
gdb/gdbarch-gen.h
gdb/gdbarch.c
gdb/gdbarch_components.py
gdb/rs6000-tdep.c
gdb/symtab.c