| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 (*bp_resolved_handler)(bpt->id(), url, bpt->LineNumber()); | 126 (*bp_resolved_handler)(bpt->id(), url, bpt->LineNumber()); |
| 127 } else if (event->type == Debugger::kExceptionThrown) { | 127 } else if (event->type == Debugger::kExceptionThrown) { |
| 128 if (exc_thrown_handler == NULL) { | 128 if (exc_thrown_handler == NULL) { |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw()); | 131 Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw()); |
| 132 Dart_StackTrace trace = | 132 Dart_StackTrace trace = |
| 133 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); | 133 reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace()); |
| 134 (*exc_thrown_handler)(exception, trace); | 134 (*exc_thrown_handler)(exception, trace); |
| 135 } else if (event->type == Debugger::kIsolateCreated) { | 135 } else if (event->type == Debugger::kIsolateCreated) { |
| 136 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kCreated); | 136 if (isolate_event_handler != NULL) { |
| 137 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kCreated); |
| 138 } |
| 137 } else if (event->type == Debugger::kIsolateInterrupted) { | 139 } else if (event->type == Debugger::kIsolateInterrupted) { |
| 138 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kInterrupted); | 140 if (isolate_event_handler != NULL) { |
| 141 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kInterrupted); |
| 142 } |
| 139 } else if (event->type == Debugger::kIsolateShutdown) { | 143 } else if (event->type == Debugger::kIsolateShutdown) { |
| 140 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kShutdown); | 144 if (isolate_event_handler != NULL) { |
| 145 (*isolate_event_handler)(Api::CastIsolate(event->isolate), kShutdown); |
| 146 } |
| 141 } else { | 147 } else { |
| 142 UNIMPLEMENTED(); | 148 UNIMPLEMENTED(); |
| 143 } | 149 } |
| 144 } | 150 } |
| 145 | 151 |
| 146 | 152 |
| 147 DART_EXPORT void Dart_SetBreakpointResolvedHandler( | 153 DART_EXPORT void Dart_SetBreakpointResolvedHandler( |
| 148 Dart_BreakpointResolvedHandler handler) { | 154 Dart_BreakpointResolvedHandler handler) { |
| 149 bp_resolved_handler = handler; | 155 bp_resolved_handler = handler; |
| 150 Debugger::SetEventHandler(DebuggerEventHandler); | 156 Debugger::SetEventHandler(DebuggerEventHandler); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 if (lib.IsNull()) { | 704 if (lib.IsNull()) { |
| 699 return Api::NewError("%s: %"Pd" is not a valid library id", | 705 return Api::NewError("%s: %"Pd" is not a valid library id", |
| 700 CURRENT_FUNC, library_id); | 706 CURRENT_FUNC, library_id); |
| 701 } | 707 } |
| 702 lib.set_debuggable(is_debuggable); | 708 lib.set_debuggable(is_debuggable); |
| 703 return Api::True(isolate); | 709 return Api::True(isolate); |
| 704 } | 710 } |
| 705 | 711 |
| 706 | 712 |
| 707 } // namespace dart | 713 } // namespace dart |
| OLD | NEW |