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 "platform/address_sanitizer.h" | 9 #include "platform/address_sanitizer.h" |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages"); | 51 DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages"); |
52 DEFINE_FLAG(bool, | 52 DEFINE_FLAG(bool, |
53 steal_breakpoints, | 53 steal_breakpoints, |
54 false, | 54 false, |
55 "Intercept breakpoints and other pause events before they " | 55 "Intercept breakpoints and other pause events before they " |
56 "are sent to the embedder and use a generic VM breakpoint " | 56 "are sent to the embedder and use a generic VM breakpoint " |
57 "handler instead. This handler dispatches breakpoints to " | 57 "handler instead. This handler dispatches breakpoints to " |
58 "the VM service."); | 58 "the VM service."); |
59 | 59 |
60 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); | 60 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); |
61 DECLARE_FLAG(bool, use_dart_frontend); | |
62 | 61 |
63 #ifndef PRODUCT | 62 #ifndef PRODUCT |
64 | 63 |
65 Debugger::EventHandler* Debugger::event_handler_ = NULL; | 64 Debugger::EventHandler* Debugger::event_handler_ = NULL; |
66 | 65 |
67 class RemoteObjectCache : public ZoneAllocated { | 66 class RemoteObjectCache : public ZoneAllocated { |
68 public: | 67 public: |
69 explicit RemoteObjectCache(intptr_t initial_size); | 68 explicit RemoteObjectCache(intptr_t initial_size); |
70 intptr_t AddObject(const Object& obj); | 69 intptr_t AddObject(const Object& obj); |
71 RawObject* GetObj(intptr_t obj_id) const; | 70 RawObject* GetObj(intptr_t obj_id) const; |
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 } | 2569 } |
2571 | 2570 |
2572 // Returns true if a best fit is found. A best fit can either be a function | 2571 // Returns true if a best fit is found. A best fit can either be a function |
2573 // or a field. If it is a function, then the best fit function is returned | 2572 // or a field. If it is a function, then the best fit function is returned |
2574 // in |best_fit|. If a best fit is a field, it means that a latent | 2573 // in |best_fit|. If a best fit is a field, it means that a latent |
2575 // breakpoint can be set in the range |token_pos| to |last_token_pos|. | 2574 // breakpoint can be set in the range |token_pos| to |last_token_pos|. |
2576 bool Debugger::FindBestFit(const Script& script, | 2575 bool Debugger::FindBestFit(const Script& script, |
2577 TokenPosition token_pos, | 2576 TokenPosition token_pos, |
2578 TokenPosition last_token_pos, | 2577 TokenPosition last_token_pos, |
2579 Function* best_fit) { | 2578 Function* best_fit) { |
2580 Zone* zone = Thread::Current()->zone(); | 2579 Thread* thread = Thread::Current(); |
| 2580 Zone* zone = thread->zone(); |
2581 Class& cls = Class::Handle(zone); | 2581 Class& cls = Class::Handle(zone); |
2582 Library& lib = Library::Handle(zone, script.FindLibrary()); | 2582 Library& lib = Library::Handle(zone, script.FindLibrary()); |
2583 ASSERT(!lib.IsNull()); | 2583 ASSERT(!lib.IsNull()); |
2584 const GrowableObjectArray& closures = GrowableObjectArray::Handle( | 2584 const GrowableObjectArray& closures = GrowableObjectArray::Handle( |
2585 zone, isolate_->object_store()->closure_functions()); | 2585 zone, isolate_->object_store()->closure_functions()); |
2586 Array& functions = Array::Handle(zone); | 2586 Array& functions = Array::Handle(zone); |
2587 Function& function = Function::Handle(zone); | 2587 Function& function = Function::Handle(zone); |
2588 Array& fields = Array::Handle(zone); | 2588 Array& fields = Array::Handle(zone); |
2589 Field& field = Field::Handle(zone); | 2589 Field& field = Field::Handle(zone); |
2590 Error& error = Error::Handle(zone); | 2590 Error& error = Error::Handle(zone); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2663 // The field should be defined in the script we want to set | 2663 // The field should be defined in the script we want to set |
2664 // the breakpoint in. | 2664 // the breakpoint in. |
2665 continue; | 2665 continue; |
2666 } | 2666 } |
2667 if (!field.has_initializer()) { | 2667 if (!field.has_initializer()) { |
2668 continue; | 2668 continue; |
2669 } | 2669 } |
2670 | 2670 |
2671 bool has_func_literal_initializer = false; | 2671 bool has_func_literal_initializer = false; |
2672 #ifndef DART_PRECOMPILED_RUNTIME | 2672 #ifndef DART_PRECOMPILED_RUNTIME |
2673 if (FLAG_use_dart_frontend) { | 2673 if (isolate_->use_dart_frontend()) { |
2674 has_func_literal_initializer = | 2674 has_func_literal_initializer = |
2675 kernel::KernelReader::FieldHasFunctionLiteralInitializer( | 2675 kernel::KernelReader::FieldHasFunctionLiteralInitializer( |
2676 field, &start, &end); | 2676 field, &start, &end); |
2677 } else { | 2677 } else { |
2678 #endif // !DART_PRECOMPILED_RUNTIME | 2678 #endif // !DART_PRECOMPILED_RUNTIME |
2679 has_func_literal_initializer = | 2679 has_func_literal_initializer = |
2680 Parser::FieldHasFunctionLiteralInitializer(field, &start, &end); | 2680 Parser::FieldHasFunctionLiteralInitializer(field, &start, &end); |
2681 #ifndef DART_PRECOMPILED_RUNTIME | 2681 #ifndef DART_PRECOMPILED_RUNTIME |
2682 } | 2682 } |
2683 #endif // !DART_PRECOMPILED_RUNTIME | 2683 #endif // !DART_PRECOMPILED_RUNTIME |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4360 | 4360 |
4361 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 4361 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
4362 ASSERT(bpt->next() == NULL); | 4362 ASSERT(bpt->next() == NULL); |
4363 bpt->set_next(code_breakpoints_); | 4363 bpt->set_next(code_breakpoints_); |
4364 code_breakpoints_ = bpt; | 4364 code_breakpoints_ = bpt; |
4365 } | 4365 } |
4366 | 4366 |
4367 #endif // !PRODUCT | 4367 #endif // !PRODUCT |
4368 | 4368 |
4369 } // namespace dart | 4369 } // namespace dart |
OLD | NEW |