-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjjvm.py
More file actions
executable file
·36 lines (30 loc) · 742 Bytes
/
jjvm.py
File metadata and controls
executable file
·36 lines (30 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python
import argparse
from jjvm.jclass import jclass
from jjvm.jutil import readU2
import os
import struct
import sys
###############
### CLASSES ###
###############
class MyParser(argparse.ArgumentParser):
def error(self, message):
sys.stderr.write('error: %s\n' % message)
self.print_help()
sys.exit(2)
###################
### SUBROUTINES ###
###################
############
### MAIN ###
############
parser = MyParser('Run bytecode in jjvm')
parser.add_argument('path', help='path to class')
args = parser.parse_args()
clazz = jclass(args.path)
for m in clazz.getMethods().values():
print "Method name: %s" % m.getName()
print "Descriptor: %s" % m.getDescriptor()
m.printCode()
print