| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 DARTSCOPE(isolate); | 258 DARTSCOPE(isolate); |
| 259 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 259 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
| 260 UNWRAP_AND_CHECK_PARAM(Integer, line_number, line_number_in); | 260 UNWRAP_AND_CHECK_PARAM(Integer, line_number, line_number_in); |
| 261 CHECK_NOT_NULL(breakpoint); | 261 CHECK_NOT_NULL(breakpoint); |
| 262 | 262 |
| 263 if (!line_number.IsSmi()) { | 263 if (!line_number.IsSmi()) { |
| 264 return Api::NewError("%s: line number out of range", CURRENT_FUNC); | 264 return Api::NewError("%s: line number out of range", CURRENT_FUNC); |
| 265 } | 265 } |
| 266 intptr_t line = line_number.AsInt64Value(); | 266 intptr_t line = line_number.AsInt64Value(); |
| 267 | 267 |
| 268 const char* msg = CheckIsolateState(isolate); | 268 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 269 if (msg != NULL) { | 269 if (Dart_IsError(state)) { |
| 270 return Api::NewError("%s", msg); | 270 return state; |
| 271 } | 271 } |
| 272 | 272 |
| 273 Dart_Handle result = Api::True(isolate); | 273 Dart_Handle result = Api::True(isolate); |
| 274 *breakpoint = NULL; | 274 *breakpoint = NULL; |
| 275 Debugger* debugger = isolate->debugger(); | 275 Debugger* debugger = isolate->debugger(); |
| 276 ASSERT(debugger != NULL); | 276 ASSERT(debugger != NULL); |
| 277 SourceBreakpoint* bpt = | 277 SourceBreakpoint* bpt = |
| 278 debugger->SetBreakpointAtLine(script_url, line); | 278 debugger->SetBreakpointAtLine(script_url, line); |
| 279 if (bpt == NULL) { | 279 if (bpt == NULL) { |
| 280 result = Api::NewError("%s: could not set breakpoint at line %"Pd" of '%s'", | 280 result = Api::NewError("%s: could not set breakpoint at line %"Pd" of '%s'", |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 Dart_Handle class_name_in, | 321 Dart_Handle class_name_in, |
| 322 Dart_Handle function_name_in, | 322 Dart_Handle function_name_in, |
| 323 Dart_Breakpoint* breakpoint) { | 323 Dart_Breakpoint* breakpoint) { |
| 324 Isolate* isolate = Isolate::Current(); | 324 Isolate* isolate = Isolate::Current(); |
| 325 DARTSCOPE(isolate); | 325 DARTSCOPE(isolate); |
| 326 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); | 326 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); |
| 327 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); | 327 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); |
| 328 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); | 328 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); |
| 329 CHECK_NOT_NULL(breakpoint); | 329 CHECK_NOT_NULL(breakpoint); |
| 330 | 330 |
| 331 const char* msg = CheckIsolateState(isolate); | 331 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 332 if (msg != NULL) { | 332 if (Dart_IsError(state)) { |
| 333 return Api::NewError("%s", msg); | 333 return state; |
| 334 } | 334 } |
| 335 | 335 |
| 336 // Resolve the breakpoint target function. | 336 // Resolve the breakpoint target function. |
| 337 Debugger* debugger = isolate->debugger(); | 337 Debugger* debugger = isolate->debugger(); |
| 338 const Function& bp_target = Function::Handle( | 338 const Function& bp_target = Function::Handle( |
| 339 debugger->ResolveFunction(library, class_name, function_name)); | 339 debugger->ResolveFunction(library, class_name, function_name)); |
| 340 if (bp_target.IsNull()) { | 340 if (bp_target.IsNull()) { |
| 341 const bool toplevel = class_name.Length() == 0; | 341 const bool toplevel = class_name.Length() == 0; |
| 342 return Api::NewError("%s: could not find function '%s%s%s'", | 342 return Api::NewError("%s: could not find function '%s%s%s'", |
| 343 CURRENT_FUNC, | 343 CURRENT_FUNC, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 364 DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry( | 364 DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry( |
| 365 Dart_Handle library_in, | 365 Dart_Handle library_in, |
| 366 Dart_Handle class_name_in, | 366 Dart_Handle class_name_in, |
| 367 Dart_Handle function_name_in) { | 367 Dart_Handle function_name_in) { |
| 368 Isolate* isolate = Isolate::Current(); | 368 Isolate* isolate = Isolate::Current(); |
| 369 DARTSCOPE(isolate); | 369 DARTSCOPE(isolate); |
| 370 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); | 370 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); |
| 371 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); | 371 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); |
| 372 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); | 372 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); |
| 373 | 373 |
| 374 const char* msg = CheckIsolateState(isolate); | 374 Dart_Handle state = Api::CheckIsolateState(isolate); |
| 375 if (msg != NULL) { | 375 if (Dart_IsError(state)) { |
| 376 return Api::NewError("%s", msg); | 376 return state; |
| 377 } | 377 } |
| 378 | 378 |
| 379 // Resolve the breakpoint target function. | 379 // Resolve the breakpoint target function. |
| 380 Debugger* debugger = isolate->debugger(); | 380 Debugger* debugger = isolate->debugger(); |
| 381 const Function& bp_target = Function::Handle( | 381 const Function& bp_target = Function::Handle( |
| 382 debugger->ResolveFunction(library, class_name, function_name)); | 382 debugger->ResolveFunction(library, class_name, function_name)); |
| 383 if (bp_target.IsNull()) { | 383 if (bp_target.IsNull()) { |
| 384 const bool toplevel = class_name.Length() == 0; | 384 const bool toplevel = class_name.Length() == 0; |
| 385 return Api::NewError("%s: could not find function '%s%s%s'", | 385 return Api::NewError("%s: could not find function '%s%s%s'", |
| 386 CURRENT_FUNC, | 386 CURRENT_FUNC, |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 return Api::True(isolate); | 745 return Api::True(isolate); |
| 746 } | 746 } |
| 747 | 747 |
| 748 | 748 |
| 749 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { | 749 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { |
| 750 Isolate* isolate = PortMap::GetIsolate(isolate_id); | 750 Isolate* isolate = PortMap::GetIsolate(isolate_id); |
| 751 return Api::CastIsolate(isolate); | 751 return Api::CastIsolate(isolate); |
| 752 } | 752 } |
| 753 | 753 |
| 754 } // namespace dart | 754 } // namespace dart |
| OLD | NEW |