| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 const char* target_name = Debugger::QualifiedFunctionName(bp_target); | 354 const char* target_name = Debugger::QualifiedFunctionName(bp_target); |
| 355 result = Api::NewError("%s: no breakpoint location found in '%s'", | 355 result = Api::NewError("%s: no breakpoint location found in '%s'", |
| 356 CURRENT_FUNC, target_name); | 356 CURRENT_FUNC, target_name); |
| 357 } else { | 357 } else { |
| 358 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); | 358 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); |
| 359 } | 359 } |
| 360 return result; | 360 return result; |
| 361 } | 361 } |
| 362 | 362 |
| 363 | 363 |
| 364 DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry( |
| 365 Dart_Handle library_in, |
| 366 Dart_Handle class_name_in, |
| 367 Dart_Handle function_name_in) { |
| 368 Isolate* isolate = Isolate::Current(); |
| 369 DARTSCOPE(isolate); |
| 370 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); |
| 371 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); |
| 372 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); |
| 373 |
| 374 const char* msg = CheckIsolateState(isolate); |
| 375 if (msg != NULL) { |
| 376 return Api::NewError("%s", msg); |
| 377 } |
| 378 |
| 379 // Resolve the breakpoint target function. |
| 380 Debugger* debugger = isolate->debugger(); |
| 381 const Function& bp_target = Function::Handle( |
| 382 debugger->ResolveFunction(library, class_name, function_name)); |
| 383 if (bp_target.IsNull()) { |
| 384 const bool toplevel = class_name.Length() == 0; |
| 385 return Api::NewError("%s: could not find function '%s%s%s'", |
| 386 CURRENT_FUNC, |
| 387 toplevel ? "" : class_name.ToCString(), |
| 388 toplevel ? "" : ".", |
| 389 function_name.ToCString()); |
| 390 } |
| 391 |
| 392 debugger->OneTimeBreakAtEntry(bp_target); |
| 393 return Api::True(isolate); |
| 394 } |
| 395 |
| 396 |
| 397 |
| 398 |
| 399 |
| 364 DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) { | 400 DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) { |
| 365 Isolate* isolate = Isolate::Current(); | 401 Isolate* isolate = Isolate::Current(); |
| 366 DARTSCOPE(isolate); | 402 DARTSCOPE(isolate); |
| 367 Debugger* debugger = isolate->debugger(); | 403 Debugger* debugger = isolate->debugger(); |
| 368 ASSERT(debugger != NULL); | 404 ASSERT(debugger != NULL); |
| 369 | 405 |
| 370 isolate->debugger()->RemoveBreakpoint(bp_id); | 406 isolate->debugger()->RemoveBreakpoint(bp_id); |
| 371 return Api::True(isolate); | 407 return Api::True(isolate); |
| 372 } | 408 } |
| 373 | 409 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 return Api::True(isolate); | 745 return Api::True(isolate); |
| 710 } | 746 } |
| 711 | 747 |
| 712 | 748 |
| 713 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { | 749 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { |
| 714 Isolate* isolate = PortMap::GetIsolate(isolate_id); | 750 Isolate* isolate = PortMap::GetIsolate(isolate_id); |
| 715 return Api::CastIsolate(isolate); | 751 return Api::CastIsolate(isolate); |
| 716 } | 752 } |
| 717 | 753 |
| 718 } // namespace dart | 754 } // namespace dart |
| OLD | NEW |