Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: runtime/vm/debugger_api_impl.cc

Issue 9314053: Revert Dart_PropagateError until I can track down the problems in (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/exceptions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "vm/object_store.h" 12 #include "vm/object_store.h"
12 13
13 namespace dart { 14 namespace dart {
14 15
15 #define UNWRAP_AND_CHECK_PARAM(type, var, param) \ 16 #define UNWRAP_AND_CHECK_PARAM(type, var, param) \
16 do { \ 17 do { \
17 const Object& tmp = Object::Handle(Api::UnwrapHandle(param)); \ 18 const Object& tmp = Object::Handle(Api::UnwrapHandle(param)); \
18 if (tmp.IsNull()) { \ 19 if (tmp.IsNull()) { \
19 return Api::NewError("%s expects argument '%s' to be non-null.", \ 20 return Api::NewError("%s expects argument '%s' to be non-null.", \
20 CURRENT_FUNC, #param); \ 21 CURRENT_FUNC, #param); \
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (!line_number.IsSmi()) { 134 if (!line_number.IsSmi()) {
134 return Api::NewError("%s: line number out of range", CURRENT_FUNC); 135 return Api::NewError("%s: line number out of range", CURRENT_FUNC);
135 } 136 }
136 intptr_t line = line_number.AsInt64Value(); 137 intptr_t line = line_number.AsInt64Value();
137 138
138 const char* msg = CheckIsolateState(isolate); 139 const char* msg = CheckIsolateState(isolate);
139 if (msg != NULL) { 140 if (msg != NULL) {
140 return Api::NewError(msg); 141 return Api::NewError(msg);
141 } 142 }
142 143
144 LongJump* base = isolate->long_jump_base();
145 LongJump jump;
146 isolate->set_long_jump_base(&jump);
143 Dart_Handle result = Api::True(); 147 Dart_Handle result = Api::True();
144 *breakpoint = NULL; 148 *breakpoint = NULL;
145 Debugger* debugger = isolate->debugger(); 149 Debugger* debugger = isolate->debugger();
146 ASSERT(debugger != NULL); 150 ASSERT(debugger != NULL);
147 Error& error = Error::Handle(); 151 if (setjmp(*jump.Set()) == 0) {
148 Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line, &error); 152 Breakpoint* bpt = debugger->SetBreakpointAtLine(script_url, line);
149 if (bpt == NULL) { 153 if (bpt == NULL) {
150 if (!error.IsNull()) {
151 // If SetBreakpointAtLine provided an error message, use it.
152 result = Api::NewLocalHandle(error);
153 } else {
154 result = Api::NewError("%s: could not set breakpoint at line %d of '%s'", 154 result = Api::NewError("%s: could not set breakpoint at line %d of '%s'",
155 CURRENT_FUNC, line, script_url.ToCString()); 155 CURRENT_FUNC, line, script_url.ToCString());
156 } else {
157 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt);
156 } 158 }
157 } else { 159 } else {
158 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); 160 SetupErrorResult(&result);
159 } 161 }
162 isolate->set_long_jump_base(base);
160 return result; 163 return result;
161 } 164 }
162 165
163 166
164 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( 167 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
165 Dart_Handle library_in, 168 Dart_Handle library_in,
166 Dart_Handle class_name_in, 169 Dart_Handle class_name_in,
167 Dart_Handle function_name_in, 170 Dart_Handle function_name_in,
168 Dart_Breakpoint* breakpoint) { 171 Dart_Breakpoint* breakpoint) {
169 Isolate* isolate = Isolate::Current(); 172 Isolate* isolate = Isolate::Current();
(...skipping 18 matching lines...) Expand all
188 debugger->ResolveFunction(library, class_name, function_name)); 191 debugger->ResolveFunction(library, class_name, function_name));
189 if (bp_target.IsNull()) { 192 if (bp_target.IsNull()) {
190 const bool toplevel = class_name.Length() == 0; 193 const bool toplevel = class_name.Length() == 0;
191 return Api::NewError("%s: could not find function '%s%s%s'", 194 return Api::NewError("%s: could not find function '%s%s%s'",
192 CURRENT_FUNC, 195 CURRENT_FUNC,
193 toplevel ? "" : class_name.ToCString(), 196 toplevel ? "" : class_name.ToCString(),
194 toplevel ? "" : ".", 197 toplevel ? "" : ".",
195 function_name.ToCString()); 198 function_name.ToCString());
196 } 199 }
197 200
201 LongJump* base = isolate->long_jump_base();
202 LongJump jump;
203 isolate->set_long_jump_base(&jump);
198 Dart_Handle result = Api::True(); 204 Dart_Handle result = Api::True();
199 *breakpoint = NULL; 205 *breakpoint = NULL;
200 206 if (setjmp(*jump.Set()) == 0) {
201 Error& error = Error::Handle(); 207 Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target);
202 Breakpoint* bpt = debugger->SetBreakpointAtEntry(bp_target, &error); 208 if (bpt == NULL) {
203 if (!error.IsNull()) { 209 const char* target_name = Debugger::QualifiedFunctionName(bp_target);
204 return Api::NewLocalHandle(error); 210 result = Api::NewError("%s: no breakpoint location found in '%s'",
211 CURRENT_FUNC, target_name);
212 } else {
213 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt);
214 }
215 } else {
216 SetupErrorResult(&result);
205 } 217 }
206 if (bpt == NULL) { 218 isolate->set_long_jump_base(base);
207 const char* target_name = Debugger::QualifiedFunctionName(bp_target);
208 result = Api::NewError("%s: no breakpoint location found in '%s'",
209 CURRENT_FUNC, target_name);
210 } else {
211 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt);
212 }
213 return result; 219 return result;
214 } 220 }
215 221
216 222
217 DART_EXPORT Dart_Handle Dart_DeleteBreakpoint( 223 DART_EXPORT Dart_Handle Dart_DeleteBreakpoint(
218 Dart_Breakpoint breakpoint_in) { 224 Dart_Breakpoint breakpoint_in) {
219 Isolate* isolate = Isolate::Current(); 225 Isolate* isolate = Isolate::Current();
220 DARTSCOPE(isolate); 226 DARTSCOPE(isolate);
221 227
222 CHECK_AND_CAST(Breakpoint, breakpoint, breakpoint_in); 228 CHECK_AND_CAST(Breakpoint, breakpoint, breakpoint_in);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 for (int i = 0; i < num_libs; i++) { 348 for (int i = 0; i < num_libs; i++) {
343 ASSERT(!lib.IsNull()); 349 ASSERT(!lib.IsNull());
344 lib_url = lib.url(); 350 lib_url = lib.url();
345 library_list.SetAt(i, lib_url); 351 library_list.SetAt(i, lib_url);
346 lib = lib.next_registered(); 352 lib = lib.next_registered();
347 } 353 }
348 return Api::NewLocalHandle(library_list); 354 return Api::NewLocalHandle(library_list);
349 } 355 }
350 356
351 } // namespace dart 357 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/exceptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698