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] [6/7] infrun cleanup: ecs->event_thread


Hello,

this patch replaces the ecs->event_thread routine by a local variable
of handle_inferior_event.  The keep_going, handle_step_into_function
and handle_step_into_function_backward were already solely using the
event_thread member of their ecs argument, so they now simply get
a struct thread_info * argument instead.  adjust_pc_after_break also
requires the target_waitstatus to be passed in.

Bye,
Ulrich


ChangeLog:

	* infrun.c (struct execution_control_state): Remove event_thread.
	(adjust_pc_after_break): Replace ECS by TP and WS arguments.
	Use TP instead of ECS->EVENT_THREAD and WS instead of &ECS->WS.
	Use TP->PTID instead of ECS->PTID.
	(handle_step_into_function): Replace ECS by TP argument.  Use TP
	instead of ECS->EVENT_THREAD.
	(handle_step_into_function_backward): Likewise.
	(keep_going): Likewise.
	(handle_inferior_event): Use local variable TP instead of
	ECS->EVENT_THREAD.  Update subroutine calls.


Index: gdb-head/gdb/infrun.c
===================================================================
--- gdb-head.orig/gdb/infrun.c
+++ gdb-head/gdb/infrun.c
@@ -1566,25 +1566,21 @@ enum infwait_states infwait_state;
 struct execution_control_state
 {
   ptid_t ptid;
-  /* The thread that got the event, if this was a thread event; NULL
-     otherwise.  */
-  struct thread_info *event_thread;
-
   struct target_waitstatus ws;
 };
 
 static int handle_inferior_event (struct execution_control_state *ecs);
 
-static int handle_step_into_function (struct execution_control_state *ecs,
+static int handle_step_into_function (struct thread_info *tp,
 				      CORE_ADDR, CORE_ADDR);
-static int handle_step_into_function_backward (struct execution_control_state *ecs);
+static int handle_step_into_function_backward (struct thread_info *tp);
 static void insert_step_resume_breakpoint_at_frame (struct frame_info *step_frame);
 static void insert_step_resume_breakpoint_at_caller (struct frame_info *);
 static void insert_step_resume_breakpoint_at_sal (struct symtab_and_line sr_sal,
 						  struct frame_id sr_id);
 static void insert_longjmp_resume_breakpoint (CORE_ADDR);
 
-static int keep_going (struct execution_control_state *ecs);
+static int keep_going (struct thread_info *tp);
 static void print_stop_reason (enum inferior_stop_reason stop_reason,
 			       int stop_info);
 
@@ -1911,7 +1907,7 @@ context_switch (ptid_t ptid)
 }
 
 static void
-adjust_pc_after_break (struct execution_control_state *ecs)
+adjust_pc_after_break (struct thread_info *tp, struct target_waitstatus *ws)
 {
   struct regcache *regcache;
   struct gdbarch *gdbarch;
@@ -1938,10 +1934,10 @@ adjust_pc_after_break (struct execution_
      target with both of these set in GDB history, and it seems unlikely to be
      correct, so gdbarch_have_nonsteppable_watchpoint is not checked here.  */
 
-  if (ecs->ws.kind != TARGET_WAITKIND_STOPPED)
+  if (ws->kind != TARGET_WAITKIND_STOPPED)
     return;
 
-  if (ecs->ws.value.sig != TARGET_SIGNAL_TRAP)
+  if (ws->value.sig != TARGET_SIGNAL_TRAP)
     return;
 
   /* In reverse execution, when a breakpoint is hit, the instruction
@@ -1975,7 +1971,7 @@ adjust_pc_after_break (struct execution_
 
   /* If this target does not decrement the PC after breakpoints, then
      we have nothing to do.  */
-  regcache = get_thread_regcache (ecs->ptid);
+  regcache = get_thread_regcache (tp->ptid);
   gdbarch = get_regcache_arch (regcache);
   if (gdbarch_decr_pc_after_break (gdbarch) == 0)
     return;
@@ -2015,9 +2011,9 @@ adjust_pc_after_break (struct execution_
 	 we also need to back up to the breakpoint address.  */
 
       if (singlestep_breakpoints_inserted_p
-	  || !ptid_equal (ecs->ptid, inferior_ptid)
-	  || !currently_stepping (ecs->event_thread)
-	  || ecs->event_thread->prev_pc == breakpoint_pc)
+	  || !ptid_equal (tp->ptid, inferior_ptid)
+	  || !currently_stepping (tp)
+	  || tp->prev_pc == breakpoint_pc)
 	regcache_write_pc (regcache, breakpoint_pc);
     }
 }
@@ -2058,6 +2054,7 @@ handle_inferior_event (struct execution_
   CORE_ADDR stop_func_end;
   char *stop_func_name;
   int new_thread_event;
+  struct thread_info *tp;
 
   if (ecs->ws.kind != TARGET_WAITKIND_EXITED
       && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
@@ -2088,10 +2085,10 @@ handle_inferior_event (struct execution_
       && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && new_thread_event)
     add_thread (ecs->ptid);
 
-  ecs->event_thread = find_thread_pid (ecs->ptid);
+  tp = find_thread_pid (ecs->ptid);
 
-  /* Dependent on valid ECS->EVENT_THREAD.  */
-  adjust_pc_after_break (ecs);
+  /* Dependent on valid TP.  */
+  adjust_pc_after_break (tp, &ecs->ws);
 
   /* Dependent on the current PC value modified by adjust_pc_after_break.  */
   reinit_frame_cache ();
@@ -2275,15 +2272,15 @@ handle_inferior_event (struct execution_
 
       stop_pc = read_pc ();
 
-      ecs->event_thread->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+      tp->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
 
       /* If no catchpoint triggered for this, then keep going.  */
-      if (!bpstat_explains_signal (ecs->event_thread->stop_bpstat))
+      if (!bpstat_explains_signal (tp->stop_bpstat))
 	{
-	  ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
-	  return keep_going (ecs);
+	  tp->stop_signal = TARGET_SIGNAL_0;
+	  return keep_going (tp);
 	}
-      ecs->event_thread->stop_signal = TARGET_SIGNAL_TRAP;
+      tp->stop_signal = TARGET_SIGNAL_TRAP;
       goto process_event_stop_test;
 
     case TARGET_WAITKIND_EXECD:
@@ -2307,15 +2304,15 @@ handle_inferior_event (struct execution_
       follow_exec (inferior_ptid, pending_follow.execd_pathname);
       xfree (pending_follow.execd_pathname);
 
-      ecs->event_thread->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+      tp->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
 
       /* If no catchpoint triggered for this, then keep going.  */
-      if (!bpstat_explains_signal (ecs->event_thread->stop_bpstat))
+      if (!bpstat_explains_signal (tp->stop_bpstat))
 	{
-	  ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
-	  return keep_going (ecs);
+	  tp->stop_signal = TARGET_SIGNAL_0;
+	  return keep_going (tp);
 	}
-      ecs->event_thread->stop_signal = TARGET_SIGNAL_TRAP;
+      tp->stop_signal = TARGET_SIGNAL_TRAP;
       goto process_event_stop_test;
 
       /* Be careful not to try to gather much state about a thread
@@ -2340,7 +2337,7 @@ handle_inferior_event (struct execution_
     case TARGET_WAITKIND_STOPPED:
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_STOPPED\n");
-      ecs->event_thread->stop_signal = ecs->ws.value.sig;
+      tp->stop_signal = ecs->ws.value.sig;
       break;
 
     case TARGET_WAITKIND_NO_HISTORY:
@@ -2389,15 +2386,15 @@ targets should add new threads to the th
       /* Do we need to clean up the state of a thread that has
 	 completed a displaced single-step?  (Doing so usually affects
 	 the PC, so do it here, before we set stop_pc.)  */
-      displaced_step_fixup (ecs->ptid, ecs->event_thread->stop_signal);
+      displaced_step_fixup (ecs->ptid, tp->stop_signal);
 
       /* If we either finished a single-step or hit a breakpoint, but
 	 the user wanted this thread to be stopped, pretend we got a
 	 SIG0 (generic unsignaled stop).  */
 
-      if (ecs->event_thread->stop_requested
-	  && ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP)
-	ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
+      if (tp->stop_requested
+	  && tp->stop_signal == TARGET_SIGNAL_TRAP)
+	tp->stop_signal = TARGET_SIGNAL_0;
     }
 
   stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
@@ -2432,7 +2429,7 @@ targets should add new threads to the th
       /* We've either finished single-stepping past the single-step
          breakpoint, or stopped for some other reason.  It would be nice if
          we could tell, but we can't reliably.  */
-      if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP)
+      if (tp->stop_signal == TARGET_SIGNAL_TRAP)
 	{
 	  if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog, "infrun: stepping_past_singlestep_breakpoint\n");
@@ -2456,7 +2453,7 @@ targets should add new threads to the th
 
       /* If we stopped for some other reason than single-stepping, ignore
 	 the fact that we were supposed to switch back.  */
-      if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP)
+      if (tp->stop_signal == TARGET_SIGNAL_TRAP)
 	{
 	  if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog,
@@ -2487,7 +2484,7 @@ targets should add new threads to the th
      another thread.  If so, then step that thread past the breakpoint,
      and continue it.  */
 
-  if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP)
+  if (tp->stop_signal == TARGET_SIGNAL_TRAP)
     {
       int thread_hop_needed = 0;
 
@@ -2549,11 +2546,11 @@ targets should add new threads to the th
 		    singlestep_ptid.  Don't swap here, since that's
 		    the context we want to use.  Just fudge our
 		    state and continue.  */
-                 stop_signal = ecs->event_thread->stop_signal;
-                 ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
+                 stop_signal = tp->stop_signal;
+                 tp->stop_signal = TARGET_SIGNAL_0;
                  ecs->ptid = singlestep_ptid;
-                 ecs->event_thread = find_thread_pid (ecs->ptid);
-                 ecs->event_thread->stop_signal = stop_signal;
+                 tp = find_thread_pid (ecs->ptid);
+                 tp->stop_signal = stop_signal;
                  stop_pc = new_singlestep_pc;
                }
              else
@@ -2613,8 +2610,8 @@ targets should add new threads to the th
 		  infwait_state = infwait_thread_hop_state;
 		}
 
-	      ecs->event_thread->stepping_over_breakpoint = 1;
-	      return keep_going (ecs);
+	      tp->stepping_over_breakpoint = 1;
+	      return keep_going (tp);
 	    }
 	}
     }
@@ -2691,15 +2688,15 @@ targets should add new threads to the th
 			    &stop_func_start, &stop_func_end);
   stop_func_start
     += gdbarch_deprecated_function_start_offset (current_gdbarch);
-  ecs->event_thread->stepping_over_breakpoint = 0;
-  bpstat_clear (&ecs->event_thread->stop_bpstat);
-  ecs->event_thread->stop_step = 0;
+  tp->stepping_over_breakpoint = 0;
+  bpstat_clear (&tp->stop_bpstat);
+  tp->stop_step = 0;
   stop_print_frame = 1;
 
-  if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP
-      && ecs->event_thread->trap_expected
+  if (tp->stop_signal == TARGET_SIGNAL_TRAP
+      && tp->trap_expected
       && gdbarch_single_step_through_delay_p (current_gdbarch)
-      && currently_stepping (ecs->event_thread))
+      && currently_stepping (tp))
     {
       /* We're trying to step off a breakpoint.  Turns out that we're
 	 also on an instruction that needs to be stepped multiple
@@ -2711,12 +2708,12 @@ targets should add new threads to the th
 					     get_current_frame ());
       if (debug_infrun && step_through_delay)
 	fprintf_unfiltered (gdb_stdlog, "infrun: step through delay\n");
-      if (ecs->event_thread->step_range_end == 0 && step_through_delay)
+      if (tp->step_range_end == 0 && step_through_delay)
 	{
 	  /* The user issued a continue when stopped at a breakpoint.
 	     Set up for another trap and get out of here.  */
-         ecs->event_thread->stepping_over_breakpoint = 1;
-         return keep_going (ecs);
+         tp->stepping_over_breakpoint = 1;
+         return keep_going (tp);
 	}
       else if (step_through_delay)
 	{
@@ -2726,7 +2723,7 @@ targets should add new threads to the th
 	     case, don't decide that here, just set 
 	     ecs->stepping_over_breakpoint, making sure we 
 	     single-step again before breakpoints are re-inserted.  */
-	  ecs->event_thread->stepping_over_breakpoint = 1;
+	  tp->stepping_over_breakpoint = 1;
 	}
     }
 
@@ -2734,7 +2731,7 @@ targets should add new threads to the th
      The alternatives are:
      1) return 0; to really stop and return to the debugger,
      2) call keep_going and return to start up again
-     (set ecs->event_thread->stepping_over_breakpoint to 1 to single step once)
+     (set tp->stepping_over_breakpoint to 1 to single step once)
      3) set stopped_by_random_signal to 1, and the decision between 1 and 2
      will be made according to the signal handling tables.  */
 
@@ -2752,16 +2749,16 @@ targets should add new threads to the th
      If we're doing a displaced step past a breakpoint, then the
      breakpoint is always inserted at the original instruction;
      non-standard signals can't be explained by the breakpoint.  */
-  if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP
-      || (! ecs->event_thread->trap_expected
+  if (tp->stop_signal == TARGET_SIGNAL_TRAP
+      || (! tp->trap_expected
           && breakpoint_inserted_here_p (stop_pc)
-	  && (ecs->event_thread->stop_signal == TARGET_SIGNAL_ILL
-	      || ecs->event_thread->stop_signal == TARGET_SIGNAL_SEGV
-	      || ecs->event_thread->stop_signal == TARGET_SIGNAL_EMT))
+	  && (tp->stop_signal == TARGET_SIGNAL_ILL
+	      || tp->stop_signal == TARGET_SIGNAL_SEGV
+	      || tp->stop_signal == TARGET_SIGNAL_EMT))
       || stop_soon == STOP_QUIETLY || stop_soon == STOP_QUIETLY_NO_SIGSTOP
       || stop_soon == STOP_QUIETLY_REMOTE)
     {
-      if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP && stop_after_trap)
+      if (tp->stop_signal == TARGET_SIGNAL_TRAP && stop_after_trap)
 	{
           if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog, "infrun: stopped\n");
@@ -2799,16 +2796,16 @@ targets should add new threads to the th
 	 TARGET_SIGNAL_0, meaning: stopped for no particular reason
 	 other than GDB's request.  */
       if (stop_soon == STOP_QUIETLY_NO_SIGSTOP
-	  && (ecs->event_thread->stop_signal == TARGET_SIGNAL_STOP
-	      || ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP
-	      || ecs->event_thread->stop_signal == TARGET_SIGNAL_0))
+	  && (tp->stop_signal == TARGET_SIGNAL_STOP
+	      || tp->stop_signal == TARGET_SIGNAL_TRAP
+	      || tp->stop_signal == TARGET_SIGNAL_0))
 	{
-	  ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
+	  tp->stop_signal = TARGET_SIGNAL_0;
 	  return 0;
 	}
 
       /* See if there is a breakpoint at the current PC.  */
-      ecs->event_thread->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
+      tp->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid);
       
       /* Following in case break condition called a
 	 function.  */
@@ -2834,19 +2831,19 @@ targets should add new threads to the th
          be necessary for call dummies on a non-executable stack on
          SPARC.  */
 
-      if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP)
+      if (tp->stop_signal == TARGET_SIGNAL_TRAP)
 	stopped_by_random_signal
-	  = !(bpstat_explains_signal (ecs->event_thread->stop_bpstat)
-	      || ecs->event_thread->trap_expected
-	      || (ecs->event_thread->step_range_end
-		  && ecs->event_thread->step_resume_breakpoint == NULL));
+	  = !(bpstat_explains_signal (tp->stop_bpstat)
+	      || tp->trap_expected
+	      || (tp->step_range_end
+		  && tp->step_resume_breakpoint == NULL));
       else
 	{
 	  stopped_by_random_signal
-	    = !bpstat_explains_signal (ecs->event_thread->stop_bpstat);
+	    = !bpstat_explains_signal (tp->stop_bpstat);
 
 	  if (!stopped_by_random_signal)
-	    ecs->event_thread->stop_signal = TARGET_SIGNAL_TRAP;
+	    tp->stop_signal = TARGET_SIGNAL_TRAP;
 	}
     }
 
@@ -2868,20 +2865,20 @@ process_event_stop_test:
 
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: random signal %d\n",
-			     ecs->event_thread->stop_signal);
+			     tp->stop_signal);
 
-      if (signal_print[ecs->event_thread->stop_signal])
+      if (signal_print[tp->stop_signal])
 	{
 	  printed = 1;
 	  target_terminal_ours_for_output ();
-	  print_stop_reason (SIGNAL_RECEIVED, ecs->event_thread->stop_signal);
+	  print_stop_reason (SIGNAL_RECEIVED, tp->stop_signal);
 	}
       /* Always stop on signals if we're either just gaining control
 	 of the program, or the user explicitly requested this thread
 	 to remain stopped.  */
       if (stop_soon != NO_STOP_QUIETLY
-	  || ecs->event_thread->stop_requested
-	  || signal_stop_state (ecs->event_thread->stop_signal))
+	  || tp->stop_requested
+	  || signal_stop_state (tp->stop_signal))
 	return 0;
       /* If not going to stop, give terminal back
          if we took it away.  */
@@ -2889,12 +2886,12 @@ process_event_stop_test:
 	target_terminal_inferior ();
 
       /* Clear the signal if it should not be passed.  */
-      if (signal_program[ecs->event_thread->stop_signal] == 0)
-	ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
+      if (signal_program[tp->stop_signal] == 0)
+	tp->stop_signal = TARGET_SIGNAL_0;
 
-      if (ecs->event_thread->prev_pc == read_pc ()
-	  && ecs->event_thread->trap_expected
-	  && ecs->event_thread->step_resume_breakpoint == NULL)
+      if (tp->prev_pc == read_pc ()
+	  && tp->trap_expected
+	  && tp->step_resume_breakpoint == NULL)
 	{
 	  /* We were just starting a new sequence, attempting to
 	     single-step off of a breakpoint and expecting a SIGTRAP.
@@ -2912,17 +2909,17 @@ process_event_stop_test:
                                 "breakpoint\n");
 
 	  insert_step_resume_breakpoint_at_frame (get_current_frame ());
-	  ecs->event_thread->step_after_step_resume_breakpoint = 1;
-	  return keep_going (ecs);
+	  tp->step_after_step_resume_breakpoint = 1;
+	  return keep_going (tp);
 	}
 
-      if (ecs->event_thread->step_range_end != 0
-	  && ecs->event_thread->stop_signal != TARGET_SIGNAL_0
-	  && (ecs->event_thread->step_range_start <= stop_pc
-	      && stop_pc < ecs->event_thread->step_range_end)
+      if (tp->step_range_end != 0
+	  && tp->stop_signal != TARGET_SIGNAL_0
+	  && (tp->step_range_start <= stop_pc
+	      && stop_pc < tp->step_range_end)
 	  && frame_id_eq (get_frame_id (get_current_frame ()),
-			  ecs->event_thread->step_frame_id)
-	  && ecs->event_thread->step_resume_breakpoint == NULL)
+			  tp->step_frame_id)
+	  && tp->step_resume_breakpoint == NULL)
 	{
 	  /* The inferior is about to take a signal that will take it
 	     out of the single step range.  Set a breakpoint at the
@@ -2939,7 +2936,7 @@ process_event_stop_test:
                                 "single-step range\n");
 
 	  insert_step_resume_breakpoint_at_frame (get_current_frame ());
-	  return keep_going (ecs);
+	  return keep_going (tp);
 	}
 
       /* Note: step_resume_breakpoint may be non-NULL.  This occures
@@ -2948,7 +2945,7 @@ process_event_stop_test:
 	 (leaving the inferior at the step-resume-breakpoint without
 	 actually executing it).  Either way continue until the
 	 breakpoint is really hit.  */
-      return keep_going (ecs);
+      return keep_going (tp);
     }
 
   /* Handle cases caused by hitting a breakpoint.  */
@@ -2956,7 +2953,7 @@ process_event_stop_test:
     CORE_ADDR jmp_buf_pc;
     struct bpstat_what what;
 
-    what = bpstat_what (ecs->event_thread->stop_bpstat);
+    what = bpstat_what (tp->stop_bpstat);
 
     if (what.call_dummy)
       {
@@ -2974,7 +2971,7 @@ process_event_stop_test:
 	  fprintf_unfiltered (gdb_stdlog,
 			      "infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME\n");
 
-	ecs->event_thread->stepping_over_breakpoint = 1;
+	tp->stepping_over_breakpoint = 1;
 
 	if (!gdbarch_get_longjmp_target_p (current_gdbarch)
 	    || !gdbarch_get_longjmp_target (current_gdbarch,
@@ -2983,34 +2980,34 @@ process_event_stop_test:
 	    if (debug_infrun)
 	      fprintf_unfiltered (gdb_stdlog, "\
 infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
-	    return keep_going (ecs);
+	    return keep_going (tp);
 	  }
 
 	/* We're going to replace the current step-resume breakpoint
 	   with a longjmp-resume breakpoint.  */
-	delete_step_resume_breakpoint (ecs->event_thread);
+	delete_step_resume_breakpoint (tp);
 
 	/* Insert a breakpoint at resume address.  */
 	insert_longjmp_resume_breakpoint (jmp_buf_pc);
 
-	return keep_going (ecs);
+	return keep_going (tp);
 
       case BPSTAT_WHAT_CLEAR_LONGJMP_RESUME:
         if (debug_infrun)
 	  fprintf_unfiltered (gdb_stdlog,
 			      "infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n");
 
-	gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
-	delete_step_resume_breakpoint (ecs->event_thread);
+	gdb_assert (tp->step_resume_breakpoint != NULL);
+	delete_step_resume_breakpoint (tp);
 
-	ecs->event_thread->stop_step = 1;
+	tp->stop_step = 1;
 	print_stop_reason (END_STEPPING_RANGE, 0);
 	return 0;
 
       case BPSTAT_WHAT_SINGLE:
         if (debug_infrun)
 	  fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
-	ecs->event_thread->stepping_over_breakpoint = 1;
+	tp->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;
@@ -3037,15 +3034,15 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
         if (debug_infrun)
 	  fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_STEP_RESUME\n");
 
-	delete_step_resume_breakpoint (ecs->event_thread);
-	if (ecs->event_thread->step_after_step_resume_breakpoint)
+	delete_step_resume_breakpoint (tp);
+	if (tp->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->event_thread->step_after_step_resume_breakpoint = 0;
-	    ecs->event_thread->stepping_over_breakpoint = 1;
-	    return keep_going (ecs);
+	    tp->step_after_step_resume_breakpoint = 0;
+	    tp->stepping_over_breakpoint = 1;
+	    return keep_going (tp);
 	  }
 	if (stop_pc == stop_func_start
 	    && execution_direction == EXEC_REVERSE)
@@ -3054,8 +3051,8 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	       just hit the step-resume breakpoint at the start
 	       address of the function.  Go back to single-stepping,
 	       which should take us back to the function call.  */
-	    ecs->event_thread->stepping_over_breakpoint = 1;
-	    return keep_going (ecs);
+	    tp->stepping_over_breakpoint = 1;
+	    return keep_going (tp);
 	  }
 	break;
 
@@ -3099,7 +3096,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	    return 0;
 
 	  /* We want to step over this breakpoint, then keep going.  */
-	  ecs->event_thread->stepping_over_breakpoint = 1;
+	  tp->stepping_over_breakpoint = 1;
 	}
 	break;
 
@@ -3121,39 +3118,38 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
      some other thread, we need to switch back to the stepped thread.  */
   if (!non_stop)
     {
-      struct thread_info *tp;
-      tp = iterate_over_threads (currently_stepping_callback,
-				 ecs->event_thread);
-      if (tp)
+      struct thread_info *step_tp
+	= iterate_over_threads (currently_stepping_callback, tp);
+
+      if (step_tp)
 	{
 	  /* However, if the current thread is blocked on some internal
 	     breakpoint, and we simply need to step over that breakpoint
 	     to get it going again, do that first.  */
-	  if ((ecs->event_thread->trap_expected
-	       && ecs->event_thread->stop_signal != TARGET_SIGNAL_TRAP)
-	      || ecs->event_thread->stepping_over_breakpoint)
-	    return keep_going (ecs);
+	  if ((tp->trap_expected
+	       && tp->stop_signal != TARGET_SIGNAL_TRAP)
+	      || tp->stepping_over_breakpoint)
+	    return keep_going (tp);
 
 	  /* Otherwise, we no longer expect a trap in the current thread.
 	     Clear the trap_expected flag before switching back -- this is
 	     what keep_going would do as well, if we called it.  */
-	  ecs->event_thread->trap_expected = 0;
+	  tp->trap_expected = 0;
 
 	  if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog,
 				"infrun: switching back to stepped thread\n");
 
-	  ecs->event_thread = tp;
-	  ecs->ptid = tp->ptid;
+	  ecs->ptid = step_tp->ptid;
 	  context_switch (ecs->ptid);
-	  return keep_going (ecs);
+	  return keep_going (step_tp);
 	}
     }
 
   /* 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->event_thread->stepping_through_solib_after_catch)
+  if (tp->stepping_through_solib_after_catch)
     {
 #if defined(SOLIB_ADD)
       /* Have we reached our destination?  If not, keep going. */
@@ -3161,24 +3157,23 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	{
           if (debug_infrun)
 	    fprintf_unfiltered (gdb_stdlog, "infrun: stepping in dynamic linker\n");
-	  ecs->event_thread->stepping_over_breakpoint = 1;
-	  return keep_going (ecs);
+	  tp->stepping_over_breakpoint = 1;
+	  return keep_going (tp);
 	}
 #endif
       if (debug_infrun)
 	 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->event_thread->stepping_through_solib_after_catch = 0;
-      bpstat_clear (&ecs->event_thread->stop_bpstat);
-      ecs->event_thread->stop_bpstat
-	= bpstat_copy (ecs->event_thread->stepping_through_solib_catchpoints);
-      bpstat_clear (&ecs->event_thread->stepping_through_solib_catchpoints);
+      tp->stepping_through_solib_after_catch = 0;
+      bpstat_clear (&tp->stop_bpstat);
+      tp->stop_bpstat = bpstat_copy (tp->stepping_through_solib_catchpoints);
+      bpstat_clear (&tp->stepping_through_solib_catchpoints);
       stop_print_frame = 1;
       return 0;
     }
 
-  if (ecs->event_thread->step_resume_breakpoint)
+  if (tp->step_resume_breakpoint)
     {
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog,
@@ -3187,15 +3182,15 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
       /* Having a step-resume breakpoint overrides anything
          else having to do with stepping commands until
          that breakpoint is reached.  */
-      return keep_going (ecs);
+      return keep_going (tp);
     }
 
-  if (ecs->event_thread->step_range_end == 0)
+  if (tp->step_range_end == 0)
     {
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: no stepping, continue\n");
       /* Likewise if we aren't even stepping.  */
-      return keep_going (ecs);
+      return keep_going (tp);
     }
 
   /* If stepping through a line, keep going if still within it.
@@ -3203,27 +3198,27 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
      Note that step_range_end is the address of the first instruction
      beyond the step range, and NOT the address of the last instruction
      within it! */
-  if (stop_pc >= ecs->event_thread->step_range_start
-      && stop_pc < ecs->event_thread->step_range_end)
+  if (stop_pc >= tp->step_range_start
+      && stop_pc < tp->step_range_end)
     {
       if (debug_infrun)
 	fprintf_unfiltered (gdb_stdlog, "infrun: stepping inside range [0x%s-0x%s]\n",
-			    paddr_nz (ecs->event_thread->step_range_start),
-			    paddr_nz (ecs->event_thread->step_range_end));
+			    paddr_nz (tp->step_range_start),
+			    paddr_nz (tp->step_range_end));
 
       /* When stepping backward, stop at beginning of line range
 	 (unless it's the function entry point, in which case
 	 keep going back to the call point).  */
-      if (stop_pc == ecs->event_thread->step_range_start
+      if (stop_pc == tp->step_range_start
 	  && stop_pc != stop_func_start
 	  && execution_direction == EXEC_REVERSE)
 	{
-	  ecs->event_thread->stop_step = 1;
+	  tp->stop_step = 1;
 	  print_stop_reason (END_STEPPING_RANGE, 0);
 	  return 0;
 	}
 
-      return keep_going (ecs);
+      return keep_going (tp);
     }
 
   /* We stepped out of the stepping range.  */
@@ -3232,7 +3227,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
      loader dynamic symbol resolution code, we keep on single stepping
      until we exit the run time loader code and reach the callee's
      address.  */
-  if (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
+  if (tp->step_over_calls == STEP_OVER_UNDEBUGGABLE
       && in_solib_dynsym_resolve_code (stop_pc))
     {
       CORE_ADDR pc_after_resolver =
@@ -3252,12 +3247,12 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
 	}
 
-      return keep_going (ecs);
+      return keep_going (tp);
     }
 
-  if (ecs->event_thread->step_range_end != 1
-      && (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
-	  || ecs->event_thread->step_over_calls == STEP_OVER_ALL)
+  if (tp->step_range_end != 1
+      && (tp->step_over_calls == STEP_OVER_UNDEBUGGABLE
+	  || tp->step_over_calls == STEP_OVER_ALL)
       && get_frame_type (get_current_frame ()) == SIGTRAMP_FRAME)
     {
       if (debug_infrun)
@@ -3267,7 +3262,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
          the signal handler returning).  Just single-step until the
          inferior leaves the trampoline (either by calling the handler
          or returning).  */
-      return keep_going (ecs);
+      return keep_going (tp);
     }
 
   /* Check for subroutine calls.  The check for the current frame
@@ -3279,9 +3274,9 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
      being equal, so to get into this block, both the current and
      previous frame must have valid frame IDs.  */
   if (!frame_id_eq (get_frame_id (get_current_frame ()),
-		    ecs->event_thread->step_frame_id)
+		    tp->step_frame_id)
       && (frame_id_eq (frame_unwind_id (get_current_frame ()),
-		       ecs->event_thread->step_frame_id)
+		       tp->step_frame_id)
 	  || execution_direction == EXEC_REVERSE))
     {
       CORE_ADDR real_stop_pc;
@@ -3289,10 +3284,9 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: stepped into subroutine\n");
 
-      if ((ecs->event_thread->step_over_calls == STEP_OVER_NONE)
-	  || ((ecs->event_thread->step_range_end == 1)
-	      && in_prologue (ecs->event_thread->prev_pc,
-			      stop_func_start)))
+      if ((tp->step_over_calls == STEP_OVER_NONE)
+	  || ((tp->step_range_end == 1)
+	      && in_prologue (tp->prev_pc, stop_func_start)))
 	{
 	  /* I presume that step_over_calls is only 0 when we're
 	     supposed to be stepping at the assembly language level
@@ -3300,12 +3294,12 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	  /* Also, maybe we just did a "nexti" inside a prolog, so we
 	     thought it was a subroutine call but it was not.  Stop as
 	     well.  FENN */
-	  ecs->event_thread->stop_step = 1;
+	  tp->stop_step = 1;
 	  print_stop_reason (END_STEPPING_RANGE, 0);
 	  return 0;
 	}
 
-      if (ecs->event_thread->step_over_calls == STEP_OVER_ALL)
+      if (tp->step_over_calls == STEP_OVER_ALL)
 	{
 	  /* We're doing a "next".
 
@@ -3333,7 +3327,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 
 		     Just keep stepping, we'll soon be home.
 		  */
-		  return keep_going (ecs);
+		  return keep_going (tp);
 		}
 	      /* Normal (staticly linked) function call return.  */
 	      init_sal (&sr_sal);
@@ -3343,7 +3337,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	  else
 	    insert_step_resume_breakpoint_at_caller (get_current_frame ());
 
-	  return keep_going (ecs);
+	  return keep_going (tp);
 	}
 
       /* If we are in a function call trampoline (a stub between the
@@ -3365,7 +3359,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	  sr_sal.pc = stop_func_start;
 
 	  insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
-	  return keep_going (ecs);
+	  return keep_going (tp);
 	}
 
       /* If we have line number information for the function we are
@@ -3381,20 +3375,20 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	if (tmp_sal.line != 0)
 	  {
 	    if (execution_direction == EXEC_REVERSE)
-	      return handle_step_into_function_backward (ecs);
+	      return handle_step_into_function_backward (tp);
 	    else
-	      return handle_step_into_function (ecs, stop_func_start,
-						     stop_func_end);
+	      return handle_step_into_function (tp, stop_func_start,
+						    stop_func_end);
 	  }
       }
 
       /* If we have no line number and the step-stop-if-no-debug is
          set, we stop the step so that the user has a chance to switch
          in assembly mode.  */
-      if (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
+      if (tp->step_over_calls == STEP_OVER_UNDEBUGGABLE
 	  && step_stop_if_no_debug)
 	{
-	  ecs->event_thread->stop_step = 1;
+	  tp->stop_step = 1;
 	  print_stop_reason (END_STEPPING_RANGE, 0);
 	  return 0;
 	}
@@ -3413,7 +3407,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	   at which the caller will resume).  */
 	insert_step_resume_breakpoint_at_caller (get_current_frame ());
 
-      return keep_going (ecs);
+      return keep_going (tp);
     }
 
   /* If we're in the return path from a shared library trampoline,
@@ -3446,7 +3440,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 
 	  /* Restart without fiddling with the step ranges or
 	     other state.  */
-	  return keep_going (ecs);
+	  return keep_going (tp);
 	}
     }
 
@@ -3455,7 +3449,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
   /* 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 (ecs->event_thread->step_over_calls == STEP_OVER_UNDEBUGGABLE
+  if (tp->step_over_calls == STEP_OVER_UNDEBUGGABLE
       && stop_func_name == NULL
       && stop_pc_sal.line == 0)
     {
@@ -3476,7 +3470,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	  /* If we have no line number and the step-stop-if-no-debug
 	     is set, we stop the step so that the user has a chance to
 	     switch in assembly mode.  */
-	  ecs->event_thread->stop_step = 1;
+	  tp->stop_step = 1;
 	  print_stop_reason (END_STEPPING_RANGE, 0);
 	  return 0;
 	}
@@ -3485,17 +3479,17 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
 	  /* Set a breakpoint at callee's return address (the address
 	     at which the caller will resume).  */
 	  insert_step_resume_breakpoint_at_caller (get_current_frame ());
-	  return keep_going (ecs);
+	  return keep_going (tp);
 	}
     }
 
-  if (ecs->event_thread->step_range_end == 1)
+  if (tp->step_range_end == 1)
     {
       /* It is stepi or nexti.  We always want to stop stepping after
          one instruction.  */
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: stepi/nexti\n");
-      ecs->event_thread->stop_step = 1;
+      tp->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       return 0;
     }
@@ -3508,14 +3502,14 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
          or can this happen as a result of a return or longjmp?).  */
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: no line number info\n");
-      ecs->event_thread->stop_step = 1;
+      tp->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       return 0;
     }
 
   if ((stop_pc == stop_pc_sal.pc)
-      && (ecs->event_thread->current_line != stop_pc_sal.line
- 	  || ecs->event_thread->current_symtab != stop_pc_sal.symtab))
+      && (tp->current_line != stop_pc_sal.line
+ 	  || tp->current_symtab != stop_pc_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.
@@ -3523,7 +3517,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
          better.  */
       if (debug_infrun)
 	 fprintf_unfiltered (gdb_stdlog, "infrun: stepped to a different line\n");
-      ecs->event_thread->stop_step = 1;
+      tp->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       return 0;
     }
@@ -3535,16 +3529,16 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
      new line in mid-statement, we continue stepping.  This makes
      things like for(;;) statements work better.)  */
 
-  ecs->event_thread->step_range_start = stop_pc_sal.pc;
-  ecs->event_thread->step_range_end = stop_pc_sal.end;
-  ecs->event_thread->step_frame_id = get_frame_id (get_current_frame ());
-  ecs->event_thread->current_line = stop_pc_sal.line;
-  ecs->event_thread->current_symtab = stop_pc_sal.symtab;
+  tp->step_range_start = stop_pc_sal.pc;
+  tp->step_range_end = stop_pc_sal.end;
+  tp->step_frame_id = get_frame_id (get_current_frame ());
+  tp->current_line = stop_pc_sal.line;
+  tp->current_symtab = stop_pc_sal.symtab;
 
   if (debug_infrun)
      fprintf_unfiltered (gdb_stdlog, "infrun: keep going\n");
 
-  return keep_going (ecs);
+  return keep_going (tp);
 }
 
 /* Are we in the middle of stepping?  */
@@ -3576,7 +3570,7 @@ currently_stepping (struct thread_info *
    it.  */
 
 static int
-handle_step_into_function (struct execution_control_state *ecs,
+handle_step_into_function (struct thread_info *tp,
 			   CORE_ADDR stop_func_start, CORE_ADDR stop_func_end)
 {
   struct symtab *s;
@@ -3623,7 +3617,7 @@ handle_step_into_function (struct execut
   if (stop_func_start == stop_pc)
     {
       /* We are already there: stop now.  */
-      ecs->event_thread->stop_step = 1;
+      tp->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       return 0;
     }
@@ -3640,10 +3634,10 @@ handle_step_into_function (struct execut
       insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
 
       /* And make sure stepping stops right away then.  */
-      ecs->event_thread->step_range_end = ecs->event_thread->step_range_start;
+      tp->step_range_end = tp->step_range_start;
     }
 
-  return keep_going (ecs);
+  return keep_going (tp);
 }
 
 /* Inferior has stepped backward into a subroutine call with source
@@ -3651,7 +3645,7 @@ handle_step_into_function (struct execut
    last line of code in it.  */
 
 static int
-handle_step_into_function_backward (struct execution_control_state *ecs)
+handle_step_into_function_backward (struct thread_info *tp)
 {
   struct symtab_and_line stop_func_sal;
   stop_func_sal = find_pc_line (stop_pc, 0);
@@ -3660,7 +3654,7 @@ handle_step_into_function_backward (stru
   if (stop_func_sal.pc == stop_pc)
     {
       /* We're there already.  Just stop stepping now.  */
-      ecs->event_thread->stop_step = 1;
+      tp->stop_step = 1;
       print_stop_reason (END_STEPPING_RANGE, 0);
       return 0;
     }
@@ -3669,9 +3663,9 @@ handle_step_into_function_backward (stru
       /* Else just reset the step range and keep going.
 	 No step-resume breakpoint, they don't work for
 	 epilogues, which can have multiple entry paths.  */
-      ecs->event_thread->step_range_start = stop_func_sal.pc;
-      ecs->event_thread->step_range_end = stop_func_sal.end;
-      return keep_going (ecs);
+      tp->step_range_start = stop_func_sal.pc;
+      tp->step_range_end = stop_func_sal.end;
+      return keep_going (tp);
     }
 }
 
@@ -3778,22 +3772,20 @@ insert_longjmp_resume_breakpoint (CORE_A
 /* (Used to be the keep_going: label in the old wait_for_inferior) */
 
 static int
-keep_going (struct execution_control_state *ecs)
+keep_going (struct thread_info *tp)
 {
   /* Save the pc before execution, to compare with pc after stop.  */
-  ecs->event_thread->prev_pc = read_pc ();		/* Might have been DECR_AFTER_BREAK */
+  tp->prev_pc = read_pc ();		/* Might have been DECR_AFTER_BREAK */
 
   /* If we did not do break;, it means we should keep running the
      inferior and not return to debugger.  */
 
-  if (ecs->event_thread->trap_expected
-      && ecs->event_thread->stop_signal != TARGET_SIGNAL_TRAP)
+  if (tp->trap_expected && tp->stop_signal != TARGET_SIGNAL_TRAP)
     {
       /* We took a signal (which we are supposed to pass through to
 	 the inferior, else we'd not get here) and we haven't yet
 	 gotten our trap.  Simply continue.  */
-      resume (currently_stepping (ecs->event_thread),
-	      ecs->event_thread->stop_signal);
+      resume (currently_stepping (tp), tp->stop_signal);
     }
   else
     {
@@ -3810,7 +3802,7 @@ keep_going (struct execution_control_sta
 	 already inserted breakpoints.  Therefore, we don't
 	 care if breakpoints were already inserted, or not.  */
       
-      if (ecs->event_thread->stepping_over_breakpoint)
+      if (tp->stepping_over_breakpoint)
 	{
 	  if (! use_displaced_stepping (current_gdbarch))
 	    /* Since we can't do a displaced step, we have to remove
@@ -3831,7 +3823,7 @@ keep_going (struct execution_control_sta
 	    return 0;
 	}
 
-      ecs->event_thread->trap_expected = ecs->event_thread->stepping_over_breakpoint;
+      tp->trap_expected = tp->stepping_over_breakpoint;
 
       /* Do not deliver SIGNAL_TRAP (except when the user explicitly
          specifies that such a signal should be delivered to the
@@ -3845,12 +3837,11 @@ keep_going (struct execution_control_sta
          simulator; the simulator then delivers the hardware
          equivalent of a SIGNAL_TRAP to the program being debugged. */
 
-      if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP
-	  && !signal_program[ecs->event_thread->stop_signal])
-	ecs->event_thread->stop_signal = TARGET_SIGNAL_0;
+      if (tp->stop_signal == TARGET_SIGNAL_TRAP
+	  && !signal_program[tp->stop_signal])
+	tp->stop_signal = TARGET_SIGNAL_0;
 
-      resume (currently_stepping (ecs->event_thread),
-	      ecs->event_thread->stop_signal);
+      resume (currently_stepping (tp), tp->stop_signal);
     }
 
   return 1;
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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