| 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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 | 1229 |
| 1230 RawObject* RemoteObjectCache::GetObj(intptr_t obj_id) const { | 1230 RawObject* RemoteObjectCache::GetObj(intptr_t obj_id) const { |
| 1231 ASSERT(IsValidId(obj_id)); | 1231 ASSERT(IsValidId(obj_id)); |
| 1232 return objs_->At(obj_id); | 1232 return objs_->At(obj_id); |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 | 1235 |
| 1236 Debugger::Debugger() | 1236 Debugger::Debugger() |
| 1237 : isolate_(NULL), | 1237 : thread_(NULL), |
| 1238 isolate_(NULL), |
| 1238 isolate_id_(ILLEGAL_ISOLATE_ID), | 1239 isolate_id_(ILLEGAL_ISOLATE_ID), |
| 1239 initialized_(false), | 1240 initialized_(false), |
| 1240 next_id_(1), | 1241 next_id_(1), |
| 1241 latent_locations_(NULL), | 1242 latent_locations_(NULL), |
| 1242 breakpoint_locations_(NULL), | 1243 breakpoint_locations_(NULL), |
| 1243 code_breakpoints_(NULL), | 1244 code_breakpoints_(NULL), |
| 1244 resume_action_(kContinue), | 1245 resume_action_(kContinue), |
| 1245 ignore_breakpoints_(false), | 1246 ignore_breakpoints_(false), |
| 1246 pause_event_(NULL), | 1247 pause_event_(NULL), |
| 1247 obj_cache_(NULL), | 1248 obj_cache_(NULL), |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1949 // Note: if this class has been parsed and finalized already, | 1950 // Note: if this class has been parsed and finalized already, |
| 1950 // we need to check the functions of this class even if | 1951 // we need to check the functions of this class even if |
| 1951 // it is defined in a differenct 'script'. There could | 1952 // it is defined in a differenct 'script'. There could |
| 1952 // be mixin functions from the given script in this class. | 1953 // be mixin functions from the given script in this class. |
| 1953 // However, if this class is not parsed yet (not finalized), | 1954 // However, if this class is not parsed yet (not finalized), |
| 1954 // we can ignore it and avoid the side effect of parsing it. | 1955 // we can ignore it and avoid the side effect of parsing it. |
| 1955 if ((cls.script() != script.raw()) && !cls.is_finalized()) { | 1956 if ((cls.script() != script.raw()) && !cls.is_finalized()) { |
| 1956 continue; | 1957 continue; |
| 1957 } | 1958 } |
| 1958 // Parse class definition if not done yet. | 1959 // Parse class definition if not done yet. |
| 1959 error = cls.EnsureIsFinalized(isolate_); | 1960 error = cls.EnsureIsFinalized(thread_); |
| 1960 if (!error.IsNull()) { | 1961 if (!error.IsNull()) { |
| 1961 // Ignore functions in this class. | 1962 // Ignore functions in this class. |
| 1962 // TODO(hausner): Should we propagate this error? How? | 1963 // TODO(hausner): Should we propagate this error? How? |
| 1963 // EnsureIsFinalized only returns an error object if there | 1964 // EnsureIsFinalized only returns an error object if there |
| 1964 // is no longjump base on the stack. | 1965 // is no longjump base on the stack. |
| 1965 continue; | 1966 continue; |
| 1966 } | 1967 } |
| 1967 functions = cls.functions(); | 1968 functions = cls.functions(); |
| 1968 if (!functions.IsNull()) { | 1969 if (!functions.IsNull()) { |
| 1969 const intptr_t num_functions = functions.Length(); | 1970 const intptr_t num_functions = functions.Length(); |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 // We are in the native call to Debugger_breakHere or Debugger_breakHereIf, | 2761 // We are in the native call to Debugger_breakHere or Debugger_breakHereIf, |
| 2761 // the developer gets a better experience by not seeing this call. To | 2762 // the developer gets a better experience by not seeing this call. To |
| 2762 // accomplish this, we continue execution until the call exits (step out). | 2763 // accomplish this, we continue execution until the call exits (step out). |
| 2763 SetStepOut(); | 2764 SetStepOut(); |
| 2764 HandleSteppingRequest(stack_trace_); | 2765 HandleSteppingRequest(stack_trace_); |
| 2765 | 2766 |
| 2766 stack_trace_ = NULL; | 2767 stack_trace_ = NULL; |
| 2767 } | 2768 } |
| 2768 | 2769 |
| 2769 | 2770 |
| 2770 void Debugger::Initialize(Isolate* isolate) { | 2771 void Debugger::Initialize(Thread* thread) { |
| 2771 if (initialized_) { | 2772 if (initialized_) { |
| 2772 return; | 2773 return; |
| 2773 } | 2774 } |
| 2774 isolate_ = isolate; | 2775 thread_ = thread; |
| 2776 isolate_ = thread->isolate(); |
| 2775 | 2777 |
| 2776 // Use the isolate's control port as the isolate_id for debugging. | 2778 // Use the isolate's control port as the isolate_id for debugging. |
| 2777 // This port will be used as a unique ID to represent the isolate in the | 2779 // This port will be used as a unique ID to represent the isolate in the |
| 2778 // debugger wire protocol messages. | 2780 // debugger wire protocol messages. |
| 2779 isolate_id_ = isolate->main_port(); | 2781 isolate_id_ = isolate_->main_port(); |
| 2780 initialized_ = true; | 2782 initialized_ = true; |
| 2781 } | 2783 } |
| 2782 | 2784 |
| 2783 | 2785 |
| 2784 void Debugger::NotifyIsolateCreated() { | 2786 void Debugger::NotifyIsolateCreated() { |
| 2785 // Signal isolate creation event. | 2787 // Signal isolate creation event. |
| 2786 if (!ServiceIsolate::IsServiceIsolateDescendant(isolate_)) { | 2788 if (!ServiceIsolate::IsServiceIsolateDescendant(isolate_)) { |
| 2787 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); | 2789 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); |
| 2788 } | 2790 } |
| 2789 } | 2791 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3221 } | 3223 } |
| 3222 | 3224 |
| 3223 | 3225 |
| 3224 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3226 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 3225 ASSERT(bpt->next() == NULL); | 3227 ASSERT(bpt->next() == NULL); |
| 3226 bpt->set_next(code_breakpoints_); | 3228 bpt->set_next(code_breakpoints_); |
| 3227 code_breakpoints_ = bpt; | 3229 code_breakpoints_ = bpt; |
| 3228 } | 3230 } |
| 3229 | 3231 |
| 3230 } // namespace dart | 3232 } // namespace dart |
| OLD | NEW |