diff --git a/manticore/core/manticore.py b/manticore/core/manticore.py index 3d5b8cf0e..19ddfa3ba 100644 --- a/manticore/core/manticore.py +++ b/manticore/core/manticore.py @@ -397,6 +397,11 @@ def __init__( self._snapshot = None self._main_id = os.getpid(), threading.current_thread().ident + # Make sure terminated workers are restarted + self.subscribe("did_terminate_worker", self.did_terminate_worker_callback) + self.last_id = self._workers[-1].id + self.number_killed_states = self.count_killed_states() + def is_main(self): """True if called from the main process/script Note: in "single" mode this is _most likely_ True""" @@ -1235,6 +1240,18 @@ def wait_for_log_purge(self): break time.sleep(0.25) + def did_terminate_worker_callback(self, id): + ks = self.count_killed_states() + new_number_killed_states = ks - self.number_killed_states + if new_number_killed_states > 0: + self.number_killed_states = ks + logger.warning("Found %d new killed states" % new_number_killed_states) + for _ in range(new_number_killed_states): + self.last_id = self.last_id + 1 + w = self._worker_type(id=self.last_id, manticore=self) + self._workers.append(w) + w.start() + ############################################################################ ############################################################################ ############################################################################