263
|
1
|
|
2 import subprocess
|
|
3 import tornado.web
|
|
4
|
|
5
|
|
6 def mangle(inp):
|
|
7 p_as = subprocess.Popen(['arm-elf-as', '-mthumb'], stdin=subprocess.PIPE)
|
|
8 p_as.communicate(input=inp.encode('ascii'))
|
|
9
|
|
10 p_objdump = subprocess.Popen(['arm-elf-objdump', '-d'], stdout=subprocess.PIPE)
|
|
11 output = p_objdump.communicate()[0].decode('ascii')
|
|
12 print(output)
|
|
13
|
|
14 p_objdump = subprocess.Popen(['arm-elf-objdump', '-s'], stdout=subprocess.PIPE)
|
|
15 output = p_objdump.communicate()[0].decode('ascii')
|
|
16 print(output)
|
|
17
|
|
18 class MainHandler(tornado.web.RequestHandler):
|
|
19 def get(self):
|
|
20 self.write('Hello')
|
|
21
|
|
22 if __name__ == '__main__':
|
|
23 inp = """add r1, r2, r3
|
|
24 """
|
|
25 inp2 = """blt henkie
|
|
26 bgt henkie
|
|
27 henkie:
|
|
28 """
|
|
29 mangle(inp2)
|
|
30
|
|
31
|