diff options
author | apavlov@chromium.org <apavlov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 13:09:01 +0000 |
---|---|---|
committer | apavlov@chromium.org <apavlov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 13:09:01 +0000 |
commit | 87a5513d6d22071b0bb1252ebae381b9d841505d (patch) | |
tree | 46fa64c3388c19be2a0393af092d2f3ddcb338c0 | |
parent | 6625a6604c161746ca2e9789e5a49dc6383b4fdb (diff) | |
download | chromium_src-87a5513d6d22071b0bb1252ebae381b9d841505d.zip chromium_src-87a5513d6d22071b0bb1252ebae381b9d841505d.tar.gz chromium_src-87a5513d6d22071b0bb1252ebae381b9d841505d.tar.bz2 |
Support conditional breakpoints in DevTools (backend) to follow WebKit
BUG= https://bugs.webkit.org/show_bug.cgi?id=28846 (upstream)
TEST= conditional breakpoints work with a local WebKit frontend patch
Review URL: http://codereview.chromium.org/182042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25165 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 69 | ||||
-rw-r--r-- | webkit/glue/devtools/js/devtools.html | 1 | ||||
-rw-r--r-- | webkit/glue/devtools/js/inspector_controller.js | 14 | ||||
-rw-r--r-- | webkit/glue/devtools/js/inspector_controller_impl.js | 9 |
4 files changed, 86 insertions, 7 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index cb2a87720..239dd4e 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -220,8 +220,10 @@ devtools.DebuggerAgent.prototype.pauseExecution = function() { /** * @param {number} sourceId Id of the script fot the breakpoint. * @param {number} line Number of the line for the breakpoint. + * @param {?string} condition The breakpoint condition. */ -devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) { +devtools.DebuggerAgent.prototype.addBreakpoint = function( + sourceId, line, condition) { var script = this.parsedScripts_[sourceId]; if (!script) { return; @@ -247,7 +249,8 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) { 'groupId': this.contextId_, 'type': 'script', 'target': script.getUrl(), - 'line': line + 'line': line, + 'condition': condition }; } else { var breakpointInfo = script.getBreakpointInfo(line); @@ -262,7 +265,8 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) { 'groupId': this.contextId_, 'type': 'scriptId', 'target': sourceId, - 'line': line + 'line': line, + 'condition': condition }; } @@ -271,11 +275,15 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) { this.requestNumberToBreakpointInfo_[cmd.getSequenceNumber()] = breakpointInfo; devtools.DebuggerAgent.sendCommand_(cmd); + // Force v8 execution so that it gets to processing the requested command. + // It is necessary for being able to change a breakpoint just after it + // has been created (since we need an existing breakpoint id for that). + devtools.tools.evaluateJavaScript(devtools.DebuggerAgent.VOID_SCRIPT); }; /** - * @param {number} sourceId Id of the script fot the breakpoint. + * @param {number} sourceId Id of the script for the breakpoint. * @param {number} line Number of the line for the breakpoint. */ devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line) { @@ -316,6 +324,40 @@ devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line) { /** + * @param {number} sourceId Id of the script for the breakpoint. + * @param {number} line Number of the line for the breakpoint. + * @param {?string} condition New breakpoint condition. + */ +devtools.DebuggerAgent.prototype.updateBreakpoint = function( + sourceId, line, condition) { + var script = this.parsedScripts_[sourceId]; + if (!script) { + return; + } + + line = devtools.DebuggerAgent.webkitToV8LineNumber_(line); + + var breakpointInfo; + if (script.getUrl()) { + var breakpoints = this.urlToBreakpoints_[script.getUrl()]; + breakpointInfo = breakpoints[line]; + } else { + breakpointInfo = script.getBreakpointInfo(line); + } + + var id = breakpointInfo.getV8Id(); + + // If we don't know id of this breakpoint in the v8 debugger we cannot send + // the 'changebreakpoint' request. + if (id != -1) { + // TODO(apavlov): make use of the real values for 'enabled' and + // 'ignoreCount' when appropriate. + this.requestChangeBreakpoint_(id, true, condition, null); + } +}; + + +/** * Tells the v8 debugger to step into the next statement. */ devtools.DebuggerAgent.prototype.stepIntoStatement = function() { @@ -590,6 +632,25 @@ devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function( /** + * Changes breakpoint parameters in the v8 debugger. + * @param {number} breakpointId Id of the breakpoint in the v8 debugger. + * @param {boolean} enabled Whether to enable the breakpoint. + * @param {?string} condition New breakpoint condition. + * @param {number} ignoreCount New ignore count for the breakpoint. + */ +devtools.DebuggerAgent.prototype.requestChangeBreakpoint_ = function( + breakpointId, enabled, condition, ignoreCount) { + var cmd = new devtools.DebugCommand('changebreakpoint', { + 'breakpoint': breakpointId, + 'enabled': enabled, + 'condition': condition, + 'ignoreCount': ignoreCount + }); + devtools.DebuggerAgent.sendCommand_(cmd); +}; + + +/** * Sends 'backtrace' request to v8. */ devtools.DebuggerAgent.prototype.requestBacktrace_ = function() { diff --git a/webkit/glue/devtools/js/devtools.html b/webkit/glue/devtools/js/devtools.html index 5406243..9c88467 100644 --- a/webkit/glue/devtools/js/devtools.html +++ b/webkit/glue/devtools/js/devtools.html @@ -102,6 +102,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="DatabasesPanel.js"></script> <script type="text/javascript" src="ProfilesPanel.js"></script> <script type="text/javascript" src="ResourceView.js"></script> + <script type="text/javascript" src="Popup.js"></script> <script type="text/javascript" src="SourceFrame.js"></script> <script type="text/javascript" src="SourceView.js"></script> <script type="text/javascript" src="FontView.js"></script> diff --git a/webkit/glue/devtools/js/inspector_controller.js b/webkit/glue/devtools/js/inspector_controller.js index a281648..235c166 100644 --- a/webkit/glue/devtools/js/inspector_controller.js +++ b/webkit/glue/devtools/js/inspector_controller.js @@ -301,9 +301,10 @@ devtools.InspectorController.prototype.disableDebugger = function() { * Adds breakpoint to the given line of the source with given ID. * @param {string} sourceID Source Id to add breakpoint to. * @param {number} line Line number to add breakpoint to. + * @param {?string} condition The breakpoint condition. */ devtools.InspectorController.prototype.addBreakpoint = - function(sourceID, line) { + function(sourceID, line, condition) { }; @@ -318,6 +319,17 @@ devtools.InspectorController.prototype.removeBreakpoint = /** + * Sets a breakpoint condition given a line of the source and an ID. + * @param {string} sourceID Source Id to remove breakpoint from. + * @param {number} line Line number to remove breakpoint from. + * @param {?string} condition New breakpoint condition. + */ +devtools.InspectorController.prototype.updateBreakpoint = + function(sourceID, line, condition) { +}; + + +/** * Tells backend to pause in the debugger. */ devtools.InspectorController.prototype.pauseInDebugger = function() { diff --git a/webkit/glue/devtools/js/inspector_controller_impl.js b/webkit/glue/devtools/js/inspector_controller_impl.js index d5ee965..c23ee1f 100644 --- a/webkit/glue/devtools/js/inspector_controller_impl.js +++ b/webkit/glue/devtools/js/inspector_controller_impl.js @@ -159,8 +159,8 @@ devtools.InspectorControllerImpl.prototype.debuggerEnabled = function() { devtools.InspectorControllerImpl.prototype.addBreakpoint = function( - sourceID, line) { - devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line); + sourceID, line, condition) { + devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition); }; @@ -169,6 +169,11 @@ devtools.InspectorControllerImpl.prototype.removeBreakpoint = function( devtools.tools.getDebuggerAgent().removeBreakpoint(sourceID, line); }; +devtools.InspectorControllerImpl.prototype.updateBreakpoint = function( + sourceID, line, condition) { + devtools.tools.getDebuggerAgent().updateBreakpoint( + sourceID, line, condition); +}; devtools.InspectorControllerImpl.prototype.pauseInDebugger = function() { devtools.tools.getDebuggerAgent().pauseExecution(); |