Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: runtime/vm/debugger.cc

Issue 1541073002: Implement safepointing of threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-review-comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // Give the event to the Service first, as the debugger event handler 298 // Give the event to the Service first, as the debugger event handler
299 // may go into a message loop and the Service will not. 299 // may go into a message loop and the Service will not.
300 // 300 //
301 // kBreakpointResolved events are handled differently in the vm 301 // kBreakpointResolved events are handled differently in the vm
302 // service, so suppress them here. 302 // service, so suppress them here.
303 if (ServiceNeedsDebuggerEvent(event->type())) { 303 if (ServiceNeedsDebuggerEvent(event->type())) {
304 ServiceEvent service_event(event); 304 ServiceEvent service_event(event);
305 Service::HandleEvent(&service_event); 305 Service::HandleEvent(&service_event);
306 } 306 }
307 307
308 if ((FLAG_steal_breakpoints || (event_handler_ == NULL)) && 308 {
309 event->IsPauseEvent()) { 309 TransitionVMToNative transition(Thread::Current());
310 // We allow the embedder's default breakpoint handler to be overridden. 310 if ((FLAG_steal_breakpoints || (event_handler_ == NULL)) &&
311 isolate_->PauseEventHandler(); 311 event->IsPauseEvent()) {
312 } else if (event_handler_ != NULL) { 312 // We allow the embedder's default breakpoint handler to be overridden.
313 (*event_handler_)(event); 313 isolate_->PauseEventHandler();
314 } else if (event_handler_ != NULL) {
315 (*event_handler_)(event);
316 }
314 } 317 }
315 318
316 if (ServiceNeedsDebuggerEvent(event->type()) && event->IsPauseEvent()) { 319 if (ServiceNeedsDebuggerEvent(event->type()) && event->IsPauseEvent()) {
317 // If we were paused, notify the service that we have resumed. 320 // If we were paused, notify the service that we have resumed.
318 const Error& error = 321 const Error& error =
319 Error::Handle(isolate_->object_store()->sticky_error()); 322 Error::Handle(isolate_->object_store()->sticky_error());
320 ASSERT(error.IsNull() || error.IsUnwindError()); 323 ASSERT(error.IsNull() || error.IsUnwindError());
321 324
322 // Only send a resume event when the isolate is not unwinding. 325 // Only send a resume event when the isolate is not unwinding.
323 if (!error.IsUnwindError()) { 326 if (!error.IsUnwindError()) {
(...skipping 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 } 3246 }
3244 3247
3245 3248
3246 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 3249 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
3247 ASSERT(bpt->next() == NULL); 3250 ASSERT(bpt->next() == NULL);
3248 bpt->set_next(code_breakpoints_); 3251 bpt->set_next(code_breakpoints_);
3249 code_breakpoints_ = bpt; 3252 code_breakpoints_ = bpt;
3250 } 3253 }
3251 3254
3252 } // namespace dart 3255 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698