OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Provides communication interface to remote v8 debugger. See | 6 * @fileoverview Provides communication interface to remote v8 debugger. See |
7 * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol | 7 * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol |
8 */ | 8 */ |
9 goog.provide('devtools.DebuggerAgent'); | 9 goog.provide('devtools.DebuggerAgent'); |
10 | 10 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 try { | 216 try { |
217 msg = new devtools.DebuggerMessage(output); | 217 msg = new devtools.DebuggerMessage(output); |
218 } catch(e) { | 218 } catch(e) { |
219 debugPrint('Failed to handle debugger reponse:\n' + e); | 219 debugPrint('Failed to handle debugger reponse:\n' + e); |
220 throw e; | 220 throw e; |
221 } | 221 } |
222 | 222 |
223 if (msg.getType() == 'event') { | 223 if (msg.getType() == 'event') { |
224 if (msg.getEvent() == 'break') { | 224 if (msg.getEvent() == 'break') { |
225 this.handleBreakEvent_(msg); | 225 this.handleBreakEvent_(msg); |
| 226 } else if (msg.getEvent() == 'exception') { |
| 227 this.handleExceptionEvent_(msg); |
226 } | 228 } |
227 } else if (msg.getType() == 'response') { | 229 } else if (msg.getType() == 'response') { |
228 if (msg.getCommand() == 'scripts') { | 230 if (msg.getCommand() == 'scripts') { |
229 this.handleScriptsResponse_(msg); | 231 this.handleScriptsResponse_(msg); |
230 } else if (msg.getCommand() == 'setbreakpoint') { | 232 } else if (msg.getCommand() == 'setbreakpoint') { |
231 this.handleSetBreakpointResponse_(msg); | 233 this.handleSetBreakpointResponse_(msg); |
232 } else if (msg.getCommand() == 'clearbreakpoint') { | 234 } else if (msg.getCommand() == 'clearbreakpoint') { |
233 this.handleClearBreakpointResponse_(msg); | 235 this.handleClearBreakpointResponse_(msg); |
234 } else if (msg.getCommand() == 'backtrace') { | 236 } else if (msg.getCommand() == 'backtrace') { |
235 this.handleBacktraceResponse_(msg); | 237 this.handleBacktraceResponse_(msg); |
(...skipping 16 matching lines...) Expand all Loading... |
252 'thisObject': {} | 254 'thisObject': {} |
253 }; | 255 }; |
254 | 256 |
255 this.requestBacktrace_(); | 257 this.requestBacktrace_(); |
256 }; | 258 }; |
257 | 259 |
258 | 260 |
259 /** | 261 /** |
260 * @param {devtools.DebuggerMessage} msg | 262 * @param {devtools.DebuggerMessage} msg |
261 */ | 263 */ |
| 264 devtools.DebuggerAgent.prototype.handleExceptionEvent_ = function(msg) { |
| 265 var body = msg.getBody(); |
| 266 debugPrint('Uncaught exception in ' + body.script.name + ':' + |
| 267 body.sourceLine + '\n' + body.sourceLineText); |
| 268 this.resumeExecution(); |
| 269 }; |
| 270 |
| 271 |
| 272 /** |
| 273 * @param {devtools.DebuggerMessage} msg |
| 274 */ |
262 devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg) { | 275 devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg) { |
263 var scripts = msg.getBody(); | 276 var scripts = msg.getBody(); |
264 for (var i = 0; i < scripts.length; i++) { | 277 for (var i = 0; i < scripts.length; i++) { |
265 var script = scripts[i]; | 278 var script = scripts[i]; |
266 | 279 |
267 this.parsedScripts_[script.id] = new devtools.ScriptInfo( | 280 this.parsedScripts_[script.id] = new devtools.ScriptInfo( |
268 script.id, script.lineOffset); | 281 script.id, script.lineOffset); |
269 | 282 |
270 WebInspector.parsedScriptSource( | 283 WebInspector.parsedScriptSource( |
271 script.id, script.name, script.source, script.lineOffset); | 284 script.id, script.name, script.source, script.lineOffset); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 622 |
610 | 623 |
611 /** | 624 /** |
612 * @param {number} handle Object handle. | 625 * @param {number} handle Object handle. |
613 * @return {?Object} Returns the object with the handle if it was sent in this | 626 * @return {?Object} Returns the object with the handle if it was sent in this |
614 * message(some objects referenced by handles may be missing in the message). | 627 * message(some objects referenced by handles may be missing in the message). |
615 */ | 628 */ |
616 devtools.DebuggerMessage.prototype.lookup = function(handle) { | 629 devtools.DebuggerMessage.prototype.lookup = function(handle) { |
617 return this.refs_[handle]; | 630 return this.refs_[handle]; |
618 }; | 631 }; |
OLD | NEW |