aboutsummaryrefslogtreecommitdiff
path: root/gdb/arch-utils.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-03-08 10:58:35 -0700
committerTom Tromey <tromey@adacore.com>2023-04-21 07:14:22 -0600
commit9df25c346f5517c0228d067c68ee2f6bfe1728ad (patch)
treea4996b2b7c579cdd89e00e27d82e399c480bf5c8 /gdb/arch-utils.c
parent532d55c0ab4bda1d5da90c6301c7d28ddd98ad18 (diff)
downloadgdb-9df25c346f5517c0228d067c68ee2f6bfe1728ad.zip
gdb-9df25c346f5517c0228d067c68ee2f6bfe1728ad.tar.gz
gdb-9df25c346f5517c0228d067c68ee2f6bfe1728ad.tar.bz2
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.
Diffstat (limited to 'gdb/arch-utils.c')
-rw-r--r--gdb/arch-utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 997a292..1de5981 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1105,6 +1105,12 @@ default_dwarf2_omit_typedef_p (struct type *target_type, const char *producer,
return false;
}
+static CORE_ADDR
+default_update_call_site_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ return pc;
+}
+
/* Non-zero if we want to trace architecture code. */
#ifndef GDBARCH_DEBUG