From: Carl Love Date: Mon, 20 Mar 2023 20:59:33 +0000 (-0400) Subject: PowerPC: regression fix for reverse-finish command. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70ea5a46bd926149fb4a9c3da32c2fc14f6e83c3;p=binutils-gdb.git PowerPC: regression fix for reverse-finish command. The recent commit: commit 2a8339b71f37f2d02f5b2194929c9d702ef27223 Author: Carl Love 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. --- diff --git a/gdb/infcmd.c b/gdb/infcmd.c index f46461512fe..e2032d18564 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1710,8 +1710,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); @@ -1721,6 +1721,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.