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

Unified Diff: runtime/observatory/tests/service/test_helper.dart

Issue 1636083002: Improve Observatory debugger behaviour when an isolate exits with unhandled exceptions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/tests/service/pause_on_unhandled_exceptions_test.dart ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/test_helper.dart
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index 01704152c16bfe6876f5c001ef0023cf60956dce..1cbbe2f2ad36d853b3fb3c05b3f447dbb700cd10 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -26,7 +26,10 @@ class _TestLauncher {
Platform.script.toFilePath(),
_TESTEE_MODE_FLAG] {}
- Future<int> launch(bool pause_on_start, bool pause_on_exit, bool trace_service) {
+ Future<int> launch(bool pause_on_start,
+ bool pause_on_exit,
+ bool pause_on_unhandled_exceptions,
+ bool trace_service) {
assert(pause_on_start != null);
assert(pause_on_exit != null);
assert(trace_service != null);
@@ -41,6 +44,9 @@ class _TestLauncher {
if (pause_on_exit) {
fullArgs.add('--pause-isolates-on-exit');
}
+ if (pause_on_unhandled_exceptions) {
+ fullArgs.add('--pause-isolates-on-unhandled-exceptions');
+ }
fullArgs.addAll(Platform.executableArguments);
fullArgs.addAll(args);
print('** Launching $dartExecutable ${fullArgs.join(' ')}');
@@ -110,7 +116,8 @@ void runIsolateTests(List<String> mainArgs,
bool pause_on_start: false,
bool pause_on_exit: false,
bool trace_service: false,
- bool verbose_vm: false}) {
+ bool verbose_vm: false,
+ bool pause_on_unhandled_exceptions: false}) {
assert(!pause_on_start || testeeBefore == null);
if (mainArgs.contains(_TESTEE_MODE_FLAG)) {
if (!pause_on_start) {
@@ -128,7 +135,8 @@ void runIsolateTests(List<String> mainArgs,
}
} else {
var process = new _TestLauncher();
- process.launch(pause_on_start, pause_on_exit, trace_service).then((port) {
+ process.launch(pause_on_start, pause_on_exit,
+ pause_on_unhandled_exceptions, trace_service).then((port) {
if (mainArgs.contains("--gdb")) {
port = 8181;
}
@@ -157,15 +165,14 @@ void runIsolateTests(List<String> mainArgs,
}
}
-
-Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
+Future<Isolate> hasPausedFor(Isolate isolate, String kind) {
// Set up a listener to wait for breakpoint events.
Completer completer = new Completer();
isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
var subscription;
subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kPauseBreakpoint) {
- print('Breakpoint reached');
+ if (event.kind == kind) {
+ print('Paused with $kind');
subscription.cancel();
if (completer != null) {
// Reload to update isolate.pauseEvent.
@@ -178,9 +185,9 @@ Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
// Pause may have happened before we subscribed.
isolate.reload().then((_) {
if ((isolate.pauseEvent != null) &&
- (isolate.pauseEvent.kind == ServiceEvent.kPauseBreakpoint)) {
+ (isolate.pauseEvent.kind == kind)) {
// Already waiting at a breakpoint.
- print('Breakpoint reached');
+ print('Paused with $kind');
subscription.cancel();
if (completer != null) {
completer.complete(isolate);
@@ -193,6 +200,13 @@ Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
return completer.future; // Will complete when breakpoint hit.
}
+Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
+ return hasPausedFor(isolate, ServiceEvent.kPauseBreakpoint);
+}
+
+Future<Isolate> hasStoppedWithUnhandledException(Isolate isolate) {
+ return hasPausedFor(isolate, ServiceEvent.kPauseException);
+}
Future<Isolate> hasPausedAtStart(Isolate isolate) {
// Set up a listener to wait for breakpoint events.
@@ -343,7 +357,8 @@ Future runVMTests(List<String> mainArgs,
bool pause_on_start: false,
bool pause_on_exit: false,
bool trace_service: false,
- bool verbose_vm: false}) async {
+ bool verbose_vm: false,
+ bool pause_on_unhandled_exceptions: false}) async {
if (mainArgs.contains(_TESTEE_MODE_FLAG)) {
if (!pause_on_start) {
if (testeeBefore != null) {
@@ -362,6 +377,7 @@ Future runVMTests(List<String> mainArgs,
var process = new _TestLauncher();
process.launch(pause_on_start,
pause_on_exit,
+ pause_on_unhandled_exceptions,
trace_service).then((port) async {
if (mainArgs.contains("--gdb")) {
port = 8181;
« no previous file with comments | « runtime/observatory/tests/service/pause_on_unhandled_exceptions_test.dart ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698