Chromium Code Reviews| 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 "platform/address_sanitizer.h" | 9 #include "platform/address_sanitizer.h" |
| 10 | 10 |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1583 bpt->Disable(); | 1583 bpt->Disable(); |
| 1584 delete bpt; | 1584 delete bpt; |
| 1585 } | 1585 } |
| 1586 if (NeedsIsolateEvents()) { | 1586 if (NeedsIsolateEvents()) { |
| 1587 ServiceEvent event(isolate_, ServiceEvent::kIsolateExit); | 1587 ServiceEvent event(isolate_, ServiceEvent::kIsolateExit); |
| 1588 InvokeEventHandler(&event); | 1588 InvokeEventHandler(&event); |
| 1589 } | 1589 } |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 | 1592 |
| 1593 void Debugger::OnIsolateRunnable() { | |
|
rmacnak
2017/03/23 20:20:18
This patching of well-known functions is similar t
Cutch
2017/03/23 21:24:51
At the time these functions are called we haven't
| |
| 1594 if (!FLAG_async_debugger_stepping) { | |
| 1595 // We don't have async debugger stepping enabled. | |
| 1596 return; | |
| 1597 } | |
| 1598 Thread::EnterIsolate(isolate_); | |
| 1599 Thread* thread = Thread::Current(); | |
| 1600 ASSERT(thread != NULL); | |
| 1601 { | |
| 1602 StackZone zone(thread); | |
| 1603 HandleScope handle_scope(thread); | |
| 1604 | |
| 1605 const Library& async_lib = Library::Handle(Library::AsyncLibrary()); | |
| 1606 // Grab the _AsyncStarStreamController class. | |
| 1607 const Class& controller_class = | |
| 1608 Class::Handle(async_lib.LookupClassAllowPrivate( | |
| 1609 Symbols::_AsyncStarStreamController())); | |
| 1610 const Array& functions = Array::Handle(controller_class.functions()); | |
| 1611 Function& function = Function::Handle(); | |
| 1612 // Mark all functions as not debuggable or inlinable. | |
| 1613 for (intptr_t i = 0; i < functions.Length(); i++) { | |
| 1614 if (functions.At(i) == Function::null()) { | |
| 1615 break; | |
| 1616 } | |
| 1617 function ^= functions.At(i); | |
| 1618 function.set_is_debuggable(false); | |
| 1619 function.set_is_inlinable(false); | |
| 1620 } | |
| 1621 } | |
| 1622 Thread::ExitIsolate(); | |
| 1623 } | |
| 1624 | |
| 1625 | |
| 1593 static RawFunction* ResolveLibraryFunction(const Library& library, | 1626 static RawFunction* ResolveLibraryFunction(const Library& library, |
| 1594 const String& fname) { | 1627 const String& fname) { |
| 1595 ASSERT(!library.IsNull()); | 1628 ASSERT(!library.IsNull()); |
| 1596 const Object& object = Object::Handle(library.ResolveName(fname)); | 1629 const Object& object = Object::Handle(library.ResolveName(fname)); |
| 1597 if (!object.IsNull() && object.IsFunction()) { | 1630 if (!object.IsNull() && object.IsFunction()) { |
| 1598 return Function::Cast(object).raw(); | 1631 return Function::Cast(object).raw(); |
| 1599 } | 1632 } |
| 1600 return Function::null(); | 1633 return Function::null(); |
| 1601 } | 1634 } |
| 1602 | 1635 |
| (...skipping 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4095 return bpt; | 4128 return bpt; |
| 4096 } | 4129 } |
| 4097 bpt = bpt->next(); | 4130 bpt = bpt->next(); |
| 4098 } | 4131 } |
| 4099 loc = loc->next(); | 4132 loc = loc->next(); |
| 4100 } | 4133 } |
| 4101 return NULL; | 4134 return NULL; |
| 4102 } | 4135 } |
| 4103 | 4136 |
| 4104 | 4137 |
| 4138 void Debugger::MaybeAsyncStepInto(const Closure& async_op) { | |
| 4139 if (FLAG_async_debugger_stepping && IsSingleStepping()) { | |
| 4140 // We are single stepping, set a breakpoint on the closure activation | |
| 4141 // and resume execution so we can hit the breakpoint. | |
| 4142 SetBreakpointAtActivation(async_op, true); | |
| 4143 Continue(); | |
| 4144 } | |
| 4145 } | |
| 4146 | |
| 4147 | |
| 4148 void Debugger::Continue() { | |
| 4149 SetResumeAction(kContinue); | |
| 4150 stepping_fp_ = 0; | |
| 4151 isolate_->set_single_step(false); | |
| 4152 } | |
| 4153 | |
| 4154 | |
| 4105 BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url, | 4155 BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url, |
| 4106 intptr_t line, | 4156 intptr_t line, |
| 4107 intptr_t column) { | 4157 intptr_t column) { |
| 4108 BreakpointLocation* bpt = latent_locations_; | 4158 BreakpointLocation* bpt = latent_locations_; |
| 4109 String& bpt_url = String::Handle(); | 4159 String& bpt_url = String::Handle(); |
| 4110 while (bpt != NULL) { | 4160 while (bpt != NULL) { |
| 4111 bpt_url = bpt->url(); | 4161 bpt_url = bpt->url(); |
| 4112 if (bpt_url.Equals(url) && (bpt->requested_line_number() == line) && | 4162 if (bpt_url.Equals(url) && (bpt->requested_line_number() == line) && |
| 4113 (bpt->requested_column_number() == column)) { | 4163 (bpt->requested_column_number() == column)) { |
| 4114 return bpt; | 4164 return bpt; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 4132 | 4182 |
| 4133 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 4183 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 4134 ASSERT(bpt->next() == NULL); | 4184 ASSERT(bpt->next() == NULL); |
| 4135 bpt->set_next(code_breakpoints_); | 4185 bpt->set_next(code_breakpoints_); |
| 4136 code_breakpoints_ = bpt; | 4186 code_breakpoints_ = bpt; |
| 4137 } | 4187 } |
| 4138 | 4188 |
| 4139 #endif // !PRODUCT | 4189 #endif // !PRODUCT |
| 4140 | 4190 |
| 4141 } // namespace dart | 4191 } // namespace dart |
| OLD | NEW |