This commit is contained in:
aozhiwei 2019-10-12 19:27:21 +08:00
parent 9a03838b78
commit b0fb26d613

View File

@ -16,6 +16,18 @@ def _b_cmd(browser, tab, scriptmgr, params):
condition=''
)
def _bc_cmd(browser, tab, scriptmgr, params):
filename = params[0].split(':')[0]
line = int(params[0].split(':')[1])
url = scriptmgr.getUrl(filename)
print(params, url)
tab.call_method("Debugger.setBreakpointByUrl",
lineNumber=line,
url=url,
columnNumber=0,
condition=''
)
def _bt_cmd(browser, tab, scriptmgr, params):
scriptmgr.dumpStack()
@ -28,6 +40,21 @@ def _p_cmd(browser, tab, scriptmgr, params):
def _f_cmd(browser, tab, scriptmgr, params):
scriptmgr.curr_frame = int(params[0])
def _n_cmd(browser, tab, scriptmgr, params):
tab.call_method("Debugger.pause")
def _s_cmd(browser, tab, scriptmgr, params):
tab.call_method("Debugger.stepInto")
def _c_cmd(browser, tab, scriptmgr, params):
tab.call_method("Debugger.resume")
def _sout_cmd(browser, tab, scriptmgr, params):
tab.call_method("Debugger.stepOut")
def _sover_cmd(browser, tab, scriptmgr, params):
tab.call_method("Debugger.stepOver")
def _debugon_cmd(browser, tab, scriptmgr, params):
tab.debug = True
print('debug on')
@ -48,9 +75,15 @@ def _processCdbCmd(cmd_str, browser, tab, scriptmgr):
return
cmd_hash = {
'b': _b_cmd,
'bc': _bc_cmd,
'bt': _bt_cmd,
'p': _p_cmd,
'f': _f_cmd,
'n': _n_cmd,
's': _s_cmd,
'sout': _sout_cmd,
'sover': _sover_cmd,
'c': _c_cmd,
'debugon': _debugon_cmd,
'debugoff': _debugoff_cmd,
'q': _exit_cmd,