gdb/powerpc-regression-fix-for-reverse-finish-command.patch

75 lines
2.7 KiB
Diff

From 64870827ac45e94375c3a217b9131de69fc5b753 Mon Sep 17 00:00:00 2001
From: Carl Love <cel@us.ibm.com>
Date: Mon, 20 Mar 2023 16:59:33 -0400
Subject: [PATCH 6/9] PowerPC: regression fix for reverse-finish command.
The recent commit:
commit 2a8339b71f37f2d02f5b2194929c9d702ef27223
Author: Carl Love <cel@us.ibm.com>
Date: Thu Mar 9 16:10:18 2023 -0500
PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp
PPC64 multiple entry points, a normal entry point and an alternate entry
point. The alternate entry point is to setup the Table of Contents (TOC)
register before continuing at the normal entry point. When the TOC is
already valid, the normal entry point is used, this is typically the case.
The alternate entry point is typically referred to as the global entry
point (GEP) in IBM. The normal entry point is typically referred to as
the local entry point (LEP).
.....
Is causing regression failures on on PowerPC platforms. The regression
failures are in tests:
gdb.reverse/finish-precsave.exp
gdb.btrace/tailcall.exp
gdb.mi/mi-reverse.exp
gdb.btrace/step.exp
gdb.reverse/until-precsave.exp
gdb.reverse/finish-reverse.exp
gdb.btrace/tailcall-only.exp
The issue is in gdb/infcmd.c, function finish_command. The value of the
two new variables ALT_ENTRY_POINT and ENTRY_POINT are being initializezed
to SAL.PC. However, SAL has just been declared. The value of SAL.PC is
zero at this point. The intialization of ALT_ENTRY_POINT and ENTRY_POINT
needs to be after the initialization of SAL.
This patch moves the initialization of ALT_ENTRY_POINT and ENTRY_POINT
variables to fix the regression failures.
The patch has been tested on Power10 and on X86.
---
gdb/infcmd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 313fe2e025e..d94dc0c059d 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1714,8 +1714,8 @@ finish_backward (struct finish_command_fsm *sm)
struct thread_info *tp = inferior_thread ();
CORE_ADDR pc;
CORE_ADDR func_addr;
- CORE_ADDR alt_entry_point = sal.pc;
- CORE_ADDR entry_point = alt_entry_point;
+ CORE_ADDR alt_entry_point;
+ CORE_ADDR entry_point;
frame_info_ptr frame = get_selected_frame (nullptr);
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1725,6 +1725,8 @@ finish_backward (struct finish_command_fsm *sm)
error (_("Cannot find bounds of current function"));
sal = find_pc_line (func_addr, 0);
+ alt_entry_point = sal.pc;
+ entry_point = alt_entry_point;
if (gdbarch_skip_entrypoint_p (gdbarch))
/* Some architectures, like PowerPC use local and global entry points.
--
2.35.3