OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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" |
11 #include "vm/longjump.h" | |
12 | 11 |
13 namespace dart { | 12 namespace dart { |
14 | 13 |
15 #define UNWRAP_AND_CHECK_PARAM(type, var, param) \ | 14 #define UNWRAP_AND_CHECK_PARAM(type, var, param) \ |
16 do { \ | 15 do { \ |
17 const Object& tmp = Object::Handle(Api::UnwrapHandle(param)); \ | 16 const Object& tmp = Object::Handle(Api::UnwrapHandle(param)); \ |
18 if (tmp.IsNull()) { \ | 17 if (tmp.IsNull()) { \ |
19 return Api::NewError("%s expects argument '%s' to be non-null.", \ | 18 return Api::NewError("%s expects argument '%s' to be non-null.", \ |
20 CURRENT_FUNC, #param); \ | 19 CURRENT_FUNC, #param); \ |
21 } else if (tmp.IsApiError()) { \ | 20 } else if (tmp.IsApiError()) { \ |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 debugger->ResolveFunction(library, class_name, function_name)); | 133 debugger->ResolveFunction(library, class_name, function_name)); |
135 if (bp_target.IsNull()) { | 134 if (bp_target.IsNull()) { |
136 const bool toplevel = class_name.Length() == 0; | 135 const bool toplevel = class_name.Length() == 0; |
137 return Api::NewError("%s: could not find function '%s%s%s'", | 136 return Api::NewError("%s: could not find function '%s%s%s'", |
138 CURRENT_FUNC, | 137 CURRENT_FUNC, |
139 toplevel ? "" : class_name.ToCString(), | 138 toplevel ? "" : class_name.ToCString(), |
140 toplevel ? "" : ".", | 139 toplevel ? "" : ".", |
141 function_name.ToCString()); | 140 function_name.ToCString()); |
142 } | 141 } |
143 | 142 |
144 LongJump* base = isolate->long_jump_base(); | |
145 LongJump jump; | |
146 isolate->set_long_jump_base(&jump); | |
147 Dart_Handle result = Api::True(); | 143 Dart_Handle result = Api::True(); |
148 *breakpoint = NULL; | 144 *breakpoint = NULL; |
149 if (setjmp(*jump.Set()) == 0) { | 145 |
150 Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target); | 146 Error& error = Error::Handle(); |
151 if (bpt == NULL) { | 147 Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target, &error); |
152 const char* target_name = Debugger::QualifiedFunctionName(bp_target); | 148 if (!error.IsNull()) { |
153 result = Api::NewError("%s: no breakpoint location found in '%s'", | 149 return Api::NewLocalHandle(error); |
| 150 } |
| 151 if (bpt == NULL) { |
| 152 const char* target_name = Debugger::QualifiedFunctionName(bp_target); |
| 153 result = Api::NewError("%s: no breakpoint location found in '%s'", |
154 CURRENT_FUNC, target_name); | 154 CURRENT_FUNC, target_name); |
155 } else { | |
156 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); | |
157 } | |
158 } else { | 155 } else { |
159 SetupErrorResult(&result); | 156 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); |
160 } | 157 } |
161 isolate->set_long_jump_base(base); | |
162 return result; | 158 return result; |
163 } | 159 } |
164 | 160 |
165 | 161 |
166 } // namespace dart | 162 } // namespace dart |
OLD | NEW |