Chromium Code Reviews| Index: runtime/vm/debugger_api_impl.cc |
| =================================================================== |
| --- runtime/vm/debugger_api_impl.cc (revision 7818) |
| +++ runtime/vm/debugger_api_impl.cc (working copy) |
| @@ -43,6 +43,27 @@ |
| } |
| +DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in) { |
| + Isolate* isolate = Isolate::Current(); |
| + DARTSCOPE(isolate); |
| + const Object& obj = Object::Handle(Api::UnwrapHandle(object_in)); |
| + if (obj.IsApiError()) { |
| + return -1; |
|
siva
2012/05/22 01:49:09
Since this is part of the API it might be better t
hausner
2012/05/22 18:03:57
I'd rather solve this by documenting that -1 is an
|
| + } |
| + return isolate->debugger()->CacheObject(obj); |
| +} |
| + |
| + |
| +DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) { |
| + Isolate* isolate = Isolate::Current(); |
| + DARTSCOPE(isolate); |
| + if (!isolate->debugger()->IsValidObjectId(obj_id)) { |
| + return Api::NewError("%s: object id %d is invalid", CURRENT_FUNC, obj_id); |
| + } |
| + return Api::NewHandle(isolate, isolate->debugger()->GetCachedObject(obj_id)); |
| +} |
| + |
| + |
| DART_EXPORT Dart_Handle Dart_StackTraceLength( |
| Dart_StackTrace trace, |
| intptr_t* length) { |
| @@ -364,6 +385,19 @@ |
| } |
| +DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in, |
| + intptr_t* class_id) { |
| + Isolate* isolate = Isolate::Current(); |
| + DARTSCOPE(isolate); |
| + Instance& obj = Instance::Handle(); |
| + UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in); |
|
siva
2012/05/22 01:49:09
if (class_id == NULL) {
return Api::NewError("
hausner
2012/05/22 18:03:57
It's kind of non-sensical to call this function wi
|
| + if (class_id != NULL) { |
| + *class_id = Class::Handle(obj.clazz()).index(); |
| + } |
| + return Api::True(isolate); |
| +} |
| + |
| + |
| DART_EXPORT Dart_Handle Dart_GetSuperclass(Dart_Handle cls_in) { |
| Isolate* isolate = Isolate::Current(); |
| DARTSCOPE(isolate); |
| @@ -373,6 +407,40 @@ |
| } |
| +DART_EXPORT Dart_Handle Dart_GetClassInfo( |
| + intptr_t cls_id, |
| + Dart_Handle* class_name, |
| + Dart_Handle* library, |
| + intptr_t* super_class_id, |
| + Dart_Handle* static_fields) { |
| + Isolate* isolate = Isolate::Current(); |
| + DARTSCOPE(isolate); |
| + if (!isolate->class_table()->IsValidIndex(cls_id)) { |
| + return Api::NewError("%s: %d is not a valid class id", |
| + CURRENT_FUNC, cls_id); |
| + } |
| + Class& cls = Class::Handle(isolate->class_table()->At(cls_id)); |
| + if (class_name != NULL) { |
| + *class_name = Api::NewHandle(isolate, cls.Name()); |
| + } |
| + if (library != NULL) { |
| + *library = Api::NewHandle(isolate, cls.library()); |
| + } |
| + if (super_class_id != NULL) { |
| + *super_class_id = 0; |
| + cls = cls.SuperClass(); |
| + if (!cls.IsNull()) { |
| + *super_class_id = cls.index(); |
| + } |
| + } |
| + if (static_fields != NULL) { |
| + *static_fields = |
| + Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls)); |
| + } |
|
siva
2012/05/22 01:49:09
Ditto Api::NewError return values here for NULL po
hausner
2012/05/22 18:03:57
Not in this case. I want the caller to be able to
|
| + return Api::True(isolate); |
| +} |
| + |
| + |
| DART_EXPORT Dart_Handle Dart_GetScriptSource( |
| Dart_Handle library_url_in, |
| Dart_Handle script_url_in) { |