Added arbitrary ROM and instruction Count Debug addresses to Web IDE

This commit is contained in:
Jeremiah Orians 2017-02-12 10:34:12 -05:00
parent 6688439ec9
commit e8d84296e1
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
2 changed files with 30 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import array
import time
import cherrypy
import User_Interface as UI
import sys
class StringGenerator(object):
@cherrypy.expose
@ -38,6 +39,7 @@ class StringGenerator(object):
@cherrypy.expose
def STOP(self):
print("Stopping after: " + str(UI.Count) + " Instructions" )
return UI.returnPage()
@cherrypy.expose
@ -68,9 +70,12 @@ class StringGenerator(object):
UI.Step_lilith()
while UI.Current_IP not in UI.Watchpoints:
UI.Step_lilith()
if UI.Count >= UI.Debug_Point:
break
return UI.returnPage()
if __name__ == '__main__':
UI.main(sys.argv[1:])
conf = {
'/': {
'tools.sessions.on': True,
@ -87,7 +92,6 @@ if __name__ == '__main__':
}
}
webapp = StringGenerator()
webapp.generator = StringGenerator()
cherrypy.quickstart(webapp, '/', conf)

View File

@ -1,8 +1,8 @@
import subprocess
import ctypes
import re
import sys, getopt
subprocess.call("./bin/dis rom | sponge z_disassembled", shell=True)
vm = ctypes.CDLL('./libvm.so')
vm.get_memory.argtype = ctypes.c_uint
@ -17,7 +17,8 @@ def Reset_lilith():
Current_IP = 0
global Watchpoints
Watchpoints = {0}
vm.load_lilith(ctypes.create_string_buffer("rom".encode('ascii')))
global ROM_Name
vm.load_lilith(ctypes.create_string_buffer(ROM_Name.encode('ascii')))
def Step_lilith():
global Current_IP
@ -171,8 +172,30 @@ def get_footer():
</html>
"""
def main(argv):
global Debug_Point
try:
opts, args = getopt.getopt(argv,"R:D:",["ROM=","DEBUG="])
except getopt.GetoptError:
print ('Knight.py ROM=$NAME DEBUG=$NUMBER\n')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('Knight.py ROM=$NAME DEBUG=$NUMBER\n')
sys.exit()
elif opt in ("-R", "--ROM"):
global ROM_Name
ROM_Name = arg
elif opt in ("-D", "--DEBUG"):
global Debug_Point
Debug_Point = int(arg)
subprocess.call("./bin/dis " + ROM_Name + " | sponge z_disassembled", shell=True)
Current_IP = 0
Current_Page = 0
Watchpoints = {0}
Count=0
Debug_Point = 0
ROM_Name = "rom"
Reset_lilith()