This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] infrun.c (set_last_target_status): New function.


Hi.

While working on fixing pr 14236 I found it useful to know
where target_last_wait_ptid was set.
It's only set in one place but it's easier to see that with a setter.
Plus it's easier (for me anyway) to understand the plethora of state
variables if they're accessed through API calls (at least where
such calls feel obvious, as this one does - there is already a getter
here).

2014-03-30  Doug Evans  <xdje42@gmail.com>

	* infrun.c (set_last_target_status): New function.
	(handle_inferior_event): Call it.

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 8f9e820..31bb132 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2965,6 +2965,15 @@ init_thread_stepping_state (struct thread_info *tss)
   tss->step_after_step_resume_breakpoint = 0;
 }
 
+/* Set the cached copy of the last ptid/waitstatus.  */
+
+static void
+set_last_target_status (ptid_t ptid, struct target_waitstatus status)
+{
+  target_last_wait_ptid = ptid;
+  target_last_waitstatus = status;
+}
+
 /* Return the cached copy of the last pid/waitstatus returned by
    target_wait()/deprecated_target_wait_hook().  The data is actually
    cached by handle_inferior_event(), which gets called immediately
@@ -3272,8 +3281,7 @@ handle_inferior_event (struct execution_control_state *ecs)
     }
 
   /* Cache the last pid/waitstatus.  */
-  target_last_wait_ptid = ecs->ptid;
-  target_last_waitstatus = ecs->ws;
+  set_last_target_status (ecs->ptid, ecs->ws);
 
   /* Always clear state belonging to the previous time we stopped.  */
   stop_stack_dummy = STOP_NONE;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]