Mercurial > lcfOS
comparison python/bcanalyzer.py @ 105:6a303f835c6d
Removed compilers directory
author | Windel Bouwman |
---|---|
date | Mon, 31 Dec 2012 17:35:17 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
104:ed230e947dc6 | 105:6a303f835c6d |
---|---|
1 #!/usr/bin/python | |
2 | |
3 import sys, os, argparse | |
4 from ppci.core import BitcodeReader | |
5 | |
6 if __name__ == '__main__': | |
7 parser = argparse.ArgumentParser(description='Bitcode analyzer') | |
8 parser.add_argument('bitcodefile', type=str, help='the bitcode file to analyze') | |
9 args = parser.parse_args() | |
10 | |
11 try: | |
12 with open(args.bitcodefile, 'rb') as f: | |
13 bcr = BitcodeReader(f) | |
14 module = bcr.parseModule() | |
15 except IOError: | |
16 print('Failed to load {0}'.format(args.bitcodefile)) | |
17 sys.exit(3) | |
18 print(module) | |
19 |