Version 1.14.1
Cherry-pick ce650790a1446f205a49714b717b844eed6196fd to stable
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index e45cb8d..f4ce72f 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -41,6 +41,7 @@
static const kCannotAddBreakpoint = 102;
static const kStreamAlreadySubscribed = 103;
static const kStreamNotSubscribed = 104;
+ static const kIsolateMustBeRunnable = 105;
int code;
Map data;
diff --git a/runtime/vm/json_stream.h b/runtime/vm/json_stream.h
index 239c4e7..95d2041 100644
--- a/runtime/vm/json_stream.h
+++ b/runtime/vm/json_stream.h
@@ -50,6 +50,7 @@
kCannotAddBreakpoint = 102,
kStreamAlreadySubscribed = 103,
kStreamNotSubscribed = 104,
+ kIsolateMustBeRunnable = 105,
};
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 631a4ec..c533852 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -234,6 +234,7 @@
jsobj.AddProperty("type", "Success");
}
+
static bool GetIntegerId(const char* s, intptr_t* id, int base = 10) {
if ((s == NULL) || (*s == '\0')) {
// Empty string.
@@ -404,6 +405,12 @@
return required_;
}
+ virtual void PrintError(const char* name,
+ const char* value,
+ JSONStream* js) const {
+ PrintInvalidParamError(js, name);
+ }
+
private:
const char* name_;
bool required_;
@@ -422,9 +429,6 @@
};
-#define NO_ISOLATE_PARAMETER new NoSuchParameter("isolateId")
-
-
class BoolParameter : public MethodParameter {
public:
BoolParameter(const char* name, bool required)
@@ -519,8 +523,29 @@
};
-#define ISOLATE_PARAMETER new IdParameter("isolateId", true)
+class RunnableIsolateParameter : public MethodParameter {
+ public:
+ explicit RunnableIsolateParameter(const char* name)
+ : MethodParameter(name, true) {
+ }
+ virtual bool Validate(const char* value) const {
+ Isolate* isolate = Isolate::Current();
+ return (value != NULL) && (isolate != NULL) && (isolate->is_runnable());
+ }
+
+ virtual void PrintError(const char* name,
+ const char* value,
+ JSONStream* js) const {
+ js->PrintError(kIsolateMustBeRunnable,
+ "Isolate must be runnable before this request is made.");
+ }
+};
+
+
+#define ISOLATE_PARAMETER new IdParameter("isolateId", true)
+#define NO_ISOLATE_PARAMETER new NoSuchParameter("isolateId")
+#define RUNNABLE_ISOLATE_PARAMETER new RunnableIsolateParameter("isolateId")
class EnumParameter : public MethodParameter {
public:
@@ -708,7 +733,7 @@
return false;
}
if (has_parameter && !parameter->Validate(value)) {
- PrintInvalidParamError(js, name);
+ parameter->PrintError(name, value, js);
return false;
}
}
@@ -1170,7 +1195,7 @@
static const MethodParameter* get_stack_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new BoolParameter("_full", false),
NULL,
};
@@ -1779,7 +1804,7 @@
static const MethodParameter* get_inbound_references_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -1878,7 +1903,7 @@
static const MethodParameter* get_retaining_path_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -1921,7 +1946,7 @@
static const MethodParameter* get_retained_size_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("targetId", true),
NULL,
};
@@ -1963,7 +1988,7 @@
static const MethodParameter* get_reachable_size_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("targetId", true),
NULL,
};
@@ -2005,7 +2030,7 @@
static const MethodParameter* evaluate_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2076,7 +2101,7 @@
static const MethodParameter* evaluate_in_frame_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new UIntParameter("frameIndex", true),
new MethodParameter("expression", true),
NULL,
@@ -2141,7 +2166,7 @@
static const MethodParameter* get_instances_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2299,7 +2324,7 @@
static const MethodParameter* get_coverage_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("targetId", false),
NULL,
};
@@ -2327,7 +2352,7 @@
static const MethodParameter* get_source_report_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
reports_parameter,
new IdParameter("scriptId", false),
new UIntParameter("tokenPos", false),
@@ -2392,7 +2417,7 @@
static const MethodParameter* get_call_site_data_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("targetId", false),
NULL,
};
@@ -2439,7 +2464,7 @@
static const MethodParameter* add_breakpoint_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("scriptId", true),
new UIntParameter("line", true),
new UIntParameter("column", false),
@@ -2467,7 +2492,7 @@
static const MethodParameter* add_breakpoint_with_script_uri_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("scriptUri", true),
new UIntParameter("line", true),
new UIntParameter("column", false),
@@ -2488,7 +2513,7 @@
static const MethodParameter* add_breakpoint_at_entry_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("functionId", true),
NULL,
};
@@ -2521,7 +2546,7 @@
static const MethodParameter* add_breakpoint_at_activation_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("objectId", true),
NULL,
};
@@ -2554,7 +2579,7 @@
static const MethodParameter* remove_breakpoint_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2684,7 +2709,7 @@
static const MethodParameter* get_isolate_metric_list_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2712,7 +2737,7 @@
static const MethodParameter* get_isolate_metric_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2860,7 +2885,7 @@
static const MethodParameter* resume_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2913,7 +2938,7 @@
static const MethodParameter* pause_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2932,7 +2957,7 @@
static const MethodParameter* get_tag_profile_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -2966,7 +2991,7 @@
static const MethodParameter* get_cpu_profile_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new EnumParameter("tags", true, tags_enum_names),
new BoolParameter("_codeTransitionTags", false),
new Int64Parameter("timeOriginMicros", false),
@@ -2997,7 +3022,7 @@
static const MethodParameter* get_cpu_profile_timeline_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new EnumParameter("tags", true, tags_enum_names),
new Int64Parameter("timeOriginMicros", false),
new Int64Parameter("timeExtentMicros", false),
@@ -3021,7 +3046,7 @@
static const MethodParameter* get_allocation_samples_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new EnumParameter("tags", true, tags_enum_names),
new IdParameter("classId", false),
new Int64Parameter("timeOriginMicros", false),
@@ -3056,7 +3081,7 @@
static const MethodParameter* clear_cpu_profile_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3069,7 +3094,7 @@
static const MethodParameter* get_allocation_profile_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3108,7 +3133,7 @@
static const MethodParameter* get_heap_map_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3121,7 +3146,7 @@
static const MethodParameter* request_heap_snapshot_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3275,7 +3300,7 @@
static const MethodParameter* get_object_by_address_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3330,7 +3355,7 @@
static const MethodParameter* get_ports_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3363,7 +3388,7 @@
static const MethodParameter* get_object_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new UIntParameter("offset", false),
new UIntParameter("count", false),
NULL,
@@ -3425,7 +3450,7 @@
static const MethodParameter* get_class_list_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3439,7 +3464,7 @@
static const MethodParameter* get_type_arguments_list_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
NULL,
};
@@ -3648,7 +3673,7 @@
static const MethodParameter* set_library_debuggable_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("libraryId", true),
new BoolParameter("isDebuggable", true),
NULL,
@@ -3712,7 +3737,7 @@
static const MethodParameter* set_trace_class_allocation_params[] = {
- ISOLATE_PARAMETER,
+ RUNNABLE_ISOLATE_PARAMETER,
new IdParameter("classId", true),
new BoolParameter("enable", true),
NULL,
diff --git a/runtime/vm/service/service.md b/runtime/vm/service/service.md
index 6d2d894..9a719f1 100644
--- a/runtime/vm/service/service.md
+++ b/runtime/vm/service/service.md
@@ -177,6 +177,7 @@
102 | Cannot add breakpoint | The VM is unable to add a breakpoint at the specified line or function
103 | Stream already subscribed | The client is already subscribed to the specified _streamId_
104 | Stream not subscribed | The client is not subscribed to the specified _streamId_
+105 | Isolate must be runnable | This operation cannot happen until the isolate is runnable
diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc
index d55fe3b..dd2c004 100644
--- a/runtime/vm/service_test.cc
+++ b/runtime/vm/service_test.cc
@@ -167,6 +167,7 @@
"}";
Isolate* isolate = thread->isolate();
+ isolate->set_is_runnable(true);
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
EXPECT_VALID(lib);
Library& vmlib = Library::Handle();
@@ -273,7 +274,7 @@
"}";
Isolate* isolate = thread->isolate();
-
+ isolate->set_is_runnable(true);
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
EXPECT_VALID(lib);
Library& vmlib = Library::Handle();
@@ -332,6 +333,7 @@
"}";
Isolate* isolate = thread->isolate();
+ isolate->set_is_runnable(true);
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
EXPECT_VALID(lib);
Library& vmlib = Library::Handle();
@@ -393,6 +395,7 @@
"}";
Isolate* isolate = thread->isolate();
+ isolate->set_is_runnable(true);
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
EXPECT_VALID(lib);
Library& vmlib = Library::Handle();
@@ -443,6 +446,7 @@
"}";
Isolate* isolate = thread->isolate();
+ isolate->set_is_runnable(true);
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
EXPECT_VALID(lib);
@@ -603,6 +607,7 @@
"}";
Isolate* isolate = thread->isolate();
+ isolate->set_is_runnable(true);
Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
EXPECT_VALID(lib);
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
diff --git a/tools/VERSION b/tools/VERSION
index 39452fb..c65ef28 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -26,6 +26,6 @@
CHANNEL stable
MAJOR 1
MINOR 14
-PATCH 0
+PATCH 1
PRERELEASE 0
PRERELEASE_PATCH 0