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

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

Issue 411633002: Fix for issue 19817 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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
OLDNEW
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/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 return Api::Success(); 308 return Api::Success();
309 } 309 }
310 310
311 311
312 DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) { 312 DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) {
313 Isolate* isolate = Isolate::Current(); 313 Isolate* isolate = Isolate::Current();
314 DARTSCOPE(isolate); 314 DARTSCOPE(isolate);
315 UNWRAP_AND_CHECK_PARAM(Function, function, function_in); 315 UNWRAP_AND_CHECK_PARAM(Function, function, function_in);
316 316
317 Dart_Handle state = Api::CheckIsolateState(isolate);
318 if (::Dart_IsError(state)) {
319 return state;
320 }
321
322 const Class& cls = Class::Handle(function.origin()); 317 const Class& cls = Class::Handle(function.origin());
323 if (!cls.IsTopLevel()) { 318 if (!cls.IsTopLevel()) {
324 return Dart_NewInteger(cls.id()); 319 return Dart_NewInteger(cls.id());
325 } 320 }
326 return Api::Null(); 321 return Api::Null();
327 } 322 }
328 323
329 324
330 DART_EXPORT Dart_Handle Dart_GetLocalVariables( 325 DART_EXPORT Dart_Handle Dart_GetLocalVariables(
331 Dart_ActivationFrame activation_frame) { 326 Dart_ActivationFrame activation_frame) {
332 Isolate* isolate = Isolate::Current(); 327 Isolate* isolate = Isolate::Current();
333 DARTSCOPE(isolate); 328 DARTSCOPE(isolate);
334 CHECK_AND_CAST(ActivationFrame, frame, activation_frame); 329 CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
335 return Api::NewHandle(isolate, frame->GetLocalVariables()); 330 return Api::NewHandle(isolate, frame->GetLocalVariables());
336 } 331 }
337 332
338 333
339 DART_EXPORT Dart_Handle Dart_SetBreakpoint( 334 DART_EXPORT Dart_Handle Dart_SetBreakpoint(
340 Dart_Handle script_url_in, 335 Dart_Handle script_url_in,
341 intptr_t line_number) { 336 intptr_t line_number) {
342 Isolate* isolate = Isolate::Current(); 337 Isolate* isolate = Isolate::Current();
343 DARTSCOPE(isolate); 338 DARTSCOPE(isolate);
344 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); 339 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
345 340
346 Dart_Handle state = Api::CheckIsolateState(isolate);
347 if (::Dart_IsError(state)) {
348 return state;
349 }
350
351 Debugger* debugger = isolate->debugger(); 341 Debugger* debugger = isolate->debugger();
352 ASSERT(debugger != NULL); 342 ASSERT(debugger != NULL);
353 SourceBreakpoint* bpt = 343 SourceBreakpoint* bpt =
354 debugger->SetBreakpointAtLine(script_url, line_number); 344 debugger->SetBreakpointAtLine(script_url, line_number);
355 if (bpt == NULL) { 345 if (bpt == NULL) {
356 return Api::NewError("%s: could not set breakpoint at line %" Pd " in '%s'", 346 return Api::NewError("%s: could not set breakpoint at line %" Pd " in '%s'",
357 CURRENT_FUNC, line_number, script_url.ToCString()); 347 CURRENT_FUNC, line_number, script_url.ToCString());
358 } 348 }
359 return Dart_NewInteger(bpt->id()); 349 return Dart_NewInteger(bpt->id());
360 } 350 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( 383 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
394 Dart_Handle library_in, 384 Dart_Handle library_in,
395 Dart_Handle class_name_in, 385 Dart_Handle class_name_in,
396 Dart_Handle function_name_in) { 386 Dart_Handle function_name_in) {
397 Isolate* isolate = Isolate::Current(); 387 Isolate* isolate = Isolate::Current();
398 DARTSCOPE(isolate); 388 DARTSCOPE(isolate);
399 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); 389 UNWRAP_AND_CHECK_PARAM(Library, library, library_in);
400 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); 390 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in);
401 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); 391 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in);
402 392
403 Dart_Handle state = Api::CheckIsolateState(isolate);
hausner 2014/07/22 18:23:32 Should we check that the library has been successf
siva 2014/07/22 19:55:11 Added a check that the library passed in is loaded
404 if (::Dart_IsError(state)) {
405 return state;
406 }
407
408 // Resolve the breakpoint target function. 393 // Resolve the breakpoint target function.
409 Debugger* debugger = isolate->debugger(); 394 Debugger* debugger = isolate->debugger();
410 const Function& bp_target = Function::Handle( 395 const Function& bp_target = Function::Handle(
411 debugger->ResolveFunction(library, class_name, function_name)); 396 debugger->ResolveFunction(library, class_name, function_name));
412 if (bp_target.IsNull()) { 397 if (bp_target.IsNull()) {
413 const bool toplevel = class_name.Length() == 0; 398 const bool toplevel = class_name.Length() == 0;
414 return Api::NewError("%s: could not find function '%s%s%s'", 399 return Api::NewError("%s: could not find function '%s%s%s'",
415 CURRENT_FUNC, 400 CURRENT_FUNC,
416 toplevel ? "" : class_name.ToCString(), 401 toplevel ? "" : class_name.ToCString(),
417 toplevel ? "" : ".", 402 toplevel ? "" : ".",
(...skipping 13 matching lines...) Expand all
431 DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry( 416 DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
432 Dart_Handle library_in, 417 Dart_Handle library_in,
433 Dart_Handle class_name_in, 418 Dart_Handle class_name_in,
434 Dart_Handle function_name_in) { 419 Dart_Handle function_name_in) {
435 Isolate* isolate = Isolate::Current(); 420 Isolate* isolate = Isolate::Current();
436 DARTSCOPE(isolate); 421 DARTSCOPE(isolate);
437 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); 422 UNWRAP_AND_CHECK_PARAM(Library, library, library_in);
438 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); 423 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in);
439 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); 424 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in);
440 425
441 Dart_Handle state = Api::CheckIsolateState(isolate);
hausner 2014/07/22 18:23:32 ditto
siva 2014/07/22 19:55:11 Done.
442 if (::Dart_IsError(state)) {
443 return state;
444 }
445
446 // Resolve the breakpoint target function. 426 // Resolve the breakpoint target function.
447 Debugger* debugger = isolate->debugger(); 427 Debugger* debugger = isolate->debugger();
448 const Function& bp_target = Function::Handle( 428 const Function& bp_target = Function::Handle(
449 debugger->ResolveFunction(library, class_name, function_name)); 429 debugger->ResolveFunction(library, class_name, function_name));
450 if (bp_target.IsNull()) { 430 if (bp_target.IsNull()) {
451 const bool toplevel = class_name.Length() == 0; 431 const bool toplevel = class_name.Length() == 0;
452 return Api::NewError("%s: could not find function '%s%s%s'", 432 return Api::NewError("%s: could not find function '%s%s%s'",
453 CURRENT_FUNC, 433 CURRENT_FUNC,
454 toplevel ? "" : class_name.ToCString(), 434 toplevel ? "" : class_name.ToCString(),
455 toplevel ? "" : ".", 435 toplevel ? "" : ".",
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 return Api::CastIsolate(isolate); 961 return Api::CastIsolate(isolate);
982 } 962 }
983 963
984 964
985 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) { 965 DART_EXPORT Dart_IsolateId Dart_GetIsolateId(Dart_Isolate dart_isolate) {
986 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate); 966 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
987 return isolate->debugger()->GetIsolateId(); 967 return isolate->debugger()->GetIsolateId();
988 } 968 }
989 969
990 } // namespace dart 970 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698