Skip to content

Commit

Permalink
Recover event traces that were lost due to JSON change after Jan PI m…
Browse files Browse the repository at this point in the history
…eeting.
  • Loading branch information
jim-carciofini committed Feb 13, 2024
1 parent fde7440 commit 6a8996d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pate_binja/.idea/runConfigurations/run_pate_demo.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions pate_binja/pate.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def extract_graph_rec(self,
and rec['trace_node_contents'][1].get('pretty') == 'Equivalence Counter-example'
):
for c in rec['trace_node_contents']:
if c.get('content', {}).get('original', {}).get('events'):
if c.get('content', {}).get('traces', {}):
cfar_parent.addExitMetaData(cfar_exit, 'ce_event_trace', c['content'])
# don't go any deeper
return
Expand All @@ -279,7 +279,7 @@ def extract_graph_rec(self,
cfar_parent.addExit(cfar_node)
if rec['trace_node_kind'] == 'blocktarget':
for c in rec['trace_node_contents']:
if c.get('content') and c['content'].get('original',{}).get('events'):
if c.get('content') and c['content'].get('traces', {}):
cfar_parent.addExitMetaData(cfar_exit, 'event_trace', c['content'])
if self.debug_cfar:
print('CFAR ID (parent):', cfar_parent.id)
Expand Down Expand Up @@ -511,16 +511,16 @@ def pprint_node_contents(self, pre: str = '', out: IO = sys.stdout,
# self.pprint_node_event_trace(self.exit_meta_data[n]['event_trace'], '', pre + ' ', out)

def pprint_node_event_trace(self, trace, label: str, pre: str = '', out: IO = sys.stdout):
if trace['original'].get('precondition'):
if trace.get('precondition'):
out.write(f'{pre}Trace Precondition:\n')
pprint_eq_domain(trace['original']['precondition'], pre + ' ', out)
if trace['original'].get('postcondition'):
pprint_eq_domain(trace['precondition'], pre + ' ', out)
if trace.get('postcondition'):
out.write(f'{pre}Trace Postcondition:\n')
pprint_eq_domain(trace['original']['postcondition'], pre + ' ', out)
if trace.get('original'):
pprint_event_trace(f'{label} Original', trace['original'], pre, out)
if trace.get('patched'):
pprint_event_trace(f'{label} Patched', trace['patched'], pre, out)
pprint_eq_domain(trace['postcondition'], pre + ' ', out)
if trace.get('traces', {}).get('original'):
pprint_event_trace(f'{label} Original', trace['traces']['original'], pre, out)
if trace.get('traces',{}).get('patched'):
pprint_event_trace(f'{label} Patched', trace['traces']['patched'], pre, out)


class CFARGraph:
Expand Down

0 comments on commit 6a8996d

Please sign in to comment.