public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] finish-reverse fix for setting break on correct entry point when executing in reverse.
@ 2021-07-09 21:22 Carl Love
  2021-07-21 16:39 ` Carl Love
  0 siblings, 1 reply; 6+ messages in thread
From: Carl Love @ 2021-07-09 21:22 UTC (permalink / raw)
  To: gdb-patches; +Cc: cel, Will Schmidt, Rogerio Alves, Ulrich Weigand

GDB maintainers:

The following patch fixes issues with reverse execution on PPC64. 
PPC64 has the concept of local and remote entry points to a function. 
Currently the reverse execution sets a break point on the gloabal
function entry point even if the forward execution entered via the
local entry point.  The issue is that when executing a reverse step,
the breakpoint on the function is not seen since reverse execution
follows the local entry point.  Thus the finish command doesn't stop at
the begining of the function but rather at the next breakpoint
encountered.  

This patch corrects the problem by calling the function
gdbarch_skip_entrypoint to update the sal.pc if needed so the
breakpoint that gets set is for the local entry point.

The patch has been tested on Power 9, Power 10 and X86 64bit with no
regressions.  

The patch fixes 11 failures on PPC64 for test gdb.reverse/finish-
reverse.exp and 11 failures for test gdb.reverse/finish-precsave.exp.

Please let me know if the patch is acceptable for committing to
mainline.   Thanks.

                 Carl 


----------------------------------------------------------


PPC64 has both global and local entry points.  When executing in reverse
the function finish_backward sets the break point at the global entry
point.  However if the forward execution enters via the local entry point
reverse execution never sees the break point at the entry of the function.
Reverse execution continues until the next break point is encountered thus
stopping at the wrong place.

This patch adds a check and a call to gdbarch_skip_entrypoint to fix up
the sal.pc value to the local entry point if appropriate.  The patch fixes
eleven regression test failures in gdb.reverse/finish-reverse.exp for PPC64.

gdb/ChangeLog
2021-07-09  Carl Love  <cel@us.ibm.com>
	* infcmd.c (finish_backward): Add if gdbarch_skip_entrypoint_p and
	call to gdbarch_skip_entrypoint.
---
 gdb/infcmd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 8190ba36565..cce244b08a0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1707,6 +1707,12 @@ finish_backward (struct finish_command_fsm *sm)
       /* Set a step-resume at the function's entry point.  Once that's
 	 hit, we'll do one more step backwards.  */
       symtab_and_line sr_sal;
+
+      /* Some architectures, like PPC64 uses local and global entry points.
+	 May need to adjust sal.pc if the local entry point was used.  */
+      if (gdbarch_skip_entrypoint_p (gdbarch))
+        sal.pc = gdbarch_skip_entrypoint (gdbarch, sal.pc);
+
       sr_sal.pc = sal.pc;
       sr_sal.pspace = get_frame_program_space (frame);
       insert_step_resume_breakpoint_at_sal (gdbarch,
-- 
2.17.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-16 12:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 21:22 [PATCH] finish-reverse fix for setting break on correct entry point when executing in reverse Carl Love
2021-07-21 16:39 ` Carl Love
2021-07-24 15:32   ` Ulrich Weigand
     [not found]   ` <OF5B9EAD7A.D10A14C8-ONC125871C.0054FB44-C125871C.0055587E@us.ibm.com>
2021-07-29 21:00     ` Carl Love
2021-08-04 23:51       ` Carl Love
2021-08-16 12:09         ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).