diff python/bcanalyzer.py @ 105:6a303f835c6d

Removed compilers directory
author Windel Bouwman
date Mon, 31 Dec 2012 17:35:17 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/bcanalyzer.py	Mon Dec 31 17:35:17 2012 +0100
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+import sys, os, argparse
+from ppci.core import BitcodeReader
+
+if __name__ == '__main__':
+   parser = argparse.ArgumentParser(description='Bitcode analyzer')
+   parser.add_argument('bitcodefile', type=str, help='the bitcode file to analyze')
+   args = parser.parse_args()
+
+   try:
+      with open(args.bitcodefile, 'rb') as f:
+         bcr = BitcodeReader(f)
+         module = bcr.parseModule()
+   except IOError:
+      print('Failed to load {0}'.format(args.bitcodefile))
+      sys.exit(3)
+   print(module)
+