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

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
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/isolate_summary.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 (eventKind == ServiceEvent.kPauseException &&
1508 " isolate when an unhandled exception occurs."); 1512 (error.exception.isStackOverflowError ||
1509 console.newline(); 1513 error.exception.isOutOfMemoryError)) {
1510 console.printBold("You can make this the default by running with " 1514 console.printBold(
1511 "--pause-isolates-on-unhandled-exceptions"); 1515 'When an unhandled stack overflow or OOM exception occurs, the VM '
1516 'has run out of memory and cannot keep the stack alive while '
1517 'paused.');
1518 } else {
1519 console.printBold("Type 'set break-on-exception Unhandled' to pause the"
1520 " isolate when an unhandled exception occurs.");
1521 console.printBold("You can make this the default by running with "
1522 "--pause-isolates-on-unhandled-exceptions");
1523 }
1512 } 1524 }
1513 1525
1514 void _reportPause(ServiceEvent event) { 1526 void _reportPause(ServiceEvent event) {
1515 if (event.kind == ServiceEvent.kPauseStart) { 1527 if (event.kind == ServiceEvent.kPauseStart) {
1516 console.print( 1528 console.print(
1517 "Paused at isolate start " 1529 "Paused at isolate start "
1518 "(type 'continue' [F7] or 'step' [F10] to start the isolate')"); 1530 "(type 'continue' [F7] or 'step' [F10] to start the isolate')");
1519 } else if (event.kind == ServiceEvent.kPauseExit) { 1531 } else if (event.kind == ServiceEvent.kPauseExit) {
1520 console.print( 1532 console.print(
1521 "Paused at isolate exit " 1533 "Paused at isolate exit "
1522 "(type 'continue' or [F7] to exit the isolate')"); 1534 "(type 'continue' or [F7] to exit the isolate')");
1523 _reportIsolateError(isolate); 1535 _reportIsolateError(isolate, event.kind);
1536 } else if (event.kind == ServiceEvent.kPauseException) {
1537 console.print(
1538 "Paused at an unhandled exception "
1539 "(type 'continue' or [F7] to exit the isolate')");
1540 _reportIsolateError(isolate, event.kind);
1524 } else if (stack['frames'].length > 0) { 1541 } else if (stack['frames'].length > 0) {
1525 Frame frame = stack['frames'][0]; 1542 Frame frame = stack['frames'][0];
1526 var script = frame.location.script; 1543 var script = frame.location.script;
1527 script.load().then((_) { 1544 script.load().then((_) {
1528 var line = script.tokenToLine(frame.location.tokenPos); 1545 var line = script.tokenToLine(frame.location.tokenPos);
1529 var col = script.tokenToCol(frame.location.tokenPos); 1546 var col = script.tokenToCol(frame.location.tokenPos);
1530 if (event.breakpoint != null) { 1547 if (event.breakpoint != null) {
1531 var bpId = event.breakpoint.number; 1548 var bpId = event.breakpoint.number;
1532 console.print('Paused at breakpoint ${bpId} at ' 1549 console.print('Paused at breakpoint ${bpId} at '
1533 '${script.name}:${line}:${col}'); 1550 '${script.name}:${line}:${col}');
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 } 2670 }
2654 }); 2671 });
2655 } 2672 }
2656 2673
2657 void focus() { 2674 void focus() {
2658 $['textBox'].focus(); 2675 $['textBox'].focus();
2659 } 2676 }
2660 2677
2661 DebuggerInputElement.created() : super.created(); 2678 DebuggerInputElement.created() : super.created();
2662 } 2679 }
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/lib/src/elements/isolate_summary.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698