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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return -1; | 56 return -1; |
57 } | 57 } |
58 return isolate->debugger()->CacheObject(obj); | 58 return isolate->debugger()->CacheObject(obj); |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { | 62 DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { |
63 Isolate* isolate = Isolate::Current(); | 63 Isolate* isolate = Isolate::Current(); |
64 DARTSCOPE(isolate); | 64 DARTSCOPE(isolate); |
65 if (!isolate->debugger()->IsValidObjectId(obj_id)) { | 65 if (!isolate->debugger()->IsValidObjectId(obj_id)) { |
66 return Api::NewError("%s: object id %d is invalid", CURRENT_FUNC, obj_id); | 66 return Api::NewError("%s: object id %"Pd" is invalid", |
| 67 CURRENT_FUNC, obj_id); |
67 } | 68 } |
68 return Api::NewHandle(isolate, isolate->debugger()->GetCachedObject(obj_id)); | 69 return Api::NewHandle(isolate, isolate->debugger()->GetCachedObject(obj_id)); |
69 } | 70 } |
70 | 71 |
71 | 72 |
72 DART_EXPORT Dart_Handle Dart_StackTraceLength( | 73 DART_EXPORT Dart_Handle Dart_StackTraceLength( |
73 Dart_StackTrace trace, | 74 Dart_StackTrace trace, |
74 intptr_t* length) { | 75 intptr_t* length) { |
75 Isolate* isolate = Isolate::Current(); | 76 Isolate* isolate = Isolate::Current(); |
76 DARTSCOPE(isolate); | 77 DARTSCOPE(isolate); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 Dart_Handle script_url_in, | 214 Dart_Handle script_url_in, |
214 intptr_t line_number) { | 215 intptr_t line_number) { |
215 Isolate* isolate = Isolate::Current(); | 216 Isolate* isolate = Isolate::Current(); |
216 DARTSCOPE(isolate); | 217 DARTSCOPE(isolate); |
217 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 218 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
218 Debugger* debugger = isolate->debugger(); | 219 Debugger* debugger = isolate->debugger(); |
219 ASSERT(debugger != NULL); | 220 ASSERT(debugger != NULL); |
220 SourceBreakpoint* bpt = | 221 SourceBreakpoint* bpt = |
221 debugger->SetBreakpointAtLine(script_url, line_number); | 222 debugger->SetBreakpointAtLine(script_url, line_number); |
222 if (bpt == NULL) { | 223 if (bpt == NULL) { |
223 return Api::NewError("%s: could not set breakpoint at line %d in '%s'", | 224 return Api::NewError("%s: could not set breakpoint at line %"Pd" in '%s'", |
224 CURRENT_FUNC, line_number, script_url.ToCString()); | 225 CURRENT_FUNC, line_number, script_url.ToCString()); |
225 } | 226 } |
226 return Dart_NewInteger(bpt->id()); | 227 return Dart_NewInteger(bpt->id()); |
227 } | 228 } |
228 | 229 |
229 | 230 |
230 // TODO(hausner): remove this function. | 231 // TODO(hausner): remove this function. |
231 DART_EXPORT Dart_Handle Dart_SetBreakpointAtLine( | 232 DART_EXPORT Dart_Handle Dart_SetBreakpointAtLine( |
232 Dart_Handle script_url_in, | 233 Dart_Handle script_url_in, |
233 Dart_Handle line_number_in, | 234 Dart_Handle line_number_in, |
234 Dart_Breakpoint* breakpoint) { | 235 Dart_Breakpoint* breakpoint) { |
235 Isolate* isolate = Isolate::Current(); | 236 Isolate* isolate = Isolate::Current(); |
236 DARTSCOPE(isolate); | 237 DARTSCOPE(isolate); |
237 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 238 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
238 UNWRAP_AND_CHECK_PARAM(Integer, line_number, line_number_in); | 239 UNWRAP_AND_CHECK_PARAM(Integer, line_number, line_number_in); |
239 CHECK_NOT_NULL(breakpoint); | 240 CHECK_NOT_NULL(breakpoint); |
240 | 241 |
241 if (!line_number.IsSmi()) { | 242 if (!line_number.IsSmi()) { |
242 return Api::NewError("%s: line number out of range", CURRENT_FUNC); | 243 return Api::NewError("%s: line number out of range", CURRENT_FUNC); |
243 } | 244 } |
244 intptr_t line = line_number.AsInt64Value(); | 245 intptr_t line = line_number.AsInt64Value(); |
245 | 246 |
246 const char* msg = CheckIsolateState(isolate); | 247 const char* msg = CheckIsolateState(isolate); |
247 if (msg != NULL) { | 248 if (msg != NULL) { |
248 return Api::NewError(msg); | 249 return Api::NewError("%s", msg); |
249 } | 250 } |
250 | 251 |
251 Dart_Handle result = Api::True(isolate); | 252 Dart_Handle result = Api::True(isolate); |
252 *breakpoint = NULL; | 253 *breakpoint = NULL; |
253 Debugger* debugger = isolate->debugger(); | 254 Debugger* debugger = isolate->debugger(); |
254 ASSERT(debugger != NULL); | 255 ASSERT(debugger != NULL); |
255 SourceBreakpoint* bpt = | 256 SourceBreakpoint* bpt = |
256 debugger->SetBreakpointAtLine(script_url, line); | 257 debugger->SetBreakpointAtLine(script_url, line); |
257 if (bpt == NULL) { | 258 if (bpt == NULL) { |
258 result = Api::NewError("%s: could not set breakpoint at line %d of '%s'", | 259 result = Api::NewError("%s: could not set breakpoint at line %"Pd" of '%s'", |
259 CURRENT_FUNC, line, script_url.ToCString()); | 260 CURRENT_FUNC, line, script_url.ToCString()); |
260 } else { | 261 } else { |
261 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); | 262 *breakpoint = reinterpret_cast<Dart_Breakpoint>(bpt); |
262 } | 263 } |
263 return result; | 264 return result; |
264 } | 265 } |
265 | 266 |
266 | 267 |
267 DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) { | 268 DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) { |
268 Isolate* isolate = Isolate::Current(); | 269 Isolate* isolate = Isolate::Current(); |
269 DARTSCOPE(isolate); | 270 DARTSCOPE(isolate); |
270 Debugger* debugger = isolate->debugger(); | 271 Debugger* debugger = isolate->debugger(); |
271 ASSERT(debugger != NULL); | 272 ASSERT(debugger != NULL); |
272 | 273 |
273 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id); | 274 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id); |
274 if (bpt == NULL) { | 275 if (bpt == NULL) { |
275 return Api::NewError("%s: breakpoint with id %d does not exist", | 276 return Api::NewError("%s: breakpoint with id %"Pd" does not exist", |
276 CURRENT_FUNC, bp_id); | 277 CURRENT_FUNC, bp_id); |
277 } | 278 } |
278 return Api::NewHandle(isolate, bpt->SourceUrl()); | 279 return Api::NewHandle(isolate, bpt->SourceUrl()); |
279 } | 280 } |
280 | 281 |
281 | 282 |
282 DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) { | 283 DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) { |
283 Isolate* isolate = Isolate::Current(); | 284 Isolate* isolate = Isolate::Current(); |
284 DARTSCOPE(isolate); | 285 DARTSCOPE(isolate); |
285 Debugger* debugger = isolate->debugger(); | 286 Debugger* debugger = isolate->debugger(); |
286 ASSERT(debugger != NULL); | 287 ASSERT(debugger != NULL); |
287 | 288 |
288 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id); | 289 SourceBreakpoint* bpt = debugger->GetBreakpointById(bp_id); |
289 if (bpt == NULL) { | 290 if (bpt == NULL) { |
290 return Api::NewError("%s: breakpoint with id %d does not exist", | 291 return Api::NewError("%s: breakpoint with id %"Pd" does not exist", |
291 CURRENT_FUNC, bp_id); | 292 CURRENT_FUNC, bp_id); |
292 } | 293 } |
293 return Dart_NewInteger(bpt->LineNumber()); | 294 return Dart_NewInteger(bpt->LineNumber()); |
294 } | 295 } |
295 | 296 |
296 | 297 |
297 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( | 298 DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry( |
298 Dart_Handle library_in, | 299 Dart_Handle library_in, |
299 Dart_Handle class_name_in, | 300 Dart_Handle class_name_in, |
300 Dart_Handle function_name_in, | 301 Dart_Handle function_name_in, |
301 Dart_Breakpoint* breakpoint) { | 302 Dart_Breakpoint* breakpoint) { |
302 Isolate* isolate = Isolate::Current(); | 303 Isolate* isolate = Isolate::Current(); |
303 DARTSCOPE(isolate); | 304 DARTSCOPE(isolate); |
304 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); | 305 UNWRAP_AND_CHECK_PARAM(Library, library, library_in); |
305 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); | 306 UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in); |
306 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); | 307 UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in); |
307 CHECK_NOT_NULL(breakpoint); | 308 CHECK_NOT_NULL(breakpoint); |
308 | 309 |
309 const char* msg = CheckIsolateState(isolate); | 310 const char* msg = CheckIsolateState(isolate); |
310 if (msg != NULL) { | 311 if (msg != NULL) { |
311 return Api::NewError(msg); | 312 return Api::NewError("%s", msg); |
312 } | 313 } |
313 | 314 |
314 // Resolve the breakpoint target function. | 315 // Resolve the breakpoint target function. |
315 Debugger* debugger = isolate->debugger(); | 316 Debugger* debugger = isolate->debugger(); |
316 const Function& bp_target = Function::Handle( | 317 const Function& bp_target = Function::Handle( |
317 debugger->ResolveFunction(library, class_name, function_name)); | 318 debugger->ResolveFunction(library, class_name, function_name)); |
318 if (bp_target.IsNull()) { | 319 if (bp_target.IsNull()) { |
319 const bool toplevel = class_name.Length() == 0; | 320 const bool toplevel = class_name.Length() == 0; |
320 return Api::NewError("%s: could not find function '%s%s%s'", | 321 return Api::NewError("%s: could not find function '%s%s%s'", |
321 CURRENT_FUNC, | 322 CURRENT_FUNC, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 return Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls)); | 401 return Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls)); |
401 } | 402 } |
402 | 403 |
403 | 404 |
404 DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) { | 405 DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) { |
405 Isolate* isolate = Isolate::Current(); | 406 Isolate* isolate = Isolate::Current(); |
406 DARTSCOPE(isolate); | 407 DARTSCOPE(isolate); |
407 const Library& lib = | 408 const Library& lib = |
408 Library::Handle(isolate, Library::GetLibrary(library_id)); | 409 Library::Handle(isolate, Library::GetLibrary(library_id)); |
409 if (lib.IsNull()) { | 410 if (lib.IsNull()) { |
410 return Api::NewError("%s: %d is not a valid library id", | 411 return Api::NewError("%s: %"Pd" is not a valid library id", |
411 CURRENT_FUNC, library_id); | 412 CURRENT_FUNC, library_id); |
412 } | 413 } |
413 return Api::NewHandle(isolate, isolate->debugger()->GetLibraryFields(lib)); | 414 return Api::NewHandle(isolate, isolate->debugger()->GetLibraryFields(lib)); |
414 } | 415 } |
415 | 416 |
416 | 417 |
417 DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) { | 418 DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) { |
418 Isolate* isolate = Isolate::Current(); | 419 Isolate* isolate = Isolate::Current(); |
419 ASSERT(isolate != NULL); | 420 ASSERT(isolate != NULL); |
420 DARTSCOPE(isolate); | 421 DARTSCOPE(isolate); |
421 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 422 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
422 if (lib.IsNull()) { | 423 if (lib.IsNull()) { |
423 return Api::NewError("%s: %d is not a valid library id", | 424 return Api::NewError("%s: %"Pd" is not a valid library id", |
424 CURRENT_FUNC, library_id); | 425 CURRENT_FUNC, library_id); |
425 } | 426 } |
426 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib)); | 427 return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib)); |
427 } | 428 } |
428 | 429 |
429 | 430 |
430 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { | 431 DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) { |
431 Isolate* isolate = Isolate::Current(); | 432 Isolate* isolate = Isolate::Current(); |
432 DARTSCOPE(isolate); | 433 DARTSCOPE(isolate); |
433 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); | 434 UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); |
(...skipping 22 matching lines...) Expand all Loading... |
456 | 457 |
457 DART_EXPORT Dart_Handle Dart_GetClassInfo( | 458 DART_EXPORT Dart_Handle Dart_GetClassInfo( |
458 intptr_t cls_id, | 459 intptr_t cls_id, |
459 Dart_Handle* class_name, | 460 Dart_Handle* class_name, |
460 intptr_t* library_id, | 461 intptr_t* library_id, |
461 intptr_t* super_class_id, | 462 intptr_t* super_class_id, |
462 Dart_Handle* static_fields) { | 463 Dart_Handle* static_fields) { |
463 Isolate* isolate = Isolate::Current(); | 464 Isolate* isolate = Isolate::Current(); |
464 DARTSCOPE(isolate); | 465 DARTSCOPE(isolate); |
465 if (!isolate->class_table()->IsValidIndex(cls_id)) { | 466 if (!isolate->class_table()->IsValidIndex(cls_id)) { |
466 return Api::NewError("%s: %d is not a valid class id", | 467 return Api::NewError("%s: %"Pd" is not a valid class id", |
467 CURRENT_FUNC, cls_id); | 468 CURRENT_FUNC, cls_id); |
468 } | 469 } |
469 Class& cls = Class::Handle(isolate, isolate->class_table()->At(cls_id)); | 470 Class& cls = Class::Handle(isolate, isolate->class_table()->At(cls_id)); |
470 if (class_name != NULL) { | 471 if (class_name != NULL) { |
471 *class_name = Api::NewHandle(isolate, cls.Name()); | 472 *class_name = Api::NewHandle(isolate, cls.Name()); |
472 } | 473 } |
473 if (library_id != NULL) { | 474 if (library_id != NULL) { |
474 const Library& lib = Library::Handle(isolate, cls.library()); | 475 const Library& lib = Library::Handle(isolate, cls.library()); |
475 *library_id = lib.index(); | 476 *library_id = lib.index(); |
476 } | 477 } |
(...skipping 12 matching lines...) Expand all Loading... |
489 } | 490 } |
490 | 491 |
491 | 492 |
492 DART_EXPORT Dart_Handle Dart_ScriptGetSource( | 493 DART_EXPORT Dart_Handle Dart_ScriptGetSource( |
493 intptr_t library_id, | 494 intptr_t library_id, |
494 Dart_Handle script_url_in) { | 495 Dart_Handle script_url_in) { |
495 Isolate* isolate = Isolate::Current(); | 496 Isolate* isolate = Isolate::Current(); |
496 DARTSCOPE(isolate); | 497 DARTSCOPE(isolate); |
497 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 498 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
498 if (lib.IsNull()) { | 499 if (lib.IsNull()) { |
499 return Api::NewError("%s: %d is not a valid library id", | 500 return Api::NewError("%s: %"Pd" is not a valid library id", |
500 CURRENT_FUNC, library_id); | 501 CURRENT_FUNC, library_id); |
501 } | 502 } |
502 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 503 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
503 const Script& script = Script::Handle(lib.LookupScript(script_url)); | 504 const Script& script = Script::Handle(lib.LookupScript(script_url)); |
504 if (script.IsNull()) { | 505 if (script.IsNull()) { |
505 return Api::NewError("%s: script '%s' not found in library '%s'", | 506 return Api::NewError("%s: script '%s' not found in library '%s'", |
506 CURRENT_FUNC, script_url.ToCString(), | 507 CURRENT_FUNC, script_url.ToCString(), |
507 String::Handle(lib.url()).ToCString()); | 508 String::Handle(lib.url()).ToCString()); |
508 } | 509 } |
509 return Api::NewHandle(isolate, script.Source()); | 510 return Api::NewHandle(isolate, script.Source()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 return Api::NewHandle(isolate, library_id_list.raw()); | 582 return Api::NewHandle(isolate, library_id_list.raw()); |
582 } | 583 } |
583 | 584 |
584 | 585 |
585 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { | 586 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { |
586 Isolate* isolate = Isolate::Current(); | 587 Isolate* isolate = Isolate::Current(); |
587 ASSERT(isolate != NULL); | 588 ASSERT(isolate != NULL); |
588 DARTSCOPE(isolate); | 589 DARTSCOPE(isolate); |
589 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 590 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
590 if (lib.IsNull()) { | 591 if (lib.IsNull()) { |
591 return Api::NewError("%s: %d is not a valid library id", | 592 return Api::NewError("%s: %"Pd" is not a valid library id", |
592 CURRENT_FUNC, library_id); | 593 CURRENT_FUNC, library_id); |
593 } | 594 } |
594 const GrowableObjectArray& import_list = | 595 const GrowableObjectArray& import_list = |
595 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); | 596 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); |
596 | 597 |
597 String& prefix_name = String::Handle(isolate); | 598 String& prefix_name = String::Handle(isolate); |
598 Library& imported = Library::Handle(isolate); | 599 Library& imported = Library::Handle(isolate); |
599 intptr_t num_imports = lib.num_imports(); | 600 intptr_t num_imports = lib.num_imports(); |
600 for (int i = 0; i < num_imports; i++) { | 601 for (int i = 0; i < num_imports; i++) { |
601 import_list.Add(prefix_name); // Null prefix name means no prefix. | 602 import_list.Add(prefix_name); // Null prefix name means no prefix. |
(...skipping 19 matching lines...) Expand all Loading... |
621 return Api::NewHandle(isolate, Array::MakeArray(import_list)); | 622 return Api::NewHandle(isolate, Array::MakeArray(import_list)); |
622 } | 623 } |
623 | 624 |
624 | 625 |
625 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { | 626 DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) { |
626 Isolate* isolate = Isolate::Current(); | 627 Isolate* isolate = Isolate::Current(); |
627 ASSERT(isolate != NULL); | 628 ASSERT(isolate != NULL); |
628 DARTSCOPE(isolate); | 629 DARTSCOPE(isolate); |
629 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 630 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
630 if (lib.IsNull()) { | 631 if (lib.IsNull()) { |
631 return Api::NewError("%s: %d is not a valid library id", | 632 return Api::NewError("%s: %"Pd" is not a valid library id", |
632 CURRENT_FUNC, library_id); | 633 CURRENT_FUNC, library_id); |
633 } | 634 } |
634 return Api::NewHandle(isolate, lib.url()); | 635 return Api::NewHandle(isolate, lib.url()); |
635 } | 636 } |
636 | 637 |
637 | 638 |
638 DART_EXPORT Dart_Handle Dart_GetLibraryURLs() { | 639 DART_EXPORT Dart_Handle Dart_GetLibraryURLs() { |
639 Isolate* isolate = Isolate::Current(); | 640 Isolate* isolate = Isolate::Current(); |
640 ASSERT(isolate != NULL); | 641 ASSERT(isolate != NULL); |
641 DARTSCOPE(isolate); | 642 DARTSCOPE(isolate); |
(...skipping 17 matching lines...) Expand all Loading... |
659 | 660 |
660 | 661 |
661 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, | 662 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, |
662 bool* is_debuggable) { | 663 bool* is_debuggable) { |
663 Isolate* isolate = Isolate::Current(); | 664 Isolate* isolate = Isolate::Current(); |
664 ASSERT(isolate != NULL); | 665 ASSERT(isolate != NULL); |
665 DARTSCOPE(isolate); | 666 DARTSCOPE(isolate); |
666 CHECK_NOT_NULL(is_debuggable); | 667 CHECK_NOT_NULL(is_debuggable); |
667 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 668 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
668 if (lib.IsNull()) { | 669 if (lib.IsNull()) { |
669 return Api::NewError("%s: %d is not a valid library id", | 670 return Api::NewError("%s: %"Pd" is not a valid library id", |
670 CURRENT_FUNC, library_id); | 671 CURRENT_FUNC, library_id); |
671 } | 672 } |
672 *is_debuggable = lib.IsDebuggable(); | 673 *is_debuggable = lib.IsDebuggable(); |
673 return Api::True(isolate); | 674 return Api::True(isolate); |
674 } | 675 } |
675 | 676 |
676 | 677 |
677 DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, | 678 DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, |
678 bool is_debuggable) { | 679 bool is_debuggable) { |
679 Isolate* isolate = Isolate::Current(); | 680 Isolate* isolate = Isolate::Current(); |
680 ASSERT(isolate != NULL); | 681 ASSERT(isolate != NULL); |
681 DARTSCOPE(isolate); | 682 DARTSCOPE(isolate); |
682 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 683 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
683 if (lib.IsNull()) { | 684 if (lib.IsNull()) { |
684 return Api::NewError("%s: %d is not a valid library id", | 685 return Api::NewError("%s: %"Pd" is not a valid library id", |
685 CURRENT_FUNC, library_id); | 686 CURRENT_FUNC, library_id); |
686 } | 687 } |
687 lib.set_debuggable(is_debuggable); | 688 lib.set_debuggable(is_debuggable); |
688 return Api::True(isolate); | 689 return Api::True(isolate); |
689 } | 690 } |
690 | 691 |
691 | 692 |
692 } // namespace dart | 693 } // namespace dart |
OLD | NEW |