| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index 9ceaf75711a490d85109243be6bc46fc1466561e..437b6aad4cc00a013ff23fb84bede9f697cfcbf0 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -11442,9 +11442,7 @@ const char* Error::ToCString() const {
|
|
|
|
|
| void Error::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| - JSONObject jsobj(stream);
|
| - jsobj.AddProperty("type", JSONType(false));
|
| - jsobj.AddProperty("error_msg", ToErrorCString());
|
| + UNREACHABLE();
|
| }
|
|
|
|
|
| @@ -11490,8 +11488,10 @@ const char* ApiError::ToCString() const {
|
|
|
| void ApiError::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - jsobj.AddProperty("type", JSONType(false));
|
| - jsobj.AddProperty("error_msg", ToErrorCString());
|
| + jsobj.AddProperty("type", "Error");
|
| + jsobj.AddProperty("id", "");
|
| + jsobj.AddProperty("kind", JSONType(false));
|
| + jsobj.AddProperty("message", ToErrorCString());
|
| }
|
|
|
|
|
| @@ -11676,8 +11676,10 @@ const char* LanguageError::ToCString() const {
|
|
|
| void LanguageError::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - jsobj.AddProperty("type", JSONType(false));
|
| - jsobj.AddProperty("error_msg", ToErrorCString());
|
| + jsobj.AddProperty("type", "Error");
|
| + jsobj.AddProperty("id", "");
|
| + jsobj.AddProperty("kind", JSONType(false));
|
| + jsobj.AddProperty("message", ToErrorCString());
|
| }
|
|
|
|
|
| @@ -11749,11 +11751,20 @@ const char* UnhandledException::ToCString() const {
|
| }
|
|
|
|
|
| +
|
| void UnhandledException::PrintToJSONStream(JSONStream* stream,
|
| bool ref) const {
|
| JSONObject jsobj(stream);
|
| - jsobj.AddProperty("type", JSONType(false));
|
| - jsobj.AddProperty("error_msg", ToErrorCString());
|
| + jsobj.AddProperty("type", "Error");
|
| + jsobj.AddProperty("id", "");
|
| + jsobj.AddProperty("kind", JSONType(false));
|
| + jsobj.AddProperty("message", ToErrorCString());
|
| +
|
| + Instance& instance = Instance::Handle();
|
| + instance = exception();
|
| + jsobj.AddProperty("exception", instance);
|
| + instance = stacktrace();
|
| + jsobj.AddProperty("stacktrace", instance);
|
| }
|
|
|
|
|
| @@ -11790,8 +11801,10 @@ const char* UnwindError::ToCString() const {
|
|
|
| void UnwindError::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| - jsobj.AddProperty("type", JSONType(false));
|
| - jsobj.AddProperty("error_msg", ToErrorCString());
|
| + jsobj.AddProperty("type", "Error");
|
| + jsobj.AddProperty("id", "");
|
| + jsobj.AddProperty("kind", JSONType(false));
|
| + jsobj.AddProperty("message", ToErrorCString());
|
| }
|
|
|
|
|
| @@ -12179,20 +12192,22 @@ const char* Instance::ToUserCString(intptr_t max_len, intptr_t nesting) const {
|
| void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| Class& cls = Class::Handle(this->clazz());
|
| - jsobj.AddProperty("preview", ToUserCString(40));
|
|
|
| // TODO(turnidge): Handle <optimized out> like other null-like values.
|
| if (IsNull()) {
|
| jsobj.AddProperty("type", ref ? "@Null" : "Null");
|
| jsobj.AddProperty("id", "objects/null");
|
| + jsobj.AddProperty("preview", "null");
|
| return;
|
| } else if (raw() == Object::sentinel().raw()) {
|
| jsobj.AddProperty("type", ref ? "@Null" : "Null");
|
| jsobj.AddProperty("id", "objects/not-initialized");
|
| + jsobj.AddProperty("preview", "<not initialized>");
|
| return;
|
| } else if (raw() == Object::transition_sentinel().raw()) {
|
| jsobj.AddProperty("type", ref ? "@Null" : "Null");
|
| jsobj.AddProperty("id", "objects/being-initialized");
|
| + jsobj.AddProperty("preview", "<being initialized>");
|
| return;
|
| } else if (raw() == Symbols::OptimizedOut().raw()) {
|
| // TODO(turnidge): This is a hack. The user could have this
|
| @@ -12214,6 +12229,7 @@ void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| }
|
| jsobj.AddPropertyF("id", "objects/%" Pd "", id);
|
| jsobj.AddProperty("class", cls);
|
| + jsobj.AddProperty("preview", ToUserCString(40));
|
| }
|
| if (ref) {
|
| return;
|
| @@ -12240,6 +12256,18 @@ void Instance::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| cls = cls.SuperClass();
|
| }
|
| }
|
| +
|
| + if (NumNativeFields() > 0) {
|
| + JSONArray jsarr(&jsobj, "nativeFields");
|
| + for (intptr_t i = 0; i < NumNativeFields(); i++) {
|
| + intptr_t value = GetNativeField(i);
|
| + JSONObject jsfield(&jsarr);
|
| + jsfield.AddProperty("index", i);
|
| + jsfield.AddProperty("value", value);
|
| + }
|
| + }
|
| +
|
| + jsobj.AddProperty("size", raw()->Size());
|
| }
|
|
|
|
|
| @@ -14238,7 +14266,7 @@ const char* Smi::ToCString() const {
|
| void Smi::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| JSONObject jsobj(stream);
|
| jsobj.AddProperty("type", JSONType(ref));
|
| - jsobj.AddPropertyF("id", "objects/int/%" Pd "", Value());
|
| + jsobj.AddPropertyF("id", "objects/int-%" Pd "", Value());
|
| class Class& cls = Class::Handle(this->clazz());
|
| jsobj.AddProperty("class", cls);
|
| jsobj.AddPropertyF("preview", "%" Pd "", Value());
|
| @@ -16278,7 +16306,7 @@ void Bool::PrintToJSONStream(JSONStream* stream, bool ref) const {
|
| const char* str = ToCString();
|
| JSONObject jsobj(stream);
|
| jsobj.AddProperty("type", JSONType(ref));
|
| - jsobj.AddPropertyF("id", "objects/bool/%s", str);
|
| + jsobj.AddPropertyF("id", "objects/bool-%s", str);
|
| class Class& cls = Class::Handle(this->clazz());
|
| jsobj.AddProperty("class", cls);
|
| jsobj.AddPropertyF("preview", "%s", str);
|
|
|