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 // This test forks a second vm process that runs a dart script as | 5 // This test forks a second vm process that runs a dart script as |
6 // a debug target, single stepping through the entire program, and | 6 // a debug target, single stepping through the entire program, and |
7 // recording each breakpoint. At the end, a coverage map of the source | 7 // recording each breakpoint. At the end, a coverage map of the source |
8 // is printed. | 8 // is printed. |
9 // | 9 // |
10 // Usage: dart coverage.dart [--wire] [--verbose] target_script.dart | 10 // Usage: dart coverage.dart [--wire] [--verbose] target_script.dart |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 }, | 383 }, |
384 onDone: () { | 384 onDone: () { |
385 print("Connection closed by coverage target"); | 385 print("Connection closed by coverage target"); |
386 cleanup(); | 386 cleanup(); |
387 }, | 387 }, |
388 onError: (e) { | 388 onError: (e) { |
389 print("Error '$e' detected in input stream from coverage target"); | 389 print("Error '$e' detected in input stream from coverage target"); |
390 cleanup(); | 390 cleanup(); |
391 }); | 391 }); |
392 }, | 392 }, |
393 onError: (e) { | 393 onError: (e, trace) { |
394 String msg = "Error while connecting to coverage target: $e"; | 394 String msg = "Error while connecting to coverage target: $e"; |
395 var trace = getAttachedStackTrace(e); | |
396 if (trace != null) msg += "\nStackTrace: $trace"; | 395 if (trace != null) msg += "\nStackTrace: $trace"; |
397 error(msg); | 396 error(msg); |
398 cleanup(); | 397 cleanup(); |
399 }); | 398 }); |
400 } | 399 } |
401 | 400 |
402 void cleanup() { | 401 void cleanup() { |
403 if (cleanupDone) return; | 402 if (cleanupDone) return; |
404 if (socket != null) { | 403 if (socket != null) { |
405 socket.close().catchError((error) { | 404 socket.close().catchError((error) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 targetOpts.add(str); | 537 targetOpts.add(str); |
539 break; | 538 break; |
540 } | 539 } |
541 } | 540 } |
542 | 541 |
543 Process.start(options.executable, targetOpts).then((Process process) { | 542 Process.start(options.executable, targetOpts).then((Process process) { |
544 process.stdin.close(); | 543 process.stdin.close(); |
545 debugger = new Debugger(process); | 544 debugger = new Debugger(process); |
546 }); | 545 }); |
547 } | 546 } |
OLD | NEW |