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

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

Issue 11028040: - Add support to interrupt a running isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 109
110 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL; 110 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL;
111 static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL; 111 static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL;
112 static Dart_IsolateEventHandler* isolate_event_handler = NULL; 112 static Dart_IsolateEventHandler* isolate_event_handler = NULL;
113 113
114 114
115 static void DebuggerEventHandler(Debugger::DebuggerEvent* event) { 115 static void DebuggerEventHandler(Debugger::DebuggerEvent* event) {
116 Isolate* isolate = Isolate::Current(); 116 Isolate* isolate = Isolate::Current();
117 ASSERT(isolate != NULL); 117 ASSERT(isolate != NULL);
118 ASSERT(isolate->debugger() != NULL);
119 Dart_IsolateId isolate_id = isolate->debugger()->GetIsolateId();
118 if (event->type == Debugger::kBreakpointResolved) { 120 if (event->type == Debugger::kBreakpointResolved) {
119 if (bp_resolved_handler == NULL) { 121 if (bp_resolved_handler == NULL) {
120 return; 122 return;
121 } 123 }
122 SourceBreakpoint* bpt = event->breakpoint; 124 SourceBreakpoint* bpt = event->breakpoint;
123 ASSERT(bpt != NULL); 125 ASSERT(bpt != NULL);
124 Dart_Handle url = Api::NewHandle(isolate, bpt->SourceUrl()); 126 Dart_Handle url = Api::NewHandle(isolate, bpt->SourceUrl());
125 (*bp_resolved_handler)(bpt->id(), url, bpt->LineNumber()); 127 (*bp_resolved_handler)(isolate_id, bpt->id(), url, bpt->LineNumber());
126 } else if (event->type == Debugger::kExceptionThrown) { 128 } else if (event->type == Debugger::kExceptionThrown) {
127 if (exc_thrown_handler == NULL) { 129 if (exc_thrown_handler == NULL) {
128 return; 130 return;
129 } 131 }
130 Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw()); 132 Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw());
131 Dart_StackTrace trace = 133 Dart_StackTrace trace =
132 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); 134 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace());
133 (*exc_thrown_handler)(exception, trace); 135 (*exc_thrown_handler)(isolate_id, exception, trace);
134 } else if (event->type == Debugger::kIsolateCreated) { 136 } else if (event->type == Debugger::kIsolateCreated) {
135 if (isolate_event_handler != NULL) { 137 if (isolate_event_handler != NULL) {
136 (*isolate_event_handler)(event->isolate_id, kCreated); 138 (*isolate_event_handler)(event->isolate_id, kCreated);
137 } 139 }
138 } else if (event->type == Debugger::kIsolateInterrupted) { 140 } else if (event->type == Debugger::kIsolateInterrupted) {
139 if (isolate_event_handler != NULL) { 141 if (isolate_event_handler != NULL) {
140 (*isolate_event_handler)(event->isolate_id, kInterrupted); 142 (*isolate_event_handler)(event->isolate_id, kInterrupted);
141 } 143 }
142 } else if (event->type == Debugger::kIsolateShutdown) { 144 } else if (event->type == Debugger::kIsolateShutdown) {
143 if (isolate_event_handler != NULL) { 145 if (isolate_event_handler != NULL) {
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 return Api::True(isolate); 710 return Api::True(isolate);
709 } 711 }
710 712
711 713
712 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { 714 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) {
713 Isolate* isolate = PortMap::GetIsolate(isolate_id); 715 Isolate* isolate = PortMap::GetIsolate(isolate_id);
714 return Api::CastIsolate(isolate); 716 return Api::CastIsolate(isolate);
715 } 717 }
716 718
717 } // namespace dart 719 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698