| 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 "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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 if ((frame_index < 0) || (frame_index >= stack_trace->Length())) { | 93 if ((frame_index < 0) || (frame_index >= stack_trace->Length())) { |
| 94 return Api::NewError("argument 'frame_index' is out of range for %s", | 94 return Api::NewError("argument 'frame_index' is out of range for %s", |
| 95 CURRENT_FUNC); | 95 CURRENT_FUNC); |
| 96 } | 96 } |
| 97 *frame = reinterpret_cast<Dart_ActivationFrame>( | 97 *frame = reinterpret_cast<Dart_ActivationFrame>( |
| 98 stack_trace->ActivationFrameAt(frame_index)); | 98 stack_trace->ActivationFrameAt(frame_index)); |
| 99 return Api::True(isolate); | 99 return Api::True(isolate); |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 DART_EXPORT void Dart_SetBreakpointHandler( | 103 DART_EXPORT void Dart_SetBreakpointHandler(Dart_BreakpointHandler bp_handler) { |
| 104 Dart_BreakpointHandler bp_handler) { | |
| 105 BreakpointHandler* handler = | 104 BreakpointHandler* handler = |
| 106 reinterpret_cast<BreakpointHandler*>(bp_handler); | 105 reinterpret_cast<BreakpointHandler*>(bp_handler); |
| 107 Debugger::SetBreakpointHandler(handler); | 106 Debugger::SetBreakpointHandler(handler); |
| 108 } | 107 } |
| 109 | 108 |
| 110 | 109 |
| 111 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL; | 110 static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL; |
| 112 static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL; | 111 static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL; |
| 113 static Dart_IsolateEventHandler* isolate_event_handler = NULL; | 112 static Dart_IsolateEventHandler* isolate_event_handler = NULL; |
| 114 | 113 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 127 } else if (event->type == Debugger::kExceptionThrown) { | 126 } else if (event->type == Debugger::kExceptionThrown) { |
| 128 if (exc_thrown_handler == NULL) { | 127 if (exc_thrown_handler == NULL) { |
| 129 return; | 128 return; |
| 130 } | 129 } |
| 131 Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw()); | 130 Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw()); |
| 132 Dart_StackTrace trace = | 131 Dart_StackTrace trace = |
| 133 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); | 132 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); |
| 134 (*exc_thrown_handler)(exception, trace); | 133 (*exc_thrown_handler)(exception, trace); |
| 135 } else if (event->type == Debugger::kIsolateCreated) { | 134 } else if (event->type == Debugger::kIsolateCreated) { |
| 136 if (isolate_event_handler != NULL) { | 135 if (isolate_event_handler != NULL) { |
| 137 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kCreated); | 136 (*isolate_event_handler)(event->isolate_id, kCreated); |
| 138 } | 137 } |
| 139 } else if (event->type == Debugger::kIsolateInterrupted) { | 138 } else if (event->type == Debugger::kIsolateInterrupted) { |
| 140 if (isolate_event_handler != NULL) { | 139 if (isolate_event_handler != NULL) { |
| 141 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kInterrupted); | 140 (*isolate_event_handler)(event->isolate_id, kInterrupted); |
| 142 } | 141 } |
| 143 } else if (event->type == Debugger::kIsolateShutdown) { | 142 } else if (event->type == Debugger::kIsolateShutdown) { |
| 144 if (isolate_event_handler != NULL) { | 143 if (isolate_event_handler != NULL) { |
| 145 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kShutdown); | 144 (*isolate_event_handler)(event->isolate_id, kShutdown); |
| 146 } | 145 } |
| 147 } else { | 146 } else { |
| 148 UNIMPLEMENTED(); | 147 UNIMPLEMENTED(); |
| 149 } | 148 } |
| 150 } | 149 } |
| 151 | 150 |
| 152 | 151 |
| 153 DART_EXPORT void Dart_SetBreakpointResolvedHandler( | 152 DART_EXPORT void Dart_SetBreakpointResolvedHandler( |
| 154 Dart_BreakpointResolvedHandler handler) { | 153 Dart_BreakpointResolvedHandler handler) { |
| 155 bp_resolved_handler = handler; | 154 bp_resolved_handler = handler; |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 702 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
| 704 if (lib.IsNull()) { | 703 if (lib.IsNull()) { |
| 705 return Api::NewError("%s: %"Pd" is not a valid library id", | 704 return Api::NewError("%s: %"Pd" is not a valid library id", |
| 706 CURRENT_FUNC, library_id); | 705 CURRENT_FUNC, library_id); |
| 707 } | 706 } |
| 708 lib.set_debuggable(is_debuggable); | 707 lib.set_debuggable(is_debuggable); |
| 709 return Api::True(isolate); | 708 return Api::True(isolate); |
| 710 } | 709 } |
| 711 | 710 |
| 712 | 711 |
| 712 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { |
| 713 Isolate* isolate = PortMap::GetIsolate(isolate_id); |
| 714 return Api::CastIsolate(isolate); |
| 715 } |
| 716 |
| 713 } // namespace dart | 717 } // namespace dart |
| OLD | NEW |