refactored will_execute_pc hooks (#214)

* Refactored will_execute_pc hooks

* Fixed typos

* Figured out why the simple_parse test was failing

* Figured out why the simple_parse test was failing

* Figured out why the simple_parse test was failing

* Figured out why the simple_parse test was failing

Cleanup

* Cleanup

* removed TODO from executor.py

* refactored line in forking handling in executor.py

* removed extraneous space in manticore.py

* removed --exe flag from nosetests command
This commit is contained in:
Manas George 2017-05-02 14:55:02 -04:00 committed by Mark Mossberg
parent 0061ee5c48
commit f4e5bcf53e
4 changed files with 13 additions and 7 deletions

3
.gitignore vendored
View File

@ -92,3 +92,6 @@ ENV/
# macOS Finder files
.DS_Store
# PyCharm files
.idea/

View File

@ -665,7 +665,7 @@ class Executor(object):
# allow us to terminate manticore processes
while not self.isShutdown():
# Announce that we're about to execute
self.will_execute_pc(current_state, current_state.cpu.PC)
self.will_execute_pc(current_state)
if not current_state.execute():
break
@ -760,7 +760,7 @@ class Executor(object):
with current_state as new_state:
children.append(new_state.co)
new_state.add(e.constraint)
self.newerror(new_state.current.PC)
self.newerror(new_state.cpu.PC)
self.generate_testcase(new_state, "Symbolic Memory Exception: " + str(e))
logger.info("Forking state %d into states %r",current_state.co, children)

View File

@ -499,7 +499,8 @@ class Manticore(object):
# TODO(yan) this should be a dict
self._model_hooks.setdefault(int(address,0), set()).add(cb)
def _model_hook_callback(self, state, pc):
def _model_hook_callback(self, state):
pc = state.cpu.PC
if pc not in self._model_hooks:
return
@ -577,7 +578,8 @@ class Manticore(object):
'''
self._executor.shutdown()
def _assertions_callback(self, state, pc):
def _assertions_callback(self, state):
pc = state.cpu.PC
if pc not in self._assertions:
return
@ -591,13 +593,14 @@ class Manticore(object):
if not solver.can_be_true(state.constraints, assertion):
logger.info(str(state.cpu))
logger.info("Assertion %x -> {%s} does not hold. Aborting state.",
state.cpu.pc, program)
state.cpu.PC, program)
raise AbandonState()
#Everything is good add it.
state.constraints.add(assertion)
def _hook_callback(self, state, pc):
def _hook_callback(self, state):
pc = state.cpu.PC
'Invoke all registered generic hooks'
# Ignore symbolic pc.

View File

@ -1885,7 +1885,7 @@ class SLinux(Linux):
self.symbolic_files = state['symbolic_files']
super(SLinux, self).__setstate__(state)
#Distpatchers...
#Dispatchers...
def syscall(self, cpu):
try:
return super(SLinux, self).syscall(cpu)