From 7bb64fe26e0ce43d33211e73e1ebf9f4e81c60be Mon Sep 17 00:00:00 2001 From: JP Smith Date: Tue, 15 Aug 2017 10:50:46 -0500 Subject: [PATCH] fix trace-saving behavior (#454) --- manticore/core/workspace.py | 4 ++-- manticore/manticore.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/manticore/core/workspace.py b/manticore/core/workspace.py index 93196ec..76bb2c4 100644 --- a/manticore/core/workspace.py +++ b/manticore/core/workspace.py @@ -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): diff --git a/manticore/manticore.py b/manticore/manticore.py index b25fdf4..c97e622 100644 --- a/manticore/manticore.py +++ b/manticore/manticore.py @@ -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)