Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: runtime/observatory/lib/src/elements/debugger.dart

Issue 1709383002: Improve behaviour when we hit a stack overflow / OOM error (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 debugger_page_element; 5 library debugger_page_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:math'; 9 import 'dart:math';
10 import 'observatory_element.dart'; 10 import 'observatory_element.dart';
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 } else if (_isolate.running) { 1485 } else if (_isolate.running) {
1486 console.print("Isolate is running (type 'pause' to interrupt)"); 1486 console.print("Isolate is running (type 'pause' to interrupt)");
1487 } else if (_isolate.pauseEvent != null) { 1487 } else if (_isolate.pauseEvent != null) {
1488 _reportPause(_isolate.pauseEvent); 1488 _reportPause(_isolate.pauseEvent);
1489 } else { 1489 } else {
1490 console.print('Isolate is in unknown state'); 1490 console.print('Isolate is in unknown state');
1491 } 1491 }
1492 warnOutOfDate(); 1492 warnOutOfDate();
1493 } 1493 }
1494 1494
1495 void _reportIsolateError(Isolate isolate) { 1495 void _reportIsolateError(Isolate isolate, String eventKind) {
1496 if (isolate == null) { 1496 if (isolate == null) {
1497 return; 1497 return;
1498 } 1498 }
1499 DartError error = isolate.error; 1499 DartError error = isolate.error;
1500 if (error == null) { 1500 if (error == null) {
1501 return; 1501 return;
1502 } 1502 }
1503 console.newline(); 1503 console.newline();
1504 console.printBold('Isolate exited due to an unhandled exception:'); 1504 if (eventKind == ServiceEvent.kPauseException) {
1505 console.printBold('Isolate will exit due to an unhandled exception:');
1506 } else {
1507 console.printBold('Isolate has exited due to an unhandled exception:');
1508 }
1505 console.print(error.message); 1509 console.print(error.message);
1506 console.newline(); 1510 console.newline();
1507 console.printBold("Type 'set break-on-exception Unhandled' to pause the" 1511 if (error.exception.isStackOverflowError ||
1508 " isolate when an unhandled exception occurs."); 1512 error.exception.isOutOfMemoryError) {
1509 console.newline(); 1513 console.printBold('The unhandled exception is a stack overflow or out of '
1510 console.printBold("You can make this the default by running with " 1514 'memory therefor the isolate cannot be paused.');
rmacnak 2016/02/22 17:55:27 therefore
Cutch 2016/02/22 18:38:17 Done.
1511 "--pause-isolates-on-unhandled-exceptions"); 1515 } else {
1516 console.printBold("Type 'set break-on-exception Unhandled' to pause the"
1517 " isolate when an unhandled exception occurs.");
1518 console.printBold("You can make this the default by running with "
1519 "--pause-isolates-on-unhandled-exceptions");
1520 }
1512 } 1521 }
1513 1522
1514 void _reportPause(ServiceEvent event) { 1523 void _reportPause(ServiceEvent event) {
1515 if (event.kind == ServiceEvent.kPauseStart) { 1524 if (event.kind == ServiceEvent.kPauseStart) {
1516 console.print( 1525 console.print(
1517 "Paused at isolate start " 1526 "Paused at isolate start "
1518 "(type 'continue' [F7] or 'step' [F10] to start the isolate')"); 1527 "(type 'continue' [F7] or 'step' [F10] to start the isolate')");
1519 } else if (event.kind == ServiceEvent.kPauseExit) { 1528 } else if (event.kind == ServiceEvent.kPauseExit) {
1520 console.print( 1529 console.print(
1521 "Paused at isolate exit " 1530 "Paused at isolate exit "
1522 "(type 'continue' or [F7] to exit the isolate')"); 1531 "(type 'continue' or [F7] to exit the isolate')");
1523 _reportIsolateError(isolate); 1532 _reportIsolateError(isolate, event.kind);
1533 } else if (event.kind == ServiceEvent.kPauseException) {
1534 console.print(
1535 "Paused at an unhandled exception "
1536 "(type 'continue' or [F7] to exit the isolate')");
1537 _reportIsolateError(isolate, event.kind);
1524 } else if (stack['frames'].length > 0) { 1538 } else if (stack['frames'].length > 0) {
1525 Frame frame = stack['frames'][0]; 1539 Frame frame = stack['frames'][0];
1526 var script = frame.location.script; 1540 var script = frame.location.script;
1527 script.load().then((_) { 1541 script.load().then((_) {
1528 var line = script.tokenToLine(frame.location.tokenPos); 1542 var line = script.tokenToLine(frame.location.tokenPos);
1529 var col = script.tokenToCol(frame.location.tokenPos); 1543 var col = script.tokenToCol(frame.location.tokenPos);
1530 if (event.breakpoint != null) { 1544 if (event.breakpoint != null) {
1531 var bpId = event.breakpoint.number; 1545 var bpId = event.breakpoint.number;
1532 console.print('Paused at breakpoint ${bpId} at ' 1546 console.print('Paused at breakpoint ${bpId} at '
1533 '${script.name}:${line}:${col}'); 1547 '${script.name}:${line}:${col}');
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 } 2667 }
2654 }); 2668 });
2655 } 2669 }
2656 2670
2657 void focus() { 2671 void focus() {
2658 $['textBox'].focus(); 2672 $['textBox'].focus();
2659 } 2673 }
2660 2674
2661 DebuggerInputElement.created() : super.created(); 2675 DebuggerInputElement.created() : super.created();
2662 } 2676 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698