OLD | NEW |
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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 intptr_t len = | 703 intptr_t len = |
704 OS::SNPrint(NULL, 0, kFormat, func_name, url.ToCString(), line); | 704 OS::SNPrint(NULL, 0, kFormat, func_name, url.ToCString(), line); |
705 len++; // String terminator. | 705 len++; // String terminator. |
706 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 706 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
707 OS::SNPrint(chars, len, kFormat, func_name, url.ToCString(), line); | 707 OS::SNPrint(chars, len, kFormat, func_name, url.ToCString(), line); |
708 return chars; | 708 return chars; |
709 } | 709 } |
710 | 710 |
711 | 711 |
712 void ActivationFrame::PrintToJSONObject(JSONObject* jsobj) { | 712 void ActivationFrame::PrintToJSONObject(JSONObject* jsobj) { |
713 intptr_t line = LineNumber(); | |
714 const Script& script = Script::Handle(SourceScript()); | 713 const Script& script = Script::Handle(SourceScript()); |
715 | |
716 jsobj->AddProperty("script", script); | 714 jsobj->AddProperty("script", script); |
717 jsobj->AddProperty("line", line); | 715 jsobj->AddProperty("tokenPos", TokenPos()); |
718 jsobj->AddProperty("col", ColumnNumber()); | |
719 jsobj->AddProperty("function", function()); | 716 jsobj->AddProperty("function", function()); |
720 jsobj->AddProperty("code", code()); | 717 jsobj->AddProperty("code", code()); |
721 | |
722 // TODO(turnidge): Consider dropping lineString from the frame. | |
723 String& line_string = String::Handle(script.GetLine(line)); | |
724 jsobj->AddProperty("lineString", line_string.ToCString()); | |
725 { | 718 { |
726 JSONArray jsvars(jsobj, "vars"); | 719 JSONArray jsvars(jsobj, "vars"); |
727 const int num_vars = NumLocalVariables(); | 720 const int num_vars = NumLocalVariables(); |
728 for (intptr_t v = 0; v < num_vars; v++) { | 721 for (intptr_t v = 0; v < num_vars; v++) { |
729 JSONObject jsvar(&jsvars); | 722 JSONObject jsvar(&jsvars); |
730 String& var_name = String::Handle(); | 723 String& var_name = String::Handle(); |
731 Instance& var_value = Instance::Handle(); | 724 Instance& var_value = Instance::Handle(); |
732 intptr_t unused; | 725 intptr_t unused; |
733 VariableAt(v, &var_name, &unused, &unused, &var_value); | 726 VariableAt(v, &var_name, &unused, &unused, &var_value); |
734 jsvar.AddProperty("name", var_name.ToCString()); | 727 jsvar.AddProperty("name", var_name.ToCString()); |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 } | 2314 } |
2322 | 2315 |
2323 | 2316 |
2324 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2317 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
2325 ASSERT(bpt->next() == NULL); | 2318 ASSERT(bpt->next() == NULL); |
2326 bpt->set_next(code_breakpoints_); | 2319 bpt->set_next(code_breakpoints_); |
2327 code_breakpoints_ = bpt; | 2320 code_breakpoints_ = bpt; |
2328 } | 2321 } |
2329 | 2322 |
2330 } // namespace dart | 2323 } // namespace dart |
OLD | NEW |