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

Unified Diff: runtime/vm/service.cc

Issue 1418833004: VM: Service isolate under precompilation. (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 c659d7d5590baa32af10d31a1849f44b37c58534..7a77e9c7ba318520c84d2c7c4b7595cbf631fb3c 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1025,6 +1025,11 @@ static const MethodParameter* get_stack_params[] = {
static bool GetStack(Thread* thread, JSONStream* js) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot get stack when running a precompiled program.");
+ return true;
+ }
Isolate* isolate = thread->isolate();
DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
// Do we want the complete script object and complete local variable objects?
@@ -2051,6 +2056,11 @@ class FunctionCoverageFilter : public CoverageFilter {
static bool GetHitsOrSites(Thread* thread, JSONStream* js, bool as_sites) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot get coverage data when running a precompiled program.");
+ return true;
+ }
if (!js->HasParam("targetId")) {
CodeCoverage::PrintJSON(thread, js, NULL, as_sites);
return true;
@@ -2118,6 +2128,11 @@ static bool GetCallSiteData(Thread* thread, JSONStream* js) {
static bool AddBreakpointCommon(Thread* thread,
JSONStream* js,
const String& script_uri) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot use breakpoints when running a precompiled program.");
Chinmay 2015/10/28 23:20:48 Would be great if this suggested the user use GDB/
rmacnak 2015/10/28 23:55:41 <loki>You must be truly desperate to try to debug
+ return true;
+ }
const char* line_param = js->LookupParam("line");
intptr_t line = UIntParameter::Parse(line_param);
const char* col_param = js->LookupParam("column");
@@ -2155,6 +2170,11 @@ static const MethodParameter* add_breakpoint_params[] = {
static bool AddBreakpoint(Thread* thread, JSONStream* js) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot use breakpoints when running a precompiled program.");
+ return true;
+ }
const char* script_id_param = js->LookupParam("scriptId");
Object& obj = Object::Handle(LookupHeapObject(thread, script_id_param, NULL));
if (obj.raw() == Object::sentinel().raw() || !obj.IsScript()) {
@@ -2178,6 +2198,11 @@ static const MethodParameter* add_breakpoint_with_script_uri_params[] = {
static bool AddBreakpointWithScriptUri(Thread* thread, JSONStream* js) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot use breakpoints when running a precompiled program.");
+ return true;
+ }
const char* script_uri_param = js->LookupParam("scriptUri");
const String& script_uri = String::Handle(String::New(script_uri_param));
return AddBreakpointCommon(thread, js, script_uri);
@@ -2192,6 +2217,11 @@ static const MethodParameter* add_breakpoint_at_entry_params[] = {
static bool AddBreakpointAtEntry(Thread* thread, JSONStream* js) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot use breakpoints when running a precompiled program.");
+ return true;
+ }
const char* function_id = js->LookupParam("functionId");
Object& obj = Object::Handle(LookupHeapObject(thread, function_id, NULL));
if (obj.raw() == Object::sentinel().raw() || !obj.IsFunction()) {
@@ -2220,6 +2250,11 @@ static const MethodParameter* add_breakpoint_at_activation_params[] = {
static bool AddBreakpointAtActivation(Thread* thread, JSONStream* js) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot use breakpoints when running a precompiled program.");
+ return true;
+ }
const char* object_id = js->LookupParam("objectId");
Object& obj = Object::Handle(LookupHeapObject(thread, object_id, NULL));
if (obj.raw() == Object::sentinel().raw() || !obj.IsInstance()) {
@@ -2247,6 +2282,11 @@ static const MethodParameter* remove_breakpoint_params[] = {
static bool RemoveBreakpoint(Thread* thread, JSONStream* js) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot use breakpoints when running a precompiled program.");
+ return true;
+ }
if (!js->HasParam("breakpointId")) {
PrintMissingParamError(js, "breakpointId");
return true;
@@ -3251,6 +3291,11 @@ static const MethodParameter* set_trace_class_allocation_params[] = {
static bool SetTraceClassAllocation(Thread* thread, JSONStream* js) {
+ if (!thread->isolate()->compilation_allowed()) {
+ js->PrintError(kFeatureDisabled,
+ "Cannot trace allocation when running a precompiled program.");
+ return true;
+ }
const char* class_id = js->LookupParam("classId");
const bool enable = BoolParameter::Parse(js->LookupParam("enable"));
intptr_t cid = -1;

Powered by Google App Engine
This is Rietveld 408576698