Index: runtime/vm/debugger_api_impl.cc |
=================================================================== |
--- runtime/vm/debugger_api_impl.cc (revision 3821) |
+++ runtime/vm/debugger_api_impl.cc (working copy) |
@@ -8,6 +8,7 @@ |
#include "vm/dart_api_state.h" |
#include "vm/debugger.h" |
#include "vm/isolate.h" |
+#include "vm/longjump.h" |
#include "vm/object_store.h" |
namespace dart { |
@@ -140,23 +141,25 @@ |
return Api::NewError(msg); |
} |
+ LongJump* base = isolate->long_jump_base(); |
+ LongJump jump; |
+ isolate->set_long_jump_base(&jump); |
Dart_Handle result = Api::True(); |
*breakpoint = NULL; |
Debugger* debugger = isolate->debugger(); |
ASSERT(debugger != NULL); |
- Error& error = Error::Handle(); |
- Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line, &error); |
- if (bpt == NULL) { |
- if (!error.IsNull()) { |
- // If SetBreakpointAtLine provided an error message, use it. |
- result = Api::NewLocalHandle(error); |
- } else { |
+ if (setjmp(*jump.Set()) == 0) { |
+ Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line); |
+ if (bpt == NULL) { |
result = Api::NewError("%s: could not set breakpoint at line %d of '%s'", |
CURRENT_FUNC, line, script_url.ToCString()); |
+ } else { |
+ *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); |
} |
} else { |
- *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); |
+ SetupErrorResult(&result); |
} |
+ isolate->set_long_jump_base(base); |
return result; |
} |
@@ -195,21 +198,24 @@ |
function_name.ToCString()); |
} |
+ LongJump* base = isolate->long_jump_base(); |
+ LongJump jump; |
+ isolate->set_long_jump_base(&jump); |
Dart_Handle result = Api::True(); |
*breakpoint = NULL; |
- |
- Error& error = Error::Handle(); |
- Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target, &error); |
- if (!error.IsNull()) { |
- return Api::NewLocalHandle(error); |
- } |
- if (bpt == NULL) { |
- const char* target_name = Debugger::QualifiedFunctionName(bp_target); |
- result = Api::NewError("%s: no breakpoint location found in '%s'", |
+ if (setjmp(*jump.Set()) == 0) { |
+ Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target); |
+ if (bpt == NULL) { |
+ const char* target_name = Debugger::QualifiedFunctionName(bp_target); |
+ result = Api::NewError("%s: no breakpoint location found in '%s'", |
CURRENT_FUNC, target_name); |
+ } else { |
+ *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); |
+ } |
} else { |
- *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); |
+ SetupErrorResult(&result); |
} |
+ isolate->set_long_jump_base(base); |
return result; |
} |