| Index: runtime/vm/debugger_api_impl.cc
|
| ===================================================================
|
| --- runtime/vm/debugger_api_impl.cc (revision 8456)
|
| +++ runtime/vm/debugger_api_impl.cc (working copy)
|
| @@ -106,6 +106,7 @@
|
|
|
|
|
| static Dart_BreakpointResolvedHandler* bp_resolved_handler = NULL;
|
| +static Dart_ExceptionThrownHandler* exc_thrown_handler = NULL;
|
|
|
| static void DebuggerEventHandler(Debugger::DebuggerEvent* event) {
|
| Isolate* isolate = Isolate::Current();
|
| @@ -118,6 +119,14 @@
|
| ASSERT(bpt != NULL);
|
| Dart_Handle url = Api::NewHandle(isolate, bpt->SourceUrl());
|
| (*bp_resolved_handler)(bpt->id(), url, bpt->LineNumber());
|
| + } else if (event->type == Debugger::kExceptionThrown) {
|
| + if (exc_thrown_handler == NULL) {
|
| + return;
|
| + }
|
| + Dart_Handle exception = Api::NewHandle(isolate, event->exception->raw());
|
| + Dart_StackTrace trace =
|
| + reinterpret_cast<Dart_StackTrace>(isolate->debugger()->StackTrace());
|
| + (*exc_thrown_handler)(exception, trace);
|
| } else {
|
| UNIMPLEMENTED();
|
| }
|
| @@ -133,6 +142,15 @@
|
| }
|
|
|
|
|
| +DART_EXPORT void Dart_SetExceptionThrownHandler(
|
| + Dart_ExceptionThrownHandler handler) {
|
| + exc_thrown_handler = handler;
|
| + Isolate* isolate = Isolate::Current();
|
| + DARTSCOPE(isolate);
|
| + isolate->debugger()->SetEventHandler(DebuggerEventHandler);
|
| +}
|
| +
|
| +
|
| DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
|
|