about summary refs log tree commit diff stats
path: root/tools/capture_transforms.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/capture_transforms.py')
-rw-r--r--tools/capture_transforms.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/capture_transforms.py b/tools/capture_transforms.py
new file mode 100644
index 0000000..de35d86
--- /dev/null
+++ b/tools/capture_transforms.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+import argparse
+import logging
+
+from focaccia import parser
+from focaccia.symbolic import collect_symbolic_trace
+
+def main():
+    prog = argparse.ArgumentParser()
+    prog.description = 'Trace an executable concolically to capture symbolic' \
+                       ' transformations among instructions.'
+    prog.add_argument('binary', help='The program to analyse.')
+    prog.add_argument('args', action='store', nargs=argparse.REMAINDER,
+                      help='Arguments to the program.')
+    prog.add_argument('-o', '--output',
+                      default='trace.out',
+                      help='Name of output file. (default: trace.out)')
+    args = prog.parse_args()
+
+    logging.disable(logging.CRITICAL)
+    trace = collect_symbolic_trace(args.binary, args.args, None)
+    with open(args.output, 'w') as file:
+        parser.serialize_transformations(trace, file)
+
+if __name__ == "__main__":
+    main()