Added arbitrary ROM and instruction Count Debug addresses to Web IDE
This commit is contained in:
parent
6688439ec9
commit
e8d84296e1
|
@ -4,6 +4,7 @@ import array
|
||||||
import time
|
import time
|
||||||
import cherrypy
|
import cherrypy
|
||||||
import User_Interface as UI
|
import User_Interface as UI
|
||||||
|
import sys
|
||||||
|
|
||||||
class StringGenerator(object):
|
class StringGenerator(object):
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@ -38,6 +39,7 @@ class StringGenerator(object):
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def STOP(self):
|
def STOP(self):
|
||||||
|
print("Stopping after: " + str(UI.Count) + " Instructions" )
|
||||||
return UI.returnPage()
|
return UI.returnPage()
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@ -68,9 +70,12 @@ class StringGenerator(object):
|
||||||
UI.Step_lilith()
|
UI.Step_lilith()
|
||||||
while UI.Current_IP not in UI.Watchpoints:
|
while UI.Current_IP not in UI.Watchpoints:
|
||||||
UI.Step_lilith()
|
UI.Step_lilith()
|
||||||
|
if UI.Count >= UI.Debug_Point:
|
||||||
|
break
|
||||||
return UI.returnPage()
|
return UI.returnPage()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
UI.main(sys.argv[1:])
|
||||||
conf = {
|
conf = {
|
||||||
'/': {
|
'/': {
|
||||||
'tools.sessions.on': True,
|
'tools.sessions.on': True,
|
||||||
|
@ -87,7 +92,6 @@ if __name__ == '__main__':
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
webapp = StringGenerator()
|
webapp = StringGenerator()
|
||||||
webapp.generator = StringGenerator()
|
webapp.generator = StringGenerator()
|
||||||
cherrypy.quickstart(webapp, '/', conf)
|
cherrypy.quickstart(webapp, '/', conf)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import ctypes
|
import ctypes
|
||||||
import re
|
import re
|
||||||
|
import sys, getopt
|
||||||
|
|
||||||
subprocess.call("./bin/dis rom | sponge z_disassembled", shell=True)
|
|
||||||
vm = ctypes.CDLL('./libvm.so')
|
vm = ctypes.CDLL('./libvm.so')
|
||||||
|
|
||||||
vm.get_memory.argtype = ctypes.c_uint
|
vm.get_memory.argtype = ctypes.c_uint
|
||||||
|
@ -17,7 +17,8 @@ def Reset_lilith():
|
||||||
Current_IP = 0
|
Current_IP = 0
|
||||||
global Watchpoints
|
global Watchpoints
|
||||||
Watchpoints = {0}
|
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():
|
def Step_lilith():
|
||||||
global Current_IP
|
global Current_IP
|
||||||
|
@ -171,8 +172,30 @@ def get_footer():
|
||||||
</html>
|
</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_IP = 0
|
||||||
Current_Page = 0
|
Current_Page = 0
|
||||||
Watchpoints = {0}
|
Watchpoints = {0}
|
||||||
Count=0
|
Count=0
|
||||||
|
Debug_Point = 0
|
||||||
|
ROM_Name = "rom"
|
||||||
Reset_lilith()
|
Reset_lilith()
|
||||||
|
|
Loading…
Reference in New Issue