[RFC,5/7] gdb/infcall: enter replay diversion before call

Message ID cl1agv/8dhpb-2ni.m0-6t4fgpa2m3lc8mkqqi2pi-i9vdivy/.a@mail.bob131.so
State New
Headers show
Series
  • gdb: replay diversion support
Related show

Commit Message

Tom de Vries via Gdb-patches June 1, 2021, 7:11 p.m.
Ensures a replay diversion is set up before making an inferior call.

gdb/ChangeLog:

2021-06-01  George Barrett  <bob@bob131.so>

	* infcall.c (call_function_by_hand_dummy): Ensure a replay is
	set up before making an inferior call.
---
 gdb/infcall.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.31.1

Patch

diff --git a/gdb/infcall.c b/gdb/infcall.c
index ca3347fbb9d..f8660f2ecd2 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -840,6 +840,12 @@  call_function_by_hand_dummy (struct value *function,
      is released once the regcache has been pushed).  */
   infcall_suspend_state_up caller_state (save_infcall_suspend_state ());
 
+  /* If the target supports replay diversions, make sure the inferior
+     is in one before proceeding.  This is mandatory for such targets
+     and a no-op for others.  */
+  scoped_want_replay_diversion save_want_diversion
+    = call_thread->inf->want_replay_diversion ();
+
   /* Ensure that the initial SP is correctly aligned.  */
   {
     CORE_ADDR old_sp = get_frame_sp (frame);