diff --git a/scripts/cdb/cmd.py b/scripts/cdb/cmd.py index 925578b..46741ce 100644 --- a/scripts/cdb/cmd.py +++ b/scripts/cdb/cmd.py @@ -1,6 +1,15 @@ def _b_cmd(browser, tab, scriptmgr, params): - pass + 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 _p_cmd(browser, tab, scriptmgr, params): pass @@ -13,6 +22,7 @@ def _processCdbCmd(cmd_str, browser, tab, scriptmgr): 'b': _b_cmd, 'p': None, } + print(cmdlist) if cmdlist[0] in cmd_hash: cmd_hash[cmdlist[0]](browser, tab, scriptmgr, cmdlist[1:]) else: @@ -25,7 +35,7 @@ def processCmd(browser, tab, scriptmgr): if cmdline[0] == '!': msg = eval(cmdline[1:]) else: - _processCdbCmd(cmdline[1:], browser, tab, scriptmgr) + _processCdbCmd(cmdline, browser, tab, scriptmgr) except Exception as e: print(e) diff --git a/scripts/cdb/scriptmgr.py b/scripts/cdb/scriptmgr.py index 2765f85..643bc59 100644 --- a/scripts/cdb/scriptmgr.py +++ b/scripts/cdb/scriptmgr.py @@ -8,3 +8,9 @@ class ScriptMgr: def debuggerOnScriptParsed(self, **kwargs): self.scripts.append(kwargs) + + def getUrl(self, filename): + for script in self.scripts: + if filename in script['url']: + return script['url'] + return None