105
|
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
|