OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/service.h" | 5 #include "vm/service.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
844 // Skip the dash. | 844 // Skip the dash. |
845 s++; | 845 s++; |
846 // Extract the PC. | 846 // Extract the PC. |
847 if (!GetUnsignedIntegerId(s, address, 16)) { | 847 if (!GetUnsignedIntegerId(s, address, 16)) { |
848 return false; | 848 return false; |
849 } | 849 } |
850 return true; | 850 return true; |
851 } | 851 } |
852 | 852 |
853 | 853 |
854 static bool IsInternal(const Object& obj) { | |
turnidge
2014/05/20 23:21:34
The name is a bit vague. Not sure what to suggest
koda
2014/05/21 15:49:23
Done.
| |
855 if (obj.IsArray()) { | |
turnidge
2014/05/20 23:21:34
Do you need to add a case for obj.IsGrowableArray
koda
2014/05/21 15:49:23
Good point. Done.
| |
856 const Array& array = Array::Cast(obj); | |
857 Object& element = Object::Handle(); | |
858 for (intptr_t i = 0; i < array.Length(); ++i) { | |
859 element = array.At(i); | |
860 if (!element.IsInstance()) { | |
861 return true; | |
862 } | |
863 } | |
864 return false; | |
865 } else { | |
866 return !obj.IsInstance(); | |
867 } | |
868 } | |
869 | |
870 | |
854 static bool HandleInstanceCommands(Isolate* isolate, | 871 static bool HandleInstanceCommands(Isolate* isolate, |
855 const Object& obj, | 872 const Object& obj, |
856 JSONStream* js, | 873 JSONStream* js, |
857 intptr_t arg_pos) { | 874 intptr_t arg_pos) { |
858 ASSERT(js->num_arguments() > arg_pos); | 875 ASSERT(js->num_arguments() > arg_pos); |
859 const char* action = js->GetArgument(arg_pos); | 876 const char* action = js->GetArgument(arg_pos); |
860 if (strcmp(action, "eval") == 0) { | 877 if (strcmp(action, "eval") == 0) { |
861 if (js->num_arguments() > (arg_pos + 1)) { | 878 if (js->num_arguments() > (arg_pos + 1)) { |
862 PrintError(js, "expected at most %" Pd " arguments but found %" Pd "\n", | 879 PrintError(js, "expected at most %" Pd " arguments but found %" Pd "\n", |
863 arg_pos + 1, | 880 arg_pos + 1, |
864 js->num_arguments()); | 881 js->num_arguments()); |
865 return true; | 882 return true; |
866 } | 883 } |
867 if (obj.IsNull()) { | 884 if (obj.IsNull()) { |
868 PrintErrorWithKind(js, "EvalCollected", | 885 PrintErrorWithKind(js, "EvalCollected", |
869 "attempt to evaluate against collected object\n", | 886 "attempt to evaluate against collected object\n", |
870 js->num_arguments()); | 887 js->num_arguments()); |
871 return true; | 888 return true; |
872 } | 889 } |
873 if (obj.raw() == Object::sentinel().raw()) { | 890 if (obj.raw() == Object::sentinel().raw()) { |
874 PrintErrorWithKind(js, "EvalExpired", | 891 PrintErrorWithKind(js, "EvalExpired", |
875 "attempt to evaluate against expired object\n", | 892 "attempt to evaluate against expired object\n", |
876 js->num_arguments()); | 893 js->num_arguments()); |
877 return true; | 894 return true; |
878 } | 895 } |
896 if (IsInternal(obj)) { | |
897 PrintError(js, "attempt to evaluate against internal VM object\n"); | |
898 return true; | |
899 } | |
879 const char* expr = js->LookupOption("expr"); | 900 const char* expr = js->LookupOption("expr"); |
880 if (expr == NULL) { | 901 if (expr == NULL) { |
881 PrintError(js, "eval expects an 'expr' option\n", | 902 PrintError(js, "eval expects an 'expr' option\n", |
882 js->num_arguments()); | 903 js->num_arguments()); |
883 return true; | 904 return true; |
884 } | 905 } |
885 const String& expr_str = String::Handle(isolate, String::New(expr)); | 906 const String& expr_str = String::Handle(isolate, String::New(expr)); |
886 ASSERT(obj.IsInstance()); | 907 ASSERT(obj.IsInstance()); |
887 const Instance& instance = Instance::Cast(obj); | 908 const Instance& instance = Instance::Cast(obj); |
888 const Object& result = | 909 const Object& result = |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2012 while (current != NULL) { | 2033 while (current != NULL) { |
2013 if (strcmp(name, current->name()) == 0) { | 2034 if (strcmp(name, current->name()) == 0) { |
2014 return current; | 2035 return current; |
2015 } | 2036 } |
2016 current = current->next(); | 2037 current = current->next(); |
2017 } | 2038 } |
2018 return NULL; | 2039 return NULL; |
2019 } | 2040 } |
2020 | 2041 |
2021 } // namespace dart | 2042 } // namespace dart |
OLD | NEW |