| OLD | NEW |
| 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 | 6 |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
| 10 #include "vm/message.h" | 10 #include "vm/message.h" |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 location.AddProperty("tokenPos", token_pos); | 728 location.AddProperty("tokenPos", token_pos); |
| 729 if (end_token_pos >= 0) { | 729 if (end_token_pos >= 0) { |
| 730 location.AddProperty("endTokenPos", end_token_pos); | 730 location.AddProperty("endTokenPos", end_token_pos); |
| 731 } | 731 } |
| 732 } | 732 } |
| 733 | 733 |
| 734 | 734 |
| 735 void JSONObject::AddLocation(const BreakpointLocation* bpt_loc) const { | 735 void JSONObject::AddLocation(const BreakpointLocation* bpt_loc) const { |
| 736 ASSERT(bpt_loc->IsResolved()); | 736 ASSERT(bpt_loc->IsResolved()); |
| 737 | 737 |
| 738 Isolate* isolate = Isolate::Current(); | 738 Zone* zone = Thread::Current()->zone(); |
| 739 Library& library = Library::Handle(isolate); | 739 Library& library = Library::Handle(zone); |
| 740 Script& script = Script::Handle(isolate); | 740 Script& script = Script::Handle(zone); |
| 741 intptr_t token_pos; | 741 intptr_t token_pos; |
| 742 bpt_loc->GetCodeLocation(&library, &script, &token_pos); | 742 bpt_loc->GetCodeLocation(&library, &script, &token_pos); |
| 743 AddLocation(script, token_pos); | 743 AddLocation(script, token_pos); |
| 744 } | 744 } |
| 745 | 745 |
| 746 | 746 |
| 747 void JSONObject::AddUnresolvedLocation( | 747 void JSONObject::AddUnresolvedLocation( |
| 748 const BreakpointLocation* bpt_loc) const { | 748 const BreakpointLocation* bpt_loc) const { |
| 749 ASSERT(!bpt_loc->IsResolved()); | 749 ASSERT(!bpt_loc->IsResolved()); |
| 750 | 750 |
| 751 Isolate* isolate = Isolate::Current(); | 751 Zone* zone = Thread::Current()->zone(); |
| 752 Library& library = Library::Handle(isolate); | 752 Library& library = Library::Handle(zone); |
| 753 Script& script = Script::Handle(isolate); | 753 Script& script = Script::Handle(zone); |
| 754 intptr_t token_pos; | 754 intptr_t token_pos; |
| 755 bpt_loc->GetCodeLocation(&library, &script, &token_pos); | 755 bpt_loc->GetCodeLocation(&library, &script, &token_pos); |
| 756 | 756 |
| 757 JSONObject location(this, "location"); | 757 JSONObject location(this, "location"); |
| 758 location.AddProperty("type", "UnresolvedSourceLocation"); | 758 location.AddProperty("type", "UnresolvedSourceLocation"); |
| 759 if (!script.IsNull()) { | 759 if (!script.IsNull()) { |
| 760 location.AddProperty("script", script); | 760 location.AddProperty("script", script); |
| 761 } else { | 761 } else { |
| 762 const String& scriptUri = String::Handle(isolate, bpt_loc->url()); | 762 const String& scriptUri = String::Handle(zone, bpt_loc->url()); |
| 763 location.AddPropertyStr("scriptUri", scriptUri); | 763 location.AddPropertyStr("scriptUri", scriptUri); |
| 764 } | 764 } |
| 765 if (bpt_loc->requested_line_number() >= 0) { | 765 if (bpt_loc->requested_line_number() >= 0) { |
| 766 // This unresolved breakpoint was specified at a particular line. | 766 // This unresolved breakpoint was specified at a particular line. |
| 767 location.AddProperty("line", bpt_loc->requested_line_number()); | 767 location.AddProperty("line", bpt_loc->requested_line_number()); |
| 768 if (bpt_loc->requested_column_number() >= 0) { | 768 if (bpt_loc->requested_column_number() >= 0) { |
| 769 location.AddProperty("column", | 769 location.AddProperty("column", |
| 770 bpt_loc->requested_column_number()); | 770 bpt_loc->requested_column_number()); |
| 771 } | 771 } |
| 772 } else { | 772 } else { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 806 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
| 807 va_end(args); | 807 va_end(args); |
| 808 ASSERT(len == len2); | 808 ASSERT(len == len2); |
| 809 stream_->buffer_.AddChar('"'); | 809 stream_->buffer_.AddChar('"'); |
| 810 stream_->AddEscapedUTF8String(p); | 810 stream_->AddEscapedUTF8String(p); |
| 811 stream_->buffer_.AddChar('"'); | 811 stream_->buffer_.AddChar('"'); |
| 812 free(p); | 812 free(p); |
| 813 } | 813 } |
| 814 | 814 |
| 815 } // namespace dart | 815 } // namespace dart |
| OLD | NEW |