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]

[RFC] 06/10 Don't rely on ecs->wait_for_more before fetching the event


The main juice of this patch is avoiding this relying on ecs->wait_some_more
before fetching the event from the target, which invalidates the
wrong context when the user switches the current thread, to a thread
that was not the last that had an event.

void
fetch_inferior_event (void *client_data)
{
  struct execution_control_state *ecs = &ecss;

  if (!ecs->wait_some_more)
    {
      /* Fill in with reasonable starting values.  */
      init_execution_control_state (ecs);

      /* We'll update this if & when we switch to a new thread. */
      previous_inferior_ptid = inferior_ptid;

      overlay_cache_invalid = 1;

      /* We have to invalidate the registers BEFORE calling target_wait
         because they can be loaded from the target while in target_wait.
         This makes remote debugging a bit more efficient for those
         targets that provide critical registers as part of their normal
         status mechanism. */

      registers_changed ();
    }

  if (deprecated_target_wait_hook)
    ecs->ptid =
      deprecated_target_wait_hook (ecs->waiton_ptid, ecs->wp);
  else
    ecs->ptid = target_wait (ecs->waiton_ptid, ecs->wp);

  /* Now figure out what to do with the result of the result.  */
  handle_inferior_event (ecs);


execution_control_state is a mess to look at, because it
contains variables that are context-switches, variables
that only serve to pass data around while handling one event,
but are meaningless between events, but some which are no longer
used at all.

So, the patch while fixing the above issue, splits execution
control state in 3.

/* Context-switchable data.  */
struct thread_stepping_state
{
  /* Should we step over breakpoint next time keep_going
     is called?  */
  int stepping_over_breakpoint;
  struct symtab_and_line sal;
  int current_line;
  struct symtab *current_symtab;
  int step_after_step_resume_breakpoint;
  int stepping_through_solib_after_catch;
  bpstat stepping_through_solib_catchpoints;
};

/* Data to be passed around while handling an event.  This data is
   discarded between events.  */
struct execution_control_state
{
  ptid_t ptid;
  struct target_waitstatus ws;
  int random_signal;
  CORE_ADDR stop_func_start;
  CORE_ADDR stop_func_end;
  char *stop_func_name;
  int new_thread_event;
  int wait_some_more;
};

/* global inferior control state P/

/* The PTID we'll do a target_wait on.*/
ptid_t waiton_ptid;

/* Current inferior wait state.  */
enum infwait_states infwait_state;



-- 
Pedro Alves
2008-05-06  Pedro Alves  <pedro@codesourcery.com>

	* infrun.c (currently_stepping): Take a struct
	thread_stepping_state instead of an execution_control_state.
	(struct thread_stepping_state): New, split from
	execution_control_state.
	(gtss, tss): New.
	(proceed): Clear the stepping state, set previous_inferior_ptid
	and clear infwait state.
	(init_wait_for_inferior): Clear the stepping state,
	previous_inferior_ptid and infwait state.
	(waiton_ptid, infwait_state): New, split from
	execution_control_state.
	(struct execution_control_state): Members that persist through
	events moved out.  Deleted unneeded wp, saved_inferior_ptid,
	tmpstatus.
	(wait_for_inferior): Use local execution_control_state.  Don't set
	previous_inferior_ptid here.
	(fetch_inferior_event): Use local execution_control_state.  Don't
	set previous_inferior_ptid here.  Always invalidate registers and
	the overlay cache.
	(init_execution_control_state): Adjust.
	(init_thread_stepping_state): New, extracted from
	init_execution_control_state.
	(context_switch): Take a ptid instead of an
	execution_control_state.
	(context_switch_to): Adjust.
	(adjust_pc_after_break): Adjust.
	(init_infwait_state): New.
	(handle_inferior_event): Adjust.
	
---
 gdb/infrun.c |  306 +++++++++++++++++++++++++++++++----------------------------
 1 file changed, 165 insertions(+), 141 deletions(-)

Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c	2008-05-06 03:41:18.000000000 +0100
+++ src/gdb/infrun.c	2008-05-06 03:44:48.000000000 +0100
@@ -72,9 +72,9 @@ static int follow_fork (void);
 static void set_schedlock_func (char *args, int from_tty,
 				struct cmd_list_element *c);
 
-struct execution_control_state;
+struct thread_stepping_state;
 
-static int currently_stepping (struct execution_control_state *ecs);
+static int currently_stepping (struct thread_stepping_state *tss);
 
 static void xdb_handle_command (char *args, int from_tty);
 
@@ -288,7 +288,28 @@ static struct breakpoint *step_resume_br
 static ptid_t target_last_wait_ptid;
 static struct target_waitstatus target_last_waitstatus;
 
-struct execution_control_state ecss;
+/* Context-switchable data.  */
+struct thread_stepping_state
+{
+  /* Should we step over breakpoint next time keep_going
+     is called?  */
+  int stepping_over_breakpoint;
+  struct symtab_and_line sal;
+  int current_line;
+  struct symtab *current_symtab;
+  int step_after_step_resume_breakpoint;
+  int stepping_through_solib_after_catch;
+  bpstat stepping_through_solib_catchpoints;
+};
+
+struct thread_stepping_state gtss;
+struct thread_stepping_state *tss = &gtss;
+
+static void context_switch (ptid_t ptid);
+
+void init_thread_stepping_state (struct thread_stepping_state *tss);
+
+void init_infwait_state (void);
 
 /* This is used to remember when a fork, vfork or exec event
    was caught by a catchpoint, and thus the event is to be
@@ -1263,6 +1284,15 @@ proceed (CORE_ADDR addr, enum target_sig
      updated correctly when the inferior is stopped.  */
   prev_pc = regcache_read_pc (get_current_regcache ());
 
+  /* Fill in with reasonable starting values.  */
+  init_thread_stepping_state (tss);
+
+  /* We'll update this if & when we switch to a new thread. */
+  previous_inferior_ptid = inferior_ptid;
+
+  /* Reset to normal state.  */
+  init_infwait_state ();
+
   /* Resume inferior.  */
   resume (oneproc || step || bpstat_should_step (), stop_signal);
 
@@ -1335,6 +1365,10 @@ init_wait_for_inferior (void)
 
   target_last_wait_ptid = minus_one_ptid;
 
+  init_thread_stepping_state (tss);
+  previous_inferior_ptid = null_ptid;
+  init_infwait_state ();
+
   displaced_step_clear ();
 }
 
@@ -1365,33 +1399,23 @@ enum inferior_stop_reason
   SIGNAL_RECEIVED
 };
 
-/* This structure contains what used to be local variables in
-   wait_for_inferior.  Probably many of them can return to being
-   locals in handle_inferior_event.  */
+/* The PTID we'll do a target_wait on.*/
+ptid_t waiton_ptid;
+
+/* Current inferior wait state.  */
+enum infwait_states infwait_state;
 
+/* Data to be passed around while handling an event.  This data is
+   discarded between events.  */
 struct execution_control_state
 {
+  ptid_t ptid;
   struct target_waitstatus ws;
-  struct target_waitstatus *wp;
-  /* Should we step over breakpoint next time keep_going 
-     is called?  */
-  int stepping_over_breakpoint;
   int random_signal;
   CORE_ADDR stop_func_start;
   CORE_ADDR stop_func_end;
   char *stop_func_name;
-  struct symtab_and_line sal;
-  int current_line;
-  struct symtab *current_symtab;
-  ptid_t ptid;
-  ptid_t saved_inferior_ptid;
-  int step_after_step_resume_breakpoint;
-  int stepping_through_solib_after_catch;
-  bpstat stepping_through_solib_catchpoints;
   int new_thread_event;
-  struct target_waitstatus tmpstatus;
-  enum infwait_states infwait_state;
-  ptid_t waiton_ptid;
   int wait_some_more;
 };
 
@@ -1428,6 +1452,7 @@ void
 wait_for_inferior (int treat_exec_as_sigtrap)
 {
   struct cleanup *old_cleanups;
+  struct execution_control_state ecss;
   struct execution_control_state *ecs;
 
   if (debug_infrun)
@@ -1440,12 +1465,6 @@ wait_for_inferior (int treat_exec_as_sig
 
   ecs = &ecss;
 
-  /* Fill in with reasonable starting values.  */
-  init_execution_control_state (ecs);
-
-  /* We'll update this if & when we switch to a new thread. */
-  previous_inferior_ptid = inferior_ptid;
-
   overlay_cache_invalid = 1;
 
   /* We have to invalidate the registers BEFORE calling target_wait
@@ -1459,9 +1478,9 @@ wait_for_inferior (int treat_exec_as_sig
   while (1)
     {
       if (deprecated_target_wait_hook)
-	ecs->ptid = deprecated_target_wait_hook (ecs->waiton_ptid, ecs->wp);
+	ecs->ptid = deprecated_target_wait_hook (waiton_ptid, &ecs->ws);
       else
-	ecs->ptid = target_wait (ecs->waiton_ptid, ecs->wp);
+	ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
 
       if (treat_exec_as_sigtrap && ecs->ws.kind == TARGET_WAITKIND_EXECD)
         {
@@ -1491,32 +1510,24 @@ wait_for_inferior (int treat_exec_as_sig
 void
 fetch_inferior_event (void *client_data)
 {
+  struct execution_control_state ecss = ecss;
   struct execution_control_state *ecs = &ecss;
 
-  if (!ecs->wait_some_more)
-    {
-      /* Fill in with reasonable starting values.  */
-      init_execution_control_state (ecs);
-
-      /* We'll update this if & when we switch to a new thread. */
-      previous_inferior_ptid = inferior_ptid;
-
-      overlay_cache_invalid = 1;
+  overlay_cache_invalid = 1;
 
-      /* We have to invalidate the registers BEFORE calling target_wait
-         because they can be loaded from the target while in target_wait.
-         This makes remote debugging a bit more efficient for those
-         targets that provide critical registers as part of their normal
-         status mechanism. */
+  /* We have to invalidate the registers BEFORE calling target_wait
+     because they can be loaded from the target while in target_wait.
+     This makes remote debugging a bit more efficient for those
+     targets that provide critical registers as part of their normal
+     status mechanism. */
 
-      registers_changed ();
-    }
+  registers_changed ();
 
   if (deprecated_target_wait_hook)
     ecs->ptid =
-      deprecated_target_wait_hook (ecs->waiton_ptid, ecs->wp);
+      deprecated_target_wait_hook (waiton_ptid, &ecs->ws);
   else
-    ecs->ptid = target_wait (ecs->waiton_ptid, ecs->wp);
+    ecs->ptid = target_wait (waiton_ptid, &ecs->ws);
 
   /* Now figure out what to do with the result of the result.  */
   handle_inferior_event (ecs);
@@ -1539,17 +1550,21 @@ fetch_inferior_event (void *client_data)
 void
 init_execution_control_state (struct execution_control_state *ecs)
 {
-  ecs->stepping_over_breakpoint = 0;
   ecs->random_signal = 0;
-  ecs->step_after_step_resume_breakpoint = 0;
-  ecs->stepping_through_solib_after_catch = 0;
-  ecs->stepping_through_solib_catchpoints = NULL;
-  ecs->sal = find_pc_line (prev_pc, 0);
-  ecs->current_line = ecs->sal.line;
-  ecs->current_symtab = ecs->sal.symtab;
-  ecs->infwait_state = infwait_normal_state;
-  ecs->waiton_ptid = pid_to_ptid (-1);
-  ecs->wp = &(ecs->ws);
+}
+
+/* Clear context switchable stepping state.  */
+
+void
+init_thread_stepping_state (struct thread_stepping_state *tss)
+{
+  tss->stepping_over_breakpoint = 0;
+  tss->step_after_step_resume_breakpoint = 0;
+  tss->stepping_through_solib_after_catch = 0;
+  tss->stepping_through_solib_catchpoints = NULL;
+  tss->sal = find_pc_line (prev_pc, 0);
+  tss->current_line = tss->sal.line;
+  tss->current_symtab = tss->sal.symtab;
 }
 
 /* Return the cached copy of the last pid/waitstatus returned by
@@ -1573,7 +1588,7 @@ nullify_last_target_wait_ptid (void)
 /* Switch thread contexts, maintaining "infrun state". */
 
 static void
-context_switch (struct execution_control_state *ecs)
+context_switch (ptid_t ptid)
 {
   /* Caution: it may happen that the new thread (or the old one!)
      is not in the thread list.  In this case we must not attempt
@@ -1586,20 +1601,20 @@ context_switch (struct execution_control
       fprintf_unfiltered (gdb_stdlog, "infrun: Switching context from %s ",
 			  target_pid_to_str (inferior_ptid));
       fprintf_unfiltered (gdb_stdlog, "to %s\n",
-			  target_pid_to_str (ecs->ptid));
+			  target_pid_to_str (ptid));
     }
 
-  if (in_thread_list (inferior_ptid) && in_thread_list (ecs->ptid))
+  if (in_thread_list (inferior_ptid) && in_thread_list (ptid))
     {				/* Perform infrun state context switch: */
       /* Save infrun state for the old thread.  */
       save_infrun_state (inferior_ptid, prev_pc,
 			 stepping_over_breakpoint, step_resume_breakpoint,
 			 step_range_start,
 			 step_range_end, &step_frame_id,
-			 ecs->stepping_over_breakpoint,
-			 ecs->stepping_through_solib_after_catch,
-			 ecs->stepping_through_solib_catchpoints,
-			 ecs->current_line, ecs->current_symtab,
+			 tss->stepping_over_breakpoint,
+			 tss->stepping_through_solib_after_catch,
+			 tss->stepping_through_solib_catchpoints,
+			 tss->current_line, tss->current_symtab,
 			 cmd_continuation, intermediate_continuation,
 			 proceed_to_finish,
 			 step_over_calls,
@@ -1608,14 +1623,14 @@ context_switch (struct execution_control
 			 stop_signal);
 
       /* Load infrun state for the new thread.  */
-      load_infrun_state (ecs->ptid, &prev_pc,
+      load_infrun_state (ptid, &prev_pc,
 			 &stepping_over_breakpoint, &step_resume_breakpoint,
 			 &step_range_start,
 			 &step_range_end, &step_frame_id,
-			 &ecs->stepping_over_breakpoint,
-			 &ecs->stepping_through_solib_after_catch,
-			 &ecs->stepping_through_solib_catchpoints,
-			 &ecs->current_line, &ecs->current_symtab,
+			 &tss->stepping_over_breakpoint,
+			 &tss->stepping_through_solib_after_catch,
+			 &tss->stepping_through_solib_catchpoints,
+			 &tss->current_line, &tss->current_symtab,
 			 &cmd_continuation, &intermediate_continuation,
 			 &proceed_to_finish,
 			 &step_over_calls,
@@ -1624,7 +1639,7 @@ context_switch (struct execution_control
 			 &stop_signal);
     }
 
-  switch_to_thread (ecs->ptid);
+  switch_to_thread (ptid);
 }
 
 /* Context switch to thread PTID.  */
@@ -1636,8 +1651,7 @@ context_switch_to (ptid_t ptid)
   /* Context switch to the new thread.	*/
   if (!ptid_equal (ptid, inferior_ptid))
     {
-      ecss.ptid = ptid;
-      context_switch (&ecss);
+      context_switch (ptid);
     }
   return current_ptid;
 }
@@ -1710,12 +1724,19 @@ adjust_pc_after_break (struct execution_
 
       if (singlestep_breakpoints_inserted_p
 	  || !ptid_equal (ecs->ptid, inferior_ptid)
-	  || !currently_stepping (ecs)
+	  || !currently_stepping (tss)
 	  || prev_pc == breakpoint_pc)
 	regcache_write_pc (regcache, breakpoint_pc);
     }
 }
 
+void
+init_infwait_state (void)
+{
+  waiton_ptid = pid_to_ptid (-1);
+  infwait_state = infwait_normal_state;
+}
+
 /* Given an execution control state that has been freshly filled in
    by an event from the inferior, figure out what it means and take
    appropriate action.  */
@@ -1729,20 +1750,20 @@ handle_inferior_event (struct execution_
 
   /* Cache the last pid/waitstatus. */
   target_last_wait_ptid = ecs->ptid;
-  target_last_waitstatus = *ecs->wp;
+  target_last_waitstatus = ecs->ws;
 
   /* Always clear state belonging to the previous time we stopped.  */
   stop_stack_dummy = 0;
 
   adjust_pc_after_break (ecs);
 
-  switch (ecs->infwait_state)
+  switch (infwait_state)
     {
     case infwait_thread_hop_state:
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: infwait_thread_hop_state\n");
       /* Cancel the waiton_ptid. */
-      ecs->waiton_ptid = pid_to_ptid (-1);
+      waiton_ptid = pid_to_ptid (-1);
       break;
 
     case infwait_normal_state:
@@ -1773,7 +1794,7 @@ handle_inferior_event (struct execution_
     default:
       internal_error (__FILE__, __LINE__, _("bad switch"));
     }
-  ecs->infwait_state = infwait_normal_state;
+  infwait_state = infwait_normal_state;
 
   reinit_frame_cache ();
 
@@ -1923,7 +1944,7 @@ handle_inferior_event (struct execution_
 
       if (!ptid_equal (ecs->ptid, inferior_ptid))
 	{
-	  context_switch (ecs);
+	  context_switch (ecs->ptid);
 	  reinit_frame_cache ();
 	}
 
@@ -1957,17 +1978,22 @@ handle_inferior_event (struct execution_
       xfree (pending_follow.execd_pathname);
 
       stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
-      ecs->saved_inferior_ptid = inferior_ptid;
-      inferior_ptid = ecs->ptid;
 
-      stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+      {
+	/* The breakpoints module may need to touch the inferior's
+	   memory.  Switch to it momentarily.  */
+	ptid_t saved_inferior_ptid = inferior_ptid;
+	inferior_ptid = ecs->ptid;
 
-      ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
-      inferior_ptid = ecs->saved_inferior_ptid;
+	stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+
+	ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
+	inferior_ptid = saved_inferior_ptid;
+      }
 
       if (!ptid_equal (ecs->ptid, inferior_ptid))
 	{
-	  context_switch (ecs);
+	  context_switch (ecs->ptid);
 	  reinit_frame_cache ();
 	}
 
@@ -2084,8 +2110,7 @@ handle_inferior_event (struct execution_
 
 	  ecs->random_signal = 0;
 
-	  ecs->ptid = saved_singlestep_ptid;
-	  context_switch (ecs);
+	  context_switch (saved_singlestep_ptid);
 	  if (deprecated_context_hook)
 	    deprecated_context_hook (pid_to_thread_id (ecs->ptid));
 
@@ -2245,12 +2270,12 @@ handle_inferior_event (struct execution_
 	  else
 	    {			/* Single step */
 	      if (!ptid_equal (inferior_ptid, ecs->ptid))
-		context_switch (ecs);
-	      ecs->waiton_ptid = ecs->ptid;
-	      ecs->wp = &(ecs->ws);
-	      ecs->stepping_over_breakpoint = 1;
+		context_switch (ecs->ptid);
+
+	      waiton_ptid = ecs->ptid;
+	      infwait_state = infwait_thread_hop_state;
 
-	      ecs->infwait_state = infwait_thread_hop_state;
+	      tss->stepping_over_breakpoint = 1;
 	      keep_going (ecs);
 	      registers_changed ();
 	      return;
@@ -2272,7 +2297,7 @@ handle_inferior_event (struct execution_
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: context switch\n");
 
-      context_switch (ecs);
+      context_switch (ecs->ptid);
 
       if (deprecated_context_hook)
 	deprecated_context_hook (pid_to_thread_id (ecs->ptid));
@@ -2321,11 +2346,11 @@ handle_inferior_event (struct execution_
 	remove_breakpoints ();
       registers_changed ();
       target_resume (ecs->ptid, 1, TARGET_SIGNAL_0);	/* Single step */
-      ecs->waiton_ptid = ecs->ptid;
+      waiton_ptid = ecs->ptid;
       if (HAVE_STEPPABLE_WATCHPOINT)
-	ecs->infwait_state = infwait_step_watch_state;
+	infwait_state = infwait_step_watch_state;
       else
-	ecs->infwait_state = infwait_nonstep_watch_state;
+	infwait_state = infwait_nonstep_watch_state;
       prepare_to_wait (ecs);
       return;
     }
@@ -2339,7 +2364,7 @@ handle_inferior_event (struct execution_
 			    &ecs->stop_func_start, &ecs->stop_func_end);
   ecs->stop_func_start
     += gdbarch_deprecated_function_start_offset (current_gdbarch);
-  ecs->stepping_over_breakpoint = 0;
+  tss->stepping_over_breakpoint = 0;
   bpstat_clear (&stop_bpstat);
   stop_step = 0;
   stop_print_frame = 1;
@@ -2349,7 +2374,7 @@ handle_inferior_event (struct execution_
   if (stop_signal == TARGET_SIGNAL_TRAP
       && stepping_over_breakpoint
       && gdbarch_single_step_through_delay_p (current_gdbarch)
-      && currently_stepping (ecs))
+      && currently_stepping (tss))
     {
       /* We're trying to step off a breakpoint.  Turns out that we're
 	 also on an instruction that needs to be stepped multiple
@@ -2365,7 +2390,7 @@ handle_inferior_event (struct execution_
 	{
 	  /* The user issued a continue when stopped at a breakpoint.
 	     Set up for another trap and get out of here.  */
-         ecs->stepping_over_breakpoint = 1;
+         tss->stepping_over_breakpoint = 1;
          keep_going (ecs);
          return;
 	}
@@ -2377,15 +2402,15 @@ handle_inferior_event (struct execution_
 	     case, don't decide that here, just set 
 	     ecs->stepping_over_breakpoint, making sure we 
 	     single-step again before breakpoints are re-inserted.  */
-	  ecs->stepping_over_breakpoint = 1;
+	  tss->stepping_over_breakpoint = 1;
 	}
     }
 
   /* Look at the cause of the stop, and decide what to do.
      The alternatives are:
-     1) break; to really stop and return to the debugger,
-     2) drop through to start up again
-     (set ecs->stepping_over_breakpoint to 1 to single step once)
+     1) stop_stepping and return; to really stop and return to the debugger,
+     2) keep_going start up again
+     (set tss->stepping_over_breakpoint to 1 to single step once)
      3) set ecs->random_signal to 1, and the decision between 1 and 2
      will be made according to the signal handling tables.  */
 
@@ -2546,7 +2571,7 @@ process_event_stop_test:
                                 "breakpoint\n");
 
 	  insert_step_resume_breakpoint_at_frame (get_current_frame ());
-	  ecs->step_after_step_resume_breakpoint = 1;
+	  tss->step_after_step_resume_breakpoint = 1;
 	  keep_going (ecs);
 	  return;
 	}
@@ -2610,7 +2635,7 @@ process_event_stop_test:
 	  fprintf_unfiltered (gdb_stdlog,
 			      "infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME\n");
 
-	ecs->stepping_over_breakpoint = 1;
+	tss->stepping_over_breakpoint = 1;
 
 	if (!gdbarch_get_longjmp_target_p (current_gdbarch)
 	    || !gdbarch_get_longjmp_target (current_gdbarch,
@@ -2650,7 +2675,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
       case BPSTAT_WHAT_SINGLE:
         if (debug_infrun)
 	  fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
-	ecs->stepping_over_breakpoint = 1;
+	tss->stepping_over_breakpoint = 1;
 	/* Still need to check other stuff, at least the case
 	   where we are stepping and step out of the right range.  */
 	break;
@@ -2704,13 +2729,13 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	      bpstat_find_step_resume_breakpoint (stop_bpstat);
 	  }
 	delete_step_resume_breakpoint (&step_resume_breakpoint);
-	if (ecs->step_after_step_resume_breakpoint)
+	if (tss->step_after_step_resume_breakpoint)
 	  {
 	    /* Back when the step-resume breakpoint was inserted, we
 	       were trying to single-step off a breakpoint.  Go back
 	       to doing that.  */
-	    ecs->step_after_step_resume_breakpoint = 0;
-	    ecs->stepping_over_breakpoint = 1;
+	    tss->step_after_step_resume_breakpoint = 0;
+	    tss->stepping_over_breakpoint = 1;
 	    keep_going (ecs);
 	    return;
 	  }
@@ -2785,19 +2810,19 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	         friends) until we reach non-dld code.  At that point,
 	         we can stop stepping. */
 	      bpstat_get_triggered_catchpoints (stop_bpstat,
-						&ecs->
+						&tss->
 						stepping_through_solib_catchpoints);
-	      ecs->stepping_through_solib_after_catch = 1;
+	      tss->stepping_through_solib_after_catch = 1;
 
 	      /* Be sure to lift all breakpoints, so the inferior does
 	         actually step past this point... */
-	      ecs->stepping_over_breakpoint = 1;
+	      tss->stepping_over_breakpoint = 1;
 	      break;
 	    }
 	  else
 	    {
 	      /* We want to step over this breakpoint, then keep going.  */
-	      ecs->stepping_over_breakpoint = 1;
+	      tss->stepping_over_breakpoint = 1;
 	      break;
 	    }
 	}
@@ -2820,7 +2845,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
   /* Are we stepping to get the inferior out of the dynamic linker's
      hook (and possibly the dld itself) after catching a shlib
      event?  */
-  if (ecs->stepping_through_solib_after_catch)
+  if (tss->stepping_through_solib_after_catch)
     {
 #if defined(SOLIB_ADD)
       /* Have we reached our destination?  If not, keep going. */
@@ -2828,7 +2853,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	{
           if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog, "infrun: stepping in dynamic linker\n");
-	  ecs->stepping_over_breakpoint = 1;
+	  tss->stepping_over_breakpoint = 1;
 	  keep_going (ecs);
 	  return;
 	}
@@ -2837,10 +2862,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	 fprintf_unfiltered (gdb_stdlog, "infrun: step past dynamic linker\n");
       /* Else, stop and report the catchpoint(s) whose triggering
          caused us to begin stepping. */
-      ecs->stepping_through_solib_after_catch = 0;
+      tss->stepping_through_solib_after_catch = 0;
       bpstat_clear (&stop_bpstat);
-      stop_bpstat = bpstat_copy (ecs->stepping_through_solib_catchpoints);
-      bpstat_clear (&ecs->stepping_through_solib_catchpoints);
+      stop_bpstat = bpstat_copy (tss->stepping_through_solib_catchpoints);
+      bpstat_clear (&tss->stepping_through_solib_catchpoints);
       stop_print_frame = 1;
       stop_stepping (ecs);
       return;
@@ -3075,14 +3100,14 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	}
     }
 
-  ecs->sal = find_pc_line (stop_pc, 0);
+  tss->sal = find_pc_line (stop_pc, 0);
 
   /* NOTE: tausq/2004-05-24: This if block used to be done before all
      the trampoline processing logic, however, there are some trampolines 
      that have no names, so we should do trampoline handling first.  */
   if (step_over_calls == STEP_OVER_UNDEBUGGABLE
       && ecs->stop_func_name == NULL
-      && ecs->sal.line == 0)
+      && tss->sal.line == 0)
     {
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: stepped into undebuggable function\n");
@@ -3128,7 +3153,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
       return;
     }
 
-  if (ecs->sal.line == 0)
+  if (tss->sal.line == 0)
     {
       /* We have no line number information.  That means to stop
          stepping (does this always happen right after one instruction,
@@ -3142,9 +3167,9 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
       return;
     }
 
-  if ((stop_pc == ecs->sal.pc)
-      && (ecs->current_line != ecs->sal.line
-	  || ecs->current_symtab != ecs->sal.symtab))
+  if ((stop_pc == tss->sal.pc)
+      && (tss->current_line != tss->sal.line
+	  || tss->current_symtab != tss->sal.symtab))
     {
       /* We are at the start of a different line.  So stop.  Note that
          we don't stop if we step into the middle of a different line.
@@ -3165,11 +3190,11 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
      new line in mid-statement, we continue stepping.  This makes
      things like for(;;) statements work better.)  */
 
-  step_range_start = ecs->sal.pc;
-  step_range_end = ecs->sal.end;
+  step_range_start = tss->sal.pc;
+  step_range_end = tss->sal.end;
   step_frame_id = get_frame_id (get_current_frame ());
-  ecs->current_line = ecs->sal.line;
-  ecs->current_symtab = ecs->sal.symtab;
+  tss->current_line = tss->sal.line;
+  tss->current_symtab = tss->sal.symtab;
 
   /* In the case where we just stepped out of a function into the
      middle of a line of the caller, continue stepping, but
@@ -3206,11 +3231,11 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 /* Are we in the middle of stepping?  */
 
 static int
-currently_stepping (struct execution_control_state *ecs)
+currently_stepping (struct thread_stepping_state *tss)
 {
   return (((step_range_end && step_resume_breakpoint == NULL)
 	   || stepping_over_breakpoint)
-	  || ecs->stepping_through_solib_after_catch
+	  || tss->stepping_through_solib_after_catch
 	  || bpstat_should_step ());
 }
 
@@ -3228,17 +3253,17 @@ step_into_function (struct execution_con
     ecs->stop_func_start = gdbarch_skip_prologue
 			     (current_gdbarch, ecs->stop_func_start);
 
-  ecs->sal = find_pc_line (ecs->stop_func_start, 0);
+  tss->sal = find_pc_line (ecs->stop_func_start, 0);
   /* Use the step_resume_break to step until the end of the prologue,
      even if that involves jumps (as it seems to on the vax under
      4.2).  */
   /* If the prologue ends in the middle of a source line, continue to
      the end of that source line (if it is still within the function).
      Otherwise, just go to end of prologue.  */
-  if (ecs->sal.end
-      && ecs->sal.pc != ecs->stop_func_start
-      && ecs->sal.end < ecs->stop_func_end)
-    ecs->stop_func_start = ecs->sal.end;
+  if (tss->sal.end
+      && tss->sal.pc != ecs->stop_func_start
+      && tss->sal.end < ecs->stop_func_end)
+    ecs->stop_func_start = tss->sal.end;
 
   /* Architectures which require breakpoint adjustment might not be able
      to place a breakpoint at the computed address.  If so, the test
@@ -3415,7 +3440,7 @@ keep_going (struct execution_control_sta
       /* We took a signal (which we are supposed to pass through to
          the inferior, else we'd have done a break above) and we
          haven't yet gotten our trap.  Simply continue.  */
-      resume (currently_stepping (ecs), stop_signal);
+      resume (currently_stepping (tss), stop_signal);
     }
   else
     {
@@ -3432,7 +3457,7 @@ keep_going (struct execution_control_sta
 	 already inserted breakpoints.  Therefore, we don't
 	 care if breakpoints were already inserted, or not.  */
       
-      if (ecs->stepping_over_breakpoint)
+      if (tss->stepping_over_breakpoint)
 	{
 	  if (! use_displaced_stepping (current_gdbarch))
 	    /* Since we can't do a displaced step, we have to remove
@@ -3456,7 +3481,7 @@ keep_going (struct execution_control_sta
 	    }
 	}
 
-      stepping_over_breakpoint = ecs->stepping_over_breakpoint;
+      stepping_over_breakpoint = tss->stepping_over_breakpoint;
 
       /* Do not deliver SIGNAL_TRAP (except when the user explicitly
          specifies that such a signal should be delivered to the
@@ -3474,7 +3499,7 @@ keep_going (struct execution_control_sta
 	stop_signal = TARGET_SIGNAL_0;
 
 
-      resume (currently_stepping (ecs), stop_signal);
+      resume (currently_stepping (tss), stop_signal);
     }
 
   prepare_to_wait (ecs);
@@ -3489,7 +3514,7 @@ prepare_to_wait (struct execution_contro
 {
   if (debug_infrun)
     fprintf_unfiltered (gdb_stdlog, "infrun: prepare_to_wait\n");
-  if (ecs->infwait_state == infwait_normal_state)
+  if (infwait_state == infwait_normal_state)
     {
       overlay_cache_invalid = 1;
 
@@ -3500,8 +3525,7 @@ prepare_to_wait (struct execution_contro
          as part of their normal status mechanism. */
 
       registers_changed ();
-      ecs->waiton_ptid = pid_to_ptid (-1);
-      ecs->wp = &(ecs->ws);
+      waiton_ptid = pid_to_ptid (-1);
     }
   /* This is the old end of the while loop.  Let everybody know we
      want to wait for the inferior some more and get called again

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