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

Unified Diff: runtime/vm/service.cc

Issue 1399743002: Straw man setExceptionPauseMode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index ec493b6d417074d2885b55ed35145a2a53aa3db2..ae77ccd1f8a59885c7f2d1fc393840370d0fdcd6 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -3007,33 +3007,41 @@ static bool RestartVM(Isolate* isolate, JSONStream* js) {
}
-static const MethodParameter* set_exception_pause_info_params[] = {
+static const char* exception_pause_mode_names[] = {
+ "All",
+ "None",
+ "Unhandled",
+ NULL,
+};
+
+
+static Dart_ExceptionPauseInfo exception_pause_mode_values[] = {
+ kPauseOnAllExceptions,
+ kNoPauseOnExceptions,
+ kPauseOnUnhandledExceptions,
+ static_cast<Dart_ExceptionPauseInfo>(-1), // Fall through.
+};
+
+
+static const MethodParameter* set_exception_pause_mode_params[] = {
ISOLATE_PARAMETER,
+ new EnumParameter("mode", true, exception_pause_mode_names),
NULL,
};
-static bool SetExceptionPauseInfo(Isolate* isolate, JSONStream* js) {
- const char* exceptions = js->LookupParam("exceptions");
- if (exceptions == NULL) {
- PrintMissingParamError(js, "exceptions");
+static bool SetExceptionPauseMode(Isolate* isolate, JSONStream* js) {
+ const char* mode = js->LookupParam("mode");
+ if (mode == NULL) {
+ PrintMissingParamError(js, "mode");
return true;
}
-
- Dart_ExceptionPauseInfo info = kNoPauseOnExceptions;
- if (strcmp(exceptions, "none") == 0) {
- info = kNoPauseOnExceptions;
- } else if (strcmp(exceptions, "all") == 0) {
- info = kPauseOnAllExceptions;
- } else if (strcmp(exceptions, "unhandled") == 0) {
- info = kPauseOnUnhandledExceptions;
- } else {
- JSONObject jsobj(js);
- jsobj.AddProperty("type", "Error");
- jsobj.AddProperty("message", "illegal value for parameter 'exceptions'");
+ Dart_ExceptionPauseInfo info =
+ EnumMapper(mode, exception_pause_mode_names, exception_pause_mode_values);
+ if (info == -1) {
+ PrintInvalidParamError(js, "mode");
return true;
}
-
isolate->debugger()->SetExceptionPauseInfo(info);
if (Service::debug_stream.enabled()) {
ServiceEvent event(isolate, ServiceEvent::kDebuggerSettingsUpdate);
@@ -3258,8 +3266,8 @@ static ServiceMethodDescriptor service_methods_[] = {
resume_params },
{ "_requestHeapSnapshot", RequestHeapSnapshot,
request_heap_snapshot_params },
- { "_setExceptionPauseInfo", SetExceptionPauseInfo,
- set_exception_pause_info_params },
+ { "setExceptionPauseMode", SetExceptionPauseMode,
+ set_exception_pause_mode_params },
turnidge 2015/10/12 16:43:51 There should be a way to read the current pause mo
Cutch 2015/10/12 17:51:42 Done.
{ "_setFlag", SetFlag,
set_flags_params },
{ "setLibraryDebuggable", SetLibraryDebuggable,

Powered by Google App Engine
This is Rietveld 408576698