| 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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 latent_breakpoints_ = latent_breakpoints_->next(); | 1058 latent_breakpoints_ = latent_breakpoints_->next(); |
| 1059 delete bpt; | 1059 delete bpt; |
| 1060 } | 1060 } |
| 1061 while (code_breakpoints_ != NULL) { | 1061 while (code_breakpoints_ != NULL) { |
| 1062 CodeBreakpoint* bpt = code_breakpoints_; | 1062 CodeBreakpoint* bpt = code_breakpoints_; |
| 1063 code_breakpoints_ = code_breakpoints_->next(); | 1063 code_breakpoints_ = code_breakpoints_->next(); |
| 1064 bpt->Disable(); | 1064 bpt->Disable(); |
| 1065 delete bpt; | 1065 delete bpt; |
| 1066 } | 1066 } |
| 1067 // Signal isolate shutdown event. | 1067 // Signal isolate shutdown event. |
| 1068 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown); | 1068 if (!Service::IsServiceIsolate(isolate_)) { |
| 1069 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown); |
| 1070 } |
| 1069 } | 1071 } |
| 1070 | 1072 |
| 1071 | 1073 |
| 1072 static RawFunction* ResolveLibraryFunction( | 1074 static RawFunction* ResolveLibraryFunction( |
| 1073 const Library& library, | 1075 const Library& library, |
| 1074 const String& fname) { | 1076 const String& fname) { |
| 1075 ASSERT(!library.IsNull()); | 1077 ASSERT(!library.IsNull()); |
| 1076 const Object& object = Object::Handle(library.ResolveName(fname)); | 1078 const Object& object = Object::Handle(library.ResolveName(fname)); |
| 1077 if (!object.IsNull() && object.IsFunction()) { | 1079 if (!object.IsNull() && object.IsFunction()) { |
| 1078 return Function::Cast(object).raw(); | 1080 return Function::Cast(object).raw(); |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 RemoveInternalBreakpoints(); | 2247 RemoveInternalBreakpoints(); |
| 2246 } | 2248 } |
| 2247 } | 2249 } |
| 2248 | 2250 |
| 2249 | 2251 |
| 2250 void Debugger::Initialize(Isolate* isolate) { | 2252 void Debugger::Initialize(Isolate* isolate) { |
| 2251 if (initialized_) { | 2253 if (initialized_) { |
| 2252 return; | 2254 return; |
| 2253 } | 2255 } |
| 2254 isolate_ = isolate; | 2256 isolate_ = isolate; |
| 2257 |
| 2255 // Use the isolate's control port as the isolate_id for debugging. | 2258 // Use the isolate's control port as the isolate_id for debugging. |
| 2256 // This port will be used as a unique ID to represet the isolate in the | 2259 // This port will be used as a unique ID to represent the isolate in the |
| 2257 // debugger wire protocol messages. | 2260 // debugger wire protocol messages. |
| 2258 isolate_id_ = isolate->main_port(); | 2261 isolate_id_ = isolate->main_port(); |
| 2259 initialized_ = true; | 2262 initialized_ = true; |
| 2260 } | 2263 } |
| 2261 | 2264 |
| 2262 | 2265 |
| 2263 void Debugger::NotifyIsolateCreated() { | 2266 void Debugger::NotifyIsolateCreated() { |
| 2264 // Signal isolate creation event. | 2267 // Signal isolate creation event. |
| 2265 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); | 2268 if (!Service::IsServiceIsolate(isolate_)) { |
| 2269 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); |
| 2270 } |
| 2266 } | 2271 } |
| 2267 | 2272 |
| 2268 | 2273 |
| 2269 // Return innermost closure contained in 'function' that contains | 2274 // Return innermost closure contained in 'function' that contains |
| 2270 // the given token position. | 2275 // the given token position. |
| 2271 RawFunction* Debugger::FindInnermostClosure(const Function& function, | 2276 RawFunction* Debugger::FindInnermostClosure(const Function& function, |
| 2272 intptr_t token_pos) { | 2277 intptr_t token_pos) { |
| 2273 const Class& owner = Class::Handle(isolate_, function.Owner()); | 2278 const Class& owner = Class::Handle(isolate_, function.Owner()); |
| 2274 if (owner.closures() == GrowableObjectArray::null()) { | 2279 if (owner.closures() == GrowableObjectArray::null()) { |
| 2275 return Function::null(); | 2280 return Function::null(); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2622 } | 2627 } |
| 2623 | 2628 |
| 2624 | 2629 |
| 2625 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2630 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 2626 ASSERT(bpt->next() == NULL); | 2631 ASSERT(bpt->next() == NULL); |
| 2627 bpt->set_next(code_breakpoints_); | 2632 bpt->set_next(code_breakpoints_); |
| 2628 code_breakpoints_ = bpt; | 2633 code_breakpoints_ = bpt; |
| 2629 } | 2634 } |
| 2630 | 2635 |
| 2631 } // namespace dart | 2636 } // namespace dart |
| OLD | NEW |