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

Side by Side Diff: runtime/vm/service.cc

Issue 2521413002: Revert "Implement rewind: drop one or more frames from the debugger." (Closed)
Patch Set: Created 4 years 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 | « runtime/vm/runtime_entry_list.h ('k') | runtime/vm/simulator_dbc.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 2970 matching lines...) Expand 10 before | Expand all | Expand 10 after
2981 int64_t time_origin_micros = 2981 int64_t time_origin_micros =
2982 Int64Parameter::Parse(js->LookupParam("timeOriginMicros")); 2982 Int64Parameter::Parse(js->LookupParam("timeOriginMicros"));
2983 int64_t time_extent_micros = 2983 int64_t time_extent_micros =
2984 Int64Parameter::Parse(js->LookupParam("timeExtentMicros")); 2984 Int64Parameter::Parse(js->LookupParam("timeExtentMicros"));
2985 TimelineEventFilter filter(time_origin_micros, time_extent_micros); 2985 TimelineEventFilter filter(time_origin_micros, time_extent_micros);
2986 timeline_recorder->PrintJSON(js, &filter); 2986 timeline_recorder->PrintJSON(js, &filter);
2987 return true; 2987 return true;
2988 } 2988 }
2989 2989
2990 2990
2991 static const char* const step_enum_names[] = {
2992 "None", "Into", "Over", "Out", "Rewind", "OverAsyncSuspension", NULL,
2993 };
2994
2995
2996 static const Debugger::ResumeAction step_enum_values[] = {
2997 Debugger::kContinue, Debugger::kStepInto,
2998 Debugger::kStepOver, Debugger::kStepOut,
2999 Debugger::kStepRewind, Debugger::kStepOverAsyncSuspension,
3000 Debugger::kContinue, // Default value
3001 };
3002
3003
3004 static const MethodParameter* resume_params[] = { 2991 static const MethodParameter* resume_params[] = {
3005 RUNNABLE_ISOLATE_PARAMETER, 2992 RUNNABLE_ISOLATE_PARAMETER, NULL,
3006 new EnumParameter("step", false, step_enum_names),
3007 new UIntParameter("frameIndex", false), NULL,
3008 }; 2993 };
3009 2994
3010 2995
3011 static bool Resume(Thread* thread, JSONStream* js) { 2996 static bool Resume(Thread* thread, JSONStream* js) {
3012 const char* step_param = js->LookupParam("step"); 2997 const char* step_param = js->LookupParam("step");
3013 Debugger::ResumeAction step = Debugger::kContinue;
3014 if (step_param != NULL) {
3015 step = EnumMapper(step_param, step_enum_names, step_enum_values);
3016 }
3017 #if defined(TARGET_ARCH_DBC)
3018 if (step == Debugger::kStepRewind) {
3019 js->PrintError(kCannotResume,
3020 "Rewind not yet implemented on this architecture");
3021 return true;
3022 }
3023 #endif
3024 intptr_t frame_index = 1;
3025 const char* frame_index_param = js->LookupParam("frameIndex");
3026 if (frame_index_param != NULL) {
3027 if (step != Debugger::kStepRewind) {
3028 // Only rewind supports the frameIndex parameter.
3029 js->PrintError(
3030 kInvalidParams,
3031 "%s: the 'frameIndex' parameter can only be used when rewinding",
3032 js->method());
3033 return true;
3034 }
3035 frame_index = UIntParameter::Parse(js->LookupParam("frameIndex"));
3036 }
3037 Isolate* isolate = thread->isolate(); 2998 Isolate* isolate = thread->isolate();
3038 if (isolate->message_handler()->is_paused_on_start()) { 2999 if (isolate->message_handler()->is_paused_on_start()) {
3039 // If the user is issuing a 'Over' or an 'Out' step, that is the 3000 // If the user is issuing a 'Over' or an 'Out' step, that is the
3040 // same as a regular resume request. 3001 // same as a regular resume request.
3041 if (step == Debugger::kStepInto) { 3002 if ((step_param != NULL) && (strcmp(step_param, "Into") == 0)) {
3042 isolate->debugger()->EnterSingleStepMode(); 3003 isolate->debugger()->EnterSingleStepMode();
3043 } 3004 }
3044 isolate->message_handler()->set_should_pause_on_start(false); 3005 isolate->message_handler()->set_should_pause_on_start(false);
3045 isolate->SetResumeRequest(); 3006 isolate->SetResumeRequest();
3046 if (Service::debug_stream.enabled()) { 3007 if (Service::debug_stream.enabled()) {
3047 ServiceEvent event(isolate, ServiceEvent::kResume); 3008 ServiceEvent event(isolate, ServiceEvent::kResume);
3048 Service::HandleEvent(&event); 3009 Service::HandleEvent(&event);
3049 } 3010 }
3050 PrintSuccess(js); 3011 PrintSuccess(js);
3051 return true; 3012 return true;
3052 } 3013 }
3053 if (isolate->message_handler()->should_pause_on_start()) { 3014 if (isolate->message_handler()->should_pause_on_start()) {
3054 isolate->message_handler()->set_should_pause_on_start(false); 3015 isolate->message_handler()->set_should_pause_on_start(false);
3055 isolate->SetResumeRequest(); 3016 isolate->SetResumeRequest();
3056 if (Service::debug_stream.enabled()) { 3017 if (Service::debug_stream.enabled()) {
3057 ServiceEvent event(isolate, ServiceEvent::kResume); 3018 ServiceEvent event(isolate, ServiceEvent::kResume);
3058 Service::HandleEvent(&event); 3019 Service::HandleEvent(&event);
3059 } 3020 }
3060 PrintSuccess(js); 3021 PrintSuccess(js);
3061 return true; 3022 return true;
3062 } 3023 }
3063 if (isolate->message_handler()->is_paused_on_exit()) { 3024 if (isolate->message_handler()->is_paused_on_exit()) {
3064 isolate->message_handler()->set_should_pause_on_exit(false); 3025 isolate->message_handler()->set_should_pause_on_exit(false);
3065 isolate->SetResumeRequest(); 3026 isolate->SetResumeRequest();
3066 // We don't send a resume event because we will be exiting. 3027 // We don't send a resume event because we will be exiting.
3067 PrintSuccess(js); 3028 PrintSuccess(js);
3068 return true; 3029 return true;
3069 } 3030 }
3070 if (isolate->debugger()->PauseEvent() == NULL) { 3031 if (isolate->debugger()->PauseEvent() != NULL) {
3071 js->PrintError(kIsolateMustBePaused, NULL); 3032 if (step_param != NULL) {
3033 if (strcmp(step_param, "Into") == 0) {
3034 isolate->debugger()->SetSingleStep();
3035 } else if (strcmp(step_param, "Over") == 0) {
3036 isolate->debugger()->SetStepOver();
3037 } else if (strcmp(step_param, "Out") == 0) {
3038 isolate->debugger()->SetStepOut();
3039 } else if (strcmp(step_param, "OverAsyncSuspension") == 0) {
3040 if (!isolate->debugger()->SetupStepOverAsyncSuspension()) {
3041 js->PrintError(kInvalidParams,
3042 "Isolate must be paused at an async suspension point");
3043 return true;
3044 }
3045 } else {
3046 PrintInvalidParamError(js, "step");
3047 return true;
3048 }
3049 }
3050 isolate->SetResumeRequest();
3051 PrintSuccess(js);
3072 return true; 3052 return true;
3073 } 3053 }
3074 3054
3075 const char* error = NULL; 3055 js->PrintError(kIsolateMustBePaused, NULL);
3076 if (!isolate->debugger()->SetResumeAction(step, frame_index, &error)) {
3077 js->PrintError(kCannotResume, error);
3078 return true;
3079 }
3080 isolate->SetResumeRequest();
3081 PrintSuccess(js);
3082 return true; 3056 return true;
3083 } 3057 }
3084 3058
3085 3059
3086 static const MethodParameter* pause_params[] = { 3060 static const MethodParameter* pause_params[] = {
3087 RUNNABLE_ISOLATE_PARAMETER, NULL, 3061 RUNNABLE_ISOLATE_PARAMETER, NULL,
3088 }; 3062 };
3089 3063
3090 3064
3091 static bool Pause(Thread* thread, JSONStream* js) { 3065 static bool Pause(Thread* thread, JSONStream* js) {
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
4107 if (strcmp(method_name, method.name) == 0) { 4081 if (strcmp(method_name, method.name) == 0) {
4108 return &method; 4082 return &method;
4109 } 4083 }
4110 } 4084 }
4111 return NULL; 4085 return NULL;
4112 } 4086 }
4113 4087
4114 #endif // !PRODUCT 4088 #endif // !PRODUCT
4115 4089
4116 } // namespace dart 4090 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/runtime_entry_list.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698