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

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

Issue 1150303004: Switch to using SourceLocation universally in service protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: post merge Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 jsobj.AddProperty("type", "Breakpoint"); 192 jsobj.AddProperty("type", "Breakpoint");
193 193
194 jsobj.AddFixedServiceId("breakpoints/%" Pd "", id()); 194 jsobj.AddFixedServiceId("breakpoints/%" Pd "", id());
195 jsobj.AddProperty("breakpointNumber", id()); 195 jsobj.AddProperty("breakpointNumber", id());
196 jsobj.AddProperty("resolved", bpt_location_->IsResolved()); 196 jsobj.AddProperty("resolved", bpt_location_->IsResolved());
197 197
198 Library& library = Library::Handle(isolate); 198 Library& library = Library::Handle(isolate);
199 Script& script = Script::Handle(isolate); 199 Script& script = Script::Handle(isolate);
200 intptr_t token_pos; 200 intptr_t token_pos;
201 bpt_location_->GetCodeLocation(&library, &script, &token_pos); 201 bpt_location_->GetCodeLocation(&library, &script, &token_pos);
202 { 202 jsobj.AddLocation(script, token_pos);
203 JSONObject location(&jsobj, "location");
204 location.AddProperty("type", "Location");
205 location.AddProperty("script", script);
206 location.AddProperty("tokenPos", token_pos);
207 }
208 } 203 }
209 204
210 205
211 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { 206 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) {
212 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); 207 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_));
213 } 208 }
214 209
215 210
216 ActivationFrame::ActivationFrame( 211 ActivationFrame::ActivationFrame(
217 uword pc, 212 uword pc,
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 line, 992 line,
998 ctx_.ToCString(), 993 ctx_.ToCString(),
999 ContextLevel()); 994 ContextLevel());
1000 } 995 }
1001 996
1002 997
1003 void ActivationFrame::PrintToJSONObject(JSONObject* jsobj, 998 void ActivationFrame::PrintToJSONObject(JSONObject* jsobj,
1004 bool full) { 999 bool full) {
1005 const Script& script = Script::Handle(SourceScript()); 1000 const Script& script = Script::Handle(SourceScript());
1006 jsobj->AddProperty("type", "Frame"); 1001 jsobj->AddProperty("type", "Frame");
1007 jsobj->AddProperty("script", script, !full); 1002 jsobj->AddLocation(script, TokenPos());
1008 jsobj->AddProperty("tokenPos", TokenPos());
1009 jsobj->AddProperty("function", function(), !full); 1003 jsobj->AddProperty("function", function(), !full);
1010 jsobj->AddProperty("code", code()); 1004 jsobj->AddProperty("code", code());
1005 if (full) {
1006 // TODO(cutch): The old "full" script usage no longer fits
1007 // in the world where we pass the script as part of the
1008 // location.
1009 jsobj->AddProperty("script", script, !full);
1010 }
1011 { 1011 {
1012 JSONArray jsvars(jsobj, "vars"); 1012 JSONArray jsvars(jsobj, "vars");
1013 const int num_vars = NumLocalVariables(); 1013 const int num_vars = NumLocalVariables();
1014 for (intptr_t v = 0; v < num_vars; v++) { 1014 for (intptr_t v = 0; v < num_vars; v++) {
1015 JSONObject jsvar(&jsvars); 1015 JSONObject jsvar(&jsvars);
1016 String& var_name = String::Handle(); 1016 String& var_name = String::Handle();
1017 Instance& var_value = Instance::Handle(); 1017 Instance& var_value = Instance::Handle();
1018 intptr_t token_pos; 1018 intptr_t token_pos;
1019 intptr_t end_token_pos; 1019 intptr_t end_token_pos;
1020 VariableAt(v, &var_name, &token_pos, &end_token_pos, &var_value); 1020 VariableAt(v, &var_name, &token_pos, &end_token_pos, &var_value);
1021 jsvar.AddProperty("name", var_name.ToCString()); 1021 jsvar.AddProperty("name", var_name.ToCString());
1022 jsvar.AddProperty("value", var_value, !full); 1022 jsvar.AddProperty("value", var_value, !full);
1023 jsvar.AddProperty("tokenPos", token_pos); 1023 // TODO(turnidge): Do we really want to provide this on every
1024 jsvar.AddProperty("endTokenPos", end_token_pos); 1024 // stack dump? Should be associated with the function object, I
1025 // think, and not the stack frame.
1026 jsvar.AddProperty("_tokenPos", token_pos);
1027 jsvar.AddProperty("_endTokenPos", end_token_pos);
1025 } 1028 }
1026 } 1029 }
1027 } 1030 }
1028 1031
1029 1032
1030 1033
1031 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) { 1034 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) {
1032 if (FLAG_show_invisible_frames || frame->function().is_visible()) { 1035 if (FLAG_show_invisible_frames || frame->function().is_visible()) {
1033 trace_.Add(frame); 1036 trace_.Add(frame);
1034 } 1037 }
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
2925 } 2928 }
2926 2929
2927 2930
2928 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2931 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2929 ASSERT(bpt->next() == NULL); 2932 ASSERT(bpt->next() == NULL);
2930 bpt->set_next(code_breakpoints_); 2933 bpt->set_next(code_breakpoints_);
2931 code_breakpoints_ = bpt; 2934 code_breakpoints_ = bpt;
2932 } 2935 }
2933 2936
2934 } // namespace dart 2937 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/steal_breakpoint_test.dart ('k') | runtime/vm/debugger_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698