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