diff --git a/manticore/core/state.py b/manticore/core/state.py index bbcf1def7..18f320f35 100644 --- a/manticore/core/state.py +++ b/manticore/core/state.py @@ -89,9 +89,6 @@ def __init__(self, constraints, platform, **kwargs): # Events are lost in serialization and fork !! self.forward_events_from(platform) - # FIXME(felipe) This should go into some event callback in a plugin (start_run?) - self._init_context() - def __getstate__(self): state = super().__getstate__() state['platform'] = self._platform @@ -418,24 +415,3 @@ def symbolicate_buffer(self, data, label='INPUT', wildcard='+', string=False, ta else: assert b != 0 return data - - @property - def cpu(self): - return self._platform.current - - @property - def mem(self): - return self._platform.current.memory - - # FIXME(felipe) Remove this - def _init_context(self): - self.context['branches'] = dict() - - # FIXME(felipe) Remove this - def record_branch(self, target): - branches = self.context['branches'] - branch = (self.cpu._last_pc, target) - if branch in branches: - branches[branch] += 1 - else: - branches[branch] = 1 diff --git a/manticore/native/state.py b/manticore/native/state.py index 3f8508c56..70c64f51c 100644 --- a/manticore/native/state.py +++ b/manticore/native/state.py @@ -3,6 +3,13 @@ class State(StateBase): + @property + def cpu(self): + return self._platform.current + + @property + def mem(self): + return self._platform.current.memory def execute(self): from .cpu.abstractcpu import ConcretizeRegister # must be here, otherwise we get circular imports diff --git a/manticore/platforms/platform.py b/manticore/platforms/platform.py index aba34faec..c70489980 100644 --- a/manticore/platforms/platform.py +++ b/manticore/platforms/platform.py @@ -6,9 +6,10 @@ class OSException(Exception): class SyscallNotImplemented(OSException): - ''' Exception raised when you try to call an unimplemented - system call. Go to linux.py and add it! - ''' + """ + Exception raised when you try to call an unimplemented system call. + Go to linux.py and add it! + """ def __init__(self, idx, name): msg = f'Syscall index "{idx}" ({name}) not implemented.' @@ -24,9 +25,9 @@ def __init__(self, reg_num, message='Concretizing syscall argument', policy='SAM class Platform(Eventful): - ''' - Base class for all operating system platforms. - ''' + """ + Base class for all platforms e.g. operating systems or virtual machines. + """ def __init__(self, path, **kwargs): super().__init__(**kwargs)