static void xdb_handle_command (char *args, int from_tty);
 
-static void end_stepping_range (void);
-
 void _initialize_infrun (void);
 
 void nullify_last_target_wait_ptid (void);
 static void check_exception_resume (struct execution_control_state *,
                                    struct frame_info *);
 
+static void end_stepping_range (struct execution_control_state *ecs);
 static void stop_waiting (struct execution_control_state *ecs);
 static void prepare_to_wait (struct execution_control_state *ecs);
 static void keep_going (struct execution_control_state *ecs);
           exists.  */
        delete_step_resume_breakpoint (ecs->event_thread);
 
-       ecs->event_thread->control.stop_step = 1;
-       end_stepping_range ();
-       stop_waiting (ecs);
+       end_stepping_range (ecs);
       }
       return;
 
       if (stop_pc == ecs->event_thread->control.step_range_start
          && stop_pc != ecs->stop_func_start
          && execution_direction == EXEC_REVERSE)
-       {
-         ecs->event_thread->control.stop_step = 1;
-         end_stepping_range ();
-         stop_waiting (ecs);
-       }
+       end_stepping_range (ecs);
       else
        keep_going (ecs);
 
             thought it was a subroutine call but it was not.  Stop as
             well.  FENN */
          /* And this works the same backward as frontward.  MVS */
-         ecs->event_thread->control.stop_step = 1;
-         end_stepping_range ();
-         stop_waiting (ecs);
+         end_stepping_range (ecs);
          return;
        }
 
       if (ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
          && step_stop_if_no_debug)
        {
-         ecs->event_thread->control.stop_step = 1;
-         end_stepping_range ();
-         stop_waiting (ecs);
+         end_stepping_range (ecs);
          return;
        }
 
          /* 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->control.stop_step = 1;
-         end_stepping_range ();
-         stop_waiting (ecs);
+         end_stepping_range (ecs);
          return;
        }
       else
          one instruction.  */
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog, "infrun: stepi/nexti\n");
-      ecs->event_thread->control.stop_step = 1;
-      end_stepping_range ();
-      stop_waiting (ecs);
+      end_stepping_range (ecs);
       return;
     }
 
          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->control.stop_step = 1;
-      end_stepping_range ();
-      stop_waiting (ecs);
+      end_stepping_range (ecs);
       return;
     }
 
              && call_sal.symtab == ecs->event_thread->current_symtab)
            step_into_inline_frame (ecs->ptid);
 
-         ecs->event_thread->control.stop_step = 1;
-         end_stepping_range ();
-         stop_waiting (ecs);
+         end_stepping_range (ecs);
          return;
        }
       else
              && call_sal.symtab == ecs->event_thread->current_symtab)
            keep_going (ecs);
          else
-           {
-             ecs->event_thread->control.stop_step = 1;
-             end_stepping_range ();
-             stop_waiting (ecs);
-           }
+           end_stepping_range (ecs);
          return;
        }
     }
       if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
        keep_going (ecs);
       else
-       {
-         ecs->event_thread->control.stop_step = 1;
-         end_stepping_range ();
-         stop_waiting (ecs);
-       }
+       end_stepping_range (ecs);
       return;
     }
 
       if (debug_infrun)
         fprintf_unfiltered (gdb_stdlog,
                             "infrun: stepped to a different line\n");
-      ecs->event_thread->control.stop_step = 1;
-      end_stepping_range ();
-      stop_waiting (ecs);
+      end_stepping_range (ecs);
       return;
     }
 
   if (ecs->stop_func_start == stop_pc)
     {
       /* We are already there: stop now.  */
-      ecs->event_thread->control.stop_step = 1;
-      end_stepping_range ();
-      stop_waiting (ecs);
+      end_stepping_range (ecs);
       return;
     }
   else
   if (stop_func_sal.pc == stop_pc)
     {
       /* We're there already.  Just stop stepping now.  */
-      ecs->event_thread->control.stop_step = 1;
-      end_stepping_range ();
-      stop_waiting (ecs);
+      end_stepping_range (ecs);
     }
   else
     {
    if not in the middle of doing a "step N" operation for N > 1.  */
 
 static void
-end_stepping_range (void)
+end_stepping_range (struct execution_control_state *ecs)
 {
-  if (inferior_thread ()->step_multi
-      && inferior_thread ()->control.stop_step)
-    return;
-
-  observer_notify_end_stepping_range ();
+  ecs->event_thread->control.stop_step = 1;
+  if (!ecs->event_thread->step_multi)
+    observer_notify_end_stepping_range ();
+  stop_waiting (ecs);
 }
 
 /* Several print_*_reason functions to print why the inferior has stopped.