Expanded features for web IDE

This commit is contained in:
Jeremiah Orians 2016-08-11 20:18:53 -04:00
parent da5c2a2442
commit c5c1fce062
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
2 changed files with 32 additions and 12 deletions

View File

@ -41,12 +41,9 @@ class StringGenerator(object):
def STOP(self):
return UI.returnPage()
@cherrypy.expose
def PAUSE(self):
return UI.returnPage()
@cherrypy.expose
def RESET(self):
UI.Reset_lilith()
return UI.returnPage()
@cherrypy.expose
@ -55,6 +52,18 @@ class StringGenerator(object):
UI.Watchpoints.add(int(Inst, 16))
return UI.returnPage()
@cherrypy.expose
def PAGEDOWN(self):
UI.Current_Page = UI.Current_Page + 4096
return UI.returnPage()
@cherrypy.expose
def PAGEUP(self):
UI.Current_Page = UI.Current_Page - 4096
if 0 > UI.Current_Page:
UI.Current_Page = 0
return UI.returnPage()
if __name__ == '__main__':
conf = {
'/': {

View File

@ -5,10 +5,15 @@ import re
subprocess.call("./bin/dis foo | sponge z_disassembled", shell=True)
vm = ctypes.CDLL('./libvm.so')
vm.initialize_lilith()
Current_IP = 0
Watchpoints = {0}
vm.load_lilith(ctypes.create_string_buffer("foo".encode('ascii')))
def Reset_lilith():
vm.initialize_lilith()
global Current_IP
Current_IP = 0
global Watchpoints
Watchpoints = {0}
vm.load_lilith(ctypes.create_string_buffer("foo".encode('ascii')))
def Step_lilith():
global Current_IP
@ -17,7 +22,7 @@ def Step_lilith():
return
def returnPage():
return get_header() + (vm.get_memory(0)).decode('utf-8') + get_spacer1() + get_registers(0) + get_registers(8) + get_spacer2() + get_disassembled() + get_footer()
return get_header() + (vm.get_memory(Current_Page)).decode('utf-8') + get_spacer1() + get_registers(0) + get_registers(8) + get_spacer2() + get_disassembled() + get_footer()
vm.get_memory.argtype = ctypes.c_uint
vm.get_memory.restype = ctypes.c_char_p
@ -58,9 +63,10 @@ def get_header():
<body>
<div>
<a href="RUN"><button type="button">RUN</button></a>
<a href="STEP"><button type="button">STEP</button></a>
<a href="STOP"><button type="button">STOP</button></a>
<a href="PAUSE"><button type="button">PAUSE</button></a>
<a href="PAGEDOWN"><button type="button">PAGE DOWN</button></a>
<a href="PAGEUP"><button type="button">PAGE UP</button></a>
<a href="STEP"><button type="button">STEP</button></a>
<a href="RESET"><button type="button">RESET</button></a>
</div>
<div>
@ -114,7 +120,7 @@ def get_registers(index):
<tbody>"""
for i in range(0,8):
temp = temp + """<tr"><td>R""" + str(index + i) + "</td><td>" + formatRegister(vm.get_register(index + i)) + "</td></tr>\n"
temp = temp + """<tr><td>R""" + str(index + i) + "</td><td>" + formatRegister(vm.get_register(index + i)) + "</td></tr>\n"
return temp + """ </tbody>
</table> """
@ -153,3 +159,8 @@ def get_footer():
</body>
</html>
"""
Current_IP = 0
Current_Page = 0
Watchpoints = {0}
Reset_lilith()