fix trace-saving behavior (#454)

This commit is contained in:
JP Smith 2017-08-15 10:50:46 -05:00 committed by GitHub
parent 09bb702fac
commit 7bb64fe26e
2 changed files with 3 additions and 2 deletions

View File

@ -499,9 +499,9 @@ class ManticoreOutput(object):
def save_trace(self, state):
with self._named_stream('trace') as f:
if 'visited' not in state.context:
if 'trace' not in state.context:
return
for pc in state.context['visited']:
for pc in state.context['trace']:
f.write('0x{:08x}\n'.format(pc))
def save_constraints(self, state):

View File

@ -557,6 +557,7 @@ class Manticore(object):
def _execute_instruction_callback(self, state, instruction):
address = state.cpu.PC
if not issymbolic(address):
state.context.setdefault('trace', list()).append(address)
state.context.setdefault('visited_since_last_fork', set()).add(address)
state.context.setdefault('visited', set()).add(address)
count = state.context.get('instructions_count', 0)