| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Library used by debugger wire protocol tests (standalone VM debugging). | 5 // Library used by debugger wire protocol tests (standalone VM debugging). |
| 6 | 6 |
| 7 library DartDebugger; | 7 library DartDebugger; |
| 8 | 8 |
| 9 import "dart:async"; | 9 import "dart:async"; |
| 10 import "dart:convert"; | 10 import "dart:convert"; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 390 } |
| 391 | 391 |
| 392 | 392 |
| 393 Resume() => new RunCommand.resume(); | 393 Resume() => new RunCommand.resume(); |
| 394 Step() => new RunCommand.step(); | 394 Step() => new RunCommand.step(); |
| 395 StepInto() => new RunCommand.stepInto(); | 395 StepInto() => new RunCommand.stepInto(); |
| 396 StepOut() => new RunCommand.stepOut(); | 396 StepOut() => new RunCommand.stepOut(); |
| 397 | 397 |
| 398 class SetBreakpointCommand extends Command { | 398 class SetBreakpointCommand extends Command { |
| 399 int line; | 399 int line; |
| 400 SetBreakpointCommand(int this.line) { | 400 String url; |
| 401 SetBreakpointCommand(this.line, this.url) { |
| 401 template = {"id": 0, | 402 template = {"id": 0, |
| 402 "command": "setBreakpoint", | 403 "command": "setBreakpoint", |
| 403 "params": { "isolateId": 0, | 404 "params": { "isolateId": 0, |
| 404 "url": null, | 405 "url": null, |
| 405 "line": null }}; | 406 "line": null }}; |
| 406 } | 407 } |
| 407 | 408 |
| 408 void send(Debugger debugger) { | 409 void send(Debugger debugger) { |
| 409 assert(debugger.scriptUrl != null); | 410 assert(debugger.scriptUrl != null); |
| 410 template["params"]["url"] = debugger.scriptUrl; | 411 if (url == null) { |
| 412 url = debugger.scriptUrl; |
| 413 } |
| 414 template["params"]["url"] = url; |
| 411 template["params"]["line"] = line; | 415 template["params"]["line"] = line; |
| 412 debugger.sendMessage(template); | 416 debugger.sendMessage(template); |
| 413 } | 417 } |
| 414 | 418 |
| 415 void matchResponse(Debugger debugger) { | 419 void matchResponse(Debugger debugger) { |
| 416 super.matchResponse(debugger); | 420 super.matchResponse(debugger); |
| 417 print("Set breakpoint at line $line"); | 421 print("Set breakpoint at line $line in $url"); |
| 418 } | 422 } |
| 419 } | 423 } |
| 420 | 424 |
| 421 SetBreakpoint(int line) => new SetBreakpointCommand(line); | 425 SetBreakpoint(int line, {String url}) => new SetBreakpointCommand(line, url); |
| 422 | 426 |
| 423 class Event { | 427 class Event { |
| 424 String name; | 428 String name; |
| 425 Map params; | 429 Map params; |
| 426 | 430 |
| 427 Event(Map json) { | 431 Event(Map json) { |
| 428 name = json['event']; | 432 name = json['event']; |
| 429 params = json['params']; | 433 params = json['params']; |
| 430 } | 434 } |
| 431 } | 435 } |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 targetOpts.add("--debuggee"); | 703 targetOpts.add("--debuggee"); |
| 700 print('args: ${targetOpts.join(" ")}'); | 704 print('args: ${targetOpts.join(" ")}'); |
| 701 | 705 |
| 702 Process.start(Platform.executable, targetOpts).then((Process process) { | 706 Process.start(Platform.executable, targetOpts).then((Process process) { |
| 703 print("Debug target process started, pid ${process.pid}."); | 707 print("Debug target process started, pid ${process.pid}."); |
| 704 process.stdin.close(); | 708 process.stdin.close(); |
| 705 var debugger = new Debugger(process, new DebugScript(script)); | 709 var debugger = new Debugger(process, new DebugScript(script)); |
| 706 }); | 710 }); |
| 707 return true; | 711 return true; |
| 708 } | 712 } |
| OLD | NEW |