| 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 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 RawObject* RemoteObjectCache::GetObj(intptr_t obj_id) const { | 1244 RawObject* RemoteObjectCache::GetObj(intptr_t obj_id) const { |
| 1245 ASSERT(IsValidId(obj_id)); | 1245 ASSERT(IsValidId(obj_id)); |
| 1246 return objs_->At(obj_id); | 1246 return objs_->At(obj_id); |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 | 1249 |
| 1250 Debugger::Debugger() | 1250 Debugger::Debugger() |
| 1251 : isolate_(NULL), | 1251 : isolate_(NULL), |
| 1252 isolate_id_(ILLEGAL_ISOLATE_ID), | 1252 isolate_id_(ILLEGAL_ISOLATE_ID), |
| 1253 initialized_(false), | 1253 initialized_(false), |
| 1254 creation_message_sent_(false), |
| 1254 next_id_(1), | 1255 next_id_(1), |
| 1255 latent_locations_(NULL), | 1256 latent_locations_(NULL), |
| 1256 breakpoint_locations_(NULL), | 1257 breakpoint_locations_(NULL), |
| 1257 code_breakpoints_(NULL), | 1258 code_breakpoints_(NULL), |
| 1258 resume_action_(kContinue), | 1259 resume_action_(kContinue), |
| 1259 ignore_breakpoints_(false), | 1260 ignore_breakpoints_(false), |
| 1260 pause_event_(NULL), | 1261 pause_event_(NULL), |
| 1261 obj_cache_(NULL), | 1262 obj_cache_(NULL), |
| 1262 stack_trace_(NULL), | 1263 stack_trace_(NULL), |
| 1263 stepping_fp_(0), | 1264 stepping_fp_(0), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1292 BreakpointLocation* bpt = latent_locations_; | 1293 BreakpointLocation* bpt = latent_locations_; |
| 1293 latent_locations_ = latent_locations_->next(); | 1294 latent_locations_ = latent_locations_->next(); |
| 1294 delete bpt; | 1295 delete bpt; |
| 1295 } | 1296 } |
| 1296 while (code_breakpoints_ != NULL) { | 1297 while (code_breakpoints_ != NULL) { |
| 1297 CodeBreakpoint* bpt = code_breakpoints_; | 1298 CodeBreakpoint* bpt = code_breakpoints_; |
| 1298 code_breakpoints_ = code_breakpoints_->next(); | 1299 code_breakpoints_ = code_breakpoints_->next(); |
| 1299 bpt->Disable(); | 1300 bpt->Disable(); |
| 1300 delete bpt; | 1301 delete bpt; |
| 1301 } | 1302 } |
| 1302 // Signal isolate shutdown event. | 1303 // Signal isolate shutdown event, but only if we previously sent the creation |
| 1303 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown); | 1304 // event. |
| 1305 if (creation_message_sent_) { |
| 1306 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown); |
| 1307 } |
| 1304 } | 1308 } |
| 1305 | 1309 |
| 1306 | 1310 |
| 1307 static RawFunction* ResolveLibraryFunction( | 1311 static RawFunction* ResolveLibraryFunction( |
| 1308 const Library& library, | 1312 const Library& library, |
| 1309 const String& fname) { | 1313 const String& fname) { |
| 1310 ASSERT(!library.IsNull()); | 1314 ASSERT(!library.IsNull()); |
| 1311 const Object& object = Object::Handle(library.ResolveName(fname)); | 1315 const Object& object = Object::Handle(library.ResolveName(fname)); |
| 1312 if (!object.IsNull() && object.IsFunction()) { | 1316 if (!object.IsNull() && object.IsFunction()) { |
| 1313 return Function::Cast(object).raw(); | 1317 return Function::Cast(object).raw(); |
| (...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2802 // Use the isolate's control port as the isolate_id for debugging. | 2806 // Use the isolate's control port as the isolate_id for debugging. |
| 2803 // This port will be used as a unique ID to represent the isolate in the | 2807 // This port will be used as a unique ID to represent the isolate in the |
| 2804 // debugger wire protocol messages. | 2808 // debugger wire protocol messages. |
| 2805 isolate_id_ = isolate_->main_port(); | 2809 isolate_id_ = isolate_->main_port(); |
| 2806 initialized_ = true; | 2810 initialized_ = true; |
| 2807 } | 2811 } |
| 2808 | 2812 |
| 2809 | 2813 |
| 2810 void Debugger::NotifyIsolateCreated() { | 2814 void Debugger::NotifyIsolateCreated() { |
| 2811 // Signal isolate creation event. | 2815 // Signal isolate creation event. |
| 2812 if (!ServiceIsolate::IsServiceIsolateDescendant(isolate_)) { | 2816 if ((isolate_ != Dart::vm_isolate()) && |
| 2817 !ServiceIsolate::IsServiceIsolateDescendant(isolate_)) { |
| 2813 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); | 2818 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); |
| 2819 creation_message_sent_ = true; |
| 2814 } | 2820 } |
| 2815 } | 2821 } |
| 2816 | 2822 |
| 2817 | 2823 |
| 2818 // Return innermost closure contained in 'function' that contains | 2824 // Return innermost closure contained in 'function' that contains |
| 2819 // the given token position. | 2825 // the given token position. |
| 2820 RawFunction* Debugger::FindInnermostClosure(const Function& function, | 2826 RawFunction* Debugger::FindInnermostClosure(const Function& function, |
| 2821 intptr_t token_pos) { | 2827 intptr_t token_pos) { |
| 2822 const Class& owner = Class::Handle(function.Owner()); | 2828 const Class& owner = Class::Handle(function.Owner()); |
| 2823 if (owner.closures() == GrowableObjectArray::null()) { | 2829 if (owner.closures() == GrowableObjectArray::null()) { |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3250 } | 3256 } |
| 3251 | 3257 |
| 3252 | 3258 |
| 3253 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3259 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 3254 ASSERT(bpt->next() == NULL); | 3260 ASSERT(bpt->next() == NULL); |
| 3255 bpt->set_next(code_breakpoints_); | 3261 bpt->set_next(code_breakpoints_); |
| 3256 code_breakpoints_ = bpt; | 3262 code_breakpoints_ = bpt; |
| 3257 } | 3263 } |
| 3258 | 3264 |
| 3259 } // namespace dart | 3265 } // namespace dart |
| OLD | NEW |