Call the set_state method in SimStatePlugin class, and then perform the delayed initialization.

        :param state: The SimState instance
167750
def set_state(self, state):
        
        SimStatePlugin.set_state(self, state)

        # Delayed initialization
        stack_region_map, generic_region_map = self._temp_stack_region_map, self._temp_generic_region_map

        if stack_region_map or generic_region_map:
            # Inherited from its parent
            self._stack_region_map = stack_region_map.copy()
            self._generic_region_map = generic_region_map.copy()

        else:
            if not self._abstract_backer and o.REGION_MAPPING in self.state.options:
                # Only the top-level SimMemory instance can have region maps.
                self._stack_region_map = RegionMap(True)
                self._generic_region_map = RegionMap(False)

            else:
                self._stack_region_map = None
                self._generic_region_map = None
123460
def autoload(self, state=True):
        
        if state and not self._timer:
            self._timer = QtCore.QTimer()
            self._timer.setInterval(500)
            self._timer.timeout.connect(self.testAutoload)
        if state and self._timer and not self._timer.isActive():
            self._timer.start()
        elif not state and self._timer and self._timer.isActive():
            self._timer.stop()
            del self._timer
            self._timer = None
938735
def restoreState(self):
        
        if os.path.exists(self._stateFile):
            try:
                fp = open(self._stateFile,  'r')
                stateObj = pickle.load(fp)
            except:
                raise IOError("Failure in reading plugin state from file: %s" 
                              % self._stateFile)
            return stateObj
        return None
1317801
private synchronized void setState(int state) {
        mState = state;

        // Give the new state to the Handler so the UI Activity can update
        mHandler.obtainMessage(ISOBlueDemo.MESSAGE_STATE_CHANGE, state, -1)
                .sendToTarget();
    }
306177
private void updateState(final TaskStatus.State state) {
    statusUpdater.setState(state);
    // Commit and push a new status
    try {
      statusUpdater.update();
    } catch (InterruptedException e) {
      // TODO: propagate interrupt instead?
      Thread.currentThread().interrupt();
    }
  }
1318199
def make_setup_state(
            self,
            app: 'Quart',
            first_registration: bool,
            *,
            url_prefix: Optional[str]=None,
    ) -> 'BlueprintSetupState':
        
        return BlueprintSetupState(self, app, first_registration, url_prefix=url_prefix)
860975
def addstate ( ps )
      raise TypeError, ps.class.to_s + ': Incorrectly types for \'<<\' method of <Parser>.' unless
	ps.instance_of? State
      @states << ps
    end
1169016
def until_state(self, desired_state, timeout=None):
        
        return self._state.until_state(desired_state, timeout=timeout)
1275417
def _prepare_initial_state(self, function_start, state):
        

        if state is None:
            state = self.project.factory.blank_state(mode="static",
                                                     remove_options=self._state_options_to_remove
                                                     )

        # make room for arguments passed to the function
        sp = state.regs.sp
        sp_val = state.solver.eval_one(sp)
        state.memory.set_stack_address_mapping(sp_val,
                                               state.memory.stack_id(function_start) + '_pre',
                                               0
                                               )
        state.registers.store('sp', sp - 0x100)

        # Set the stack address mapping for the initial stack
        state.memory.set_stack_size(state.arch.stack_size)
        initial_sp = state.solver.eval(state.regs.sp) # FIXME: This is bad, as it may lose tracking of multiple sp values
        initial_sp -= state.arch.bytes
        state.memory.set_stack_address_mapping(initial_sp,
                                               state.memory.stack_id(function_start),
                                               function_start
                                               )

        return state
247282
public void setInitialized() {

    boolean okay = (this.state == STATE_INITIALIZING);
    this.state = STATE_INITIALIZED;
    if (!okay) {
      if (isInitialized()) {
        throw new IllegalStateException("Already initialized.");
      } else {
        throw new IllegalStateException("You need to call setInitializing() before!");
      }
    }
  }
856054
private void setState(int[] nextState)
                    throws StateErrorException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "setState",
                        new Object[] { nextState,
                                      new Integer(state),
                                      stateNames[state] });

        synchronized (stateLock) {
            previousState = state; // Capture the previous state for dump. 
            state = nextState[state]; // Make the state change.       
        } // synchronized (stateLock)  

        if (state == stateError) {
            StateErrorException stateErrorException = new StateErrorException(this, previousState, stateNames[previousState]);
            ObjectManager.ffdc.processException(this, cclass, "setState", stateErrorException, "1:2016:1.34");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this,
                           cclass,
                           "setState",
                           new Object[] { stateErrorException,
                                         new Integer(state),
                                         stateNames[state] });
            throw stateErrorException;
        } // if (state == stateError).  

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this
                       , cclass
                       , "setState"
                       , "state=" + state + "(int) " + stateNames[state] + "(String)"
                            );
    }
697633
def set_state(self, state):
        
        for k, v in state.items():
            setattr(self, k, v)
503112
function setState(state) {
        return function (job, arg0, arg1) {
            job._setState(state, arg0, arg1);
        };
    }
339370
function(state) {
    self.readyState = state;
    if (typeof self.onreadystatechange === "function") {
      self.onreadystatechange();
    }

    if ("readystatechange" in listeners) {
      var count = listeners["readystatechange"].length, i = 0;
      for(; i < count; i++) {
        listeners["readystatechange"][i].call(self);
      }
    }
  }
656004
function StateManager(options) {
    // Initial state is pending
    this.state = states.pending;

    // If a state is passed in, then we go ahead and initialize the state manager with it
    if (options && options.state) {
      this.transition(options.state, options.value, options.context);
    }
  }
1228484
def recursively_register_child_states(self, state):
        
        self.logger.info("Execution status observer add new state {}".format(state))
        if isinstance(state, ContainerState):
            state.add_observer(self, "add_state",
                               notify_after_function=self.on_add_state)
            for state in list(state.states.values()):
                self.recursively_register_child_states(state)
                state.add_observer(self, "state_execution_status",
                                   notify_after_function=self.on_state_execution_status_changed_after)

        if isinstance(state, LibraryState):
            self.recursively_register_child_states(state.state_copy)
            state.add_observer(self, "state_execution_status",
                               notify_after_function=self.on_state_execution_status_changed_after)
392696
private void setState(IState toState)
    {
        // We want to make sure state changes happen purely on the "home" thread,
        // for the sake of sanity and avoiding many obscure race-condition bugs.
        if (Thread.currentThread() == this.homeThread)
        {
            // We are on the home thread, so safe to proceed:
            if (this.state != toState)
            {
                System.out.println(getName() + " enter state: " + toState);
                TCPUtils.Log(Level.INFO, "======== " + getName() + " enter state: " + toState + " ========");
                this.state = toState;
                onPreStateChange(toState);
                onStateChange();
            }
        }
        else
        {
            // We are not on the home thread; queue this state transition
            // so that the home thread can act on it.
            queueStateChange(toState);
        }
    }