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" |
11 #include "vm/compiler.h" | 11 #include "vm/compiler.h" |
12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
13 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
14 #include "vm/flags.h" | 14 #include "vm/flags.h" |
15 #include "vm/globals.h" | 15 #include "vm/globals.h" |
16 #include "vm/longjump.h" | 16 #include "vm/longjump.h" |
17 #include "vm/json_stream.h" | 17 #include "vm/json_stream.h" |
18 #include "vm/object.h" | 18 #include "vm/object.h" |
19 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
20 #include "vm/os.h" | 20 #include "vm/os.h" |
21 #include "vm/port.h" | 21 #include "vm/port.h" |
| 22 #include "vm/service_isolate.h" |
22 #include "vm/service.h" | 23 #include "vm/service.h" |
23 #include "vm/stack_frame.h" | 24 #include "vm/stack_frame.h" |
24 #include "vm/stub_code.h" | 25 #include "vm/stub_code.h" |
25 #include "vm/symbols.h" | 26 #include "vm/symbols.h" |
26 #include "vm/visitor.h" | 27 #include "vm/visitor.h" |
27 | 28 |
28 | 29 |
29 namespace dart { | 30 namespace dart { |
30 | 31 |
31 DEFINE_FLAG(bool, show_invisible_frames, false, | 32 DEFINE_FLAG(bool, show_invisible_frames, false, |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 latent_breakpoints_ = latent_breakpoints_->next(); | 1063 latent_breakpoints_ = latent_breakpoints_->next(); |
1063 delete bpt; | 1064 delete bpt; |
1064 } | 1065 } |
1065 while (code_breakpoints_ != NULL) { | 1066 while (code_breakpoints_ != NULL) { |
1066 CodeBreakpoint* bpt = code_breakpoints_; | 1067 CodeBreakpoint* bpt = code_breakpoints_; |
1067 code_breakpoints_ = code_breakpoints_->next(); | 1068 code_breakpoints_ = code_breakpoints_->next(); |
1068 bpt->Disable(); | 1069 bpt->Disable(); |
1069 delete bpt; | 1070 delete bpt; |
1070 } | 1071 } |
1071 // Signal isolate shutdown event. | 1072 // Signal isolate shutdown event. |
1072 if (!Service::IsServiceIsolate(isolate_)) { | 1073 if (!ServiceIsolate::IsServiceIsolate(isolate_)) { |
1073 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown); | 1074 SignalIsolateEvent(DebuggerEvent::kIsolateShutdown); |
1074 } | 1075 } |
1075 } | 1076 } |
1076 | 1077 |
1077 | 1078 |
1078 static RawFunction* ResolveLibraryFunction( | 1079 static RawFunction* ResolveLibraryFunction( |
1079 const Library& library, | 1080 const Library& library, |
1080 const String& fname) { | 1081 const String& fname) { |
1081 ASSERT(!library.IsNull()); | 1082 ASSERT(!library.IsNull()); |
1082 const Object& object = Object::Handle(library.ResolveName(fname)); | 1083 const Object& object = Object::Handle(library.ResolveName(fname)); |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 } | 2125 } |
2125 } | 2126 } |
2126 } | 2127 } |
2127 | 2128 |
2128 | 2129 |
2129 // static | 2130 // static |
2130 bool Debugger::IsDebuggable(const Function& func) { | 2131 bool Debugger::IsDebuggable(const Function& func) { |
2131 if (!func.is_debuggable()) { | 2132 if (!func.is_debuggable()) { |
2132 return false; | 2133 return false; |
2133 } | 2134 } |
2134 if (Service::IsRunning()) { | 2135 if (ServiceIsolate::IsRunning()) { |
2135 return true; | 2136 return true; |
2136 } | 2137 } |
2137 const Class& cls = Class::Handle(func.Owner()); | 2138 const Class& cls = Class::Handle(func.Owner()); |
2138 const Library& lib = Library::Handle(cls.library()); | 2139 const Library& lib = Library::Handle(cls.library()); |
2139 return lib.IsDebuggable(); | 2140 return lib.IsDebuggable(); |
2140 } | 2141 } |
2141 | 2142 |
2142 | 2143 |
2143 void Debugger::SignalPausedEvent(ActivationFrame* top_frame, | 2144 void Debugger::SignalPausedEvent(ActivationFrame* top_frame, |
2144 SourceBreakpoint* bpt) { | 2145 SourceBreakpoint* bpt) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 // Use the isolate's control port as the isolate_id for debugging. | 2263 // Use the isolate's control port as the isolate_id for debugging. |
2263 // This port will be used as a unique ID to represent the isolate in the | 2264 // This port will be used as a unique ID to represent the isolate in the |
2264 // debugger wire protocol messages. | 2265 // debugger wire protocol messages. |
2265 isolate_id_ = isolate->main_port(); | 2266 isolate_id_ = isolate->main_port(); |
2266 initialized_ = true; | 2267 initialized_ = true; |
2267 } | 2268 } |
2268 | 2269 |
2269 | 2270 |
2270 void Debugger::NotifyIsolateCreated() { | 2271 void Debugger::NotifyIsolateCreated() { |
2271 // Signal isolate creation event. | 2272 // Signal isolate creation event. |
2272 if (!Service::IsServiceIsolate(isolate_)) { | 2273 if (!ServiceIsolate::IsServiceIsolate(isolate_)) { |
2273 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); | 2274 SignalIsolateEvent(DebuggerEvent::kIsolateCreated); |
2274 } | 2275 } |
2275 } | 2276 } |
2276 | 2277 |
2277 | 2278 |
2278 // Return innermost closure contained in 'function' that contains | 2279 // Return innermost closure contained in 'function' that contains |
2279 // the given token position. | 2280 // the given token position. |
2280 RawFunction* Debugger::FindInnermostClosure(const Function& function, | 2281 RawFunction* Debugger::FindInnermostClosure(const Function& function, |
2281 intptr_t token_pos) { | 2282 intptr_t token_pos) { |
2282 const Class& owner = Class::Handle(isolate_, function.Owner()); | 2283 const Class& owner = Class::Handle(isolate_, function.Owner()); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 } | 2644 } |
2644 | 2645 |
2645 | 2646 |
2646 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2647 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
2647 ASSERT(bpt->next() == NULL); | 2648 ASSERT(bpt->next() == NULL); |
2648 bpt->set_next(code_breakpoints_); | 2649 bpt->set_next(code_breakpoints_); |
2649 code_breakpoints_ = bpt; | 2650 code_breakpoints_ = bpt; |
2650 } | 2651 } |
2651 | 2652 |
2652 } // namespace dart | 2653 } // namespace dart |
OLD | NEW |