diff --git a/tooling/base/pt_types.cpp b/tooling/base/pt_types.cpp index 2d80a02681a03c7f6c3a75993f42fc70dd501668..c92e03f2bd2899b995d12c96f942c3f41ccfcb96 100644 --- a/tooling/base/pt_types.cpp +++ b/tooling/base/pt_types.cpp @@ -250,6 +250,16 @@ void RemoteObject::AppendingHashToDescription(const EcmaVM *ecmaVM, Local tagged) +{ + std::string description = RemoteObject::ObjectDescription; + if (!tagged->IsObject()) { + return description; + } + DebuggerApi::GetObjectClassName(ecmaVM, tagged, description); + return description.empty() ? RemoteObject::ObjectDescription : description; +} + PrimitiveRemoteObject::PrimitiveRemoteObject(const EcmaVM *ecmaVm, Local tagged) { if (tagged->IsNull()) { @@ -493,7 +503,7 @@ std::string ObjectRemoteObject::DescriptionForObject(const EcmaVM *ecmaVm, Local if (tagged->IsNativePointer()) { return DescriptionForNativePointer(Local(tagged)); } - return RemoteObject::ObjectDescription; + return ResolveClassNameToDescription(ecmaVm, tagged); } std::string ObjectRemoteObject::DescriptionForNativePointer(const Local &tagged) diff --git a/tooling/base/pt_types.h b/tooling/base/pt_types.h index 8fb8b40eae0b47a2998d7a54b762a69ead721fdd..e64874433dd92ed1c7dd3225abc888b6619f7034 100644 --- a/tooling/base/pt_types.h +++ b/tooling/base/pt_types.h @@ -256,6 +256,7 @@ public: std::unique_ptr ToJson() const override; static void AppendingHashToDescription(const EcmaVM *ecmaVM, Local tagged, std::string &description); + static std::string ResolveClassNameToDescription(const EcmaVM *ecmaVM, Local tagged); /* * @see {#ObjectType} */ diff --git a/tooling/test/testcases/js_module_variable_test.h b/tooling/test/testcases/js_module_variable_test.h index 13383f8b6113c3d1f5152294553dd37d5cb88007..7111b3a263d30ad6e22e5e397e730120a289cd80 100644 --- a/tooling/test/testcases/js_module_variable_test.h +++ b/tooling/test/testcases/js_module_variable_test.h @@ -501,27 +501,27 @@ private: "\"value\":{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":\"Uint8Array(24)\"," "\"description\":\"Uint8Array(24)\",\"objectId\":\"102\"},\"writable\":true,\"configurable\":true," "\"enumerable\":false,\"isOwn\":true},{\"name\":\"[[Uint8ClampedArray]]\",\"value\":{\"type\":\"object\"," - "\"className\":\"Object\",\"unserializableValue\":\"Object\",\"description\":\"Object\",\"objectId\":\"103\"}," + "\"className\":\"Object\",\"unserializableValue\":\"Uint8ClampedArray\",\"description\":\"Uint8ClampedArray\",\"objectId\":\"103\"}," "\"writable\":true,\"configurable\":true,\"enumerable\":false,\"isOwn\":true},{\"name\":\"[[Int16Array]]\"," "\"value\":{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":\"Int16Array(12)\"," "\"description\":\"Int16Array(12)\",\"objectId\":\"104\"},\"writable\":true,\"configurable\":true," "\"enumerable\":false,\"isOwn\":true},{\"name\":\"[[Uint16Array]]\",\"value\":{\"type\":\"object\"," - "\"className\":\"Object\",\"unserializableValue\":\"Object\",\"description\":\"Object\",\"objectId\":" + "\"className\":\"Object\",\"unserializableValue\":\"Uint16Array\",\"description\":\"Uint16Array\",\"objectId\":" "\"105\"},\"writable\":true,\"configurable\":true,\"enumerable\":false,\"isOwn\":true},{\"name\":" "\"[[Int32Array]]\",\"value\":{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":" "\"Int32Array(6)\",\"description\":\"Int32Array(6)\",\"objectId\":\"106\"},\"writable\":true,\"configurable\":" "true,\"enumerable\":false,\"isOwn\":true},{\"name\":\"[[Uint32Array]]\",\"value\":{\"type\":\"object\"," - "\"className\":\"Object\",\"unserializableValue\":\"Object\",\"description\":\"Object\",\"objectId\":\"107\"}," + "\"className\":\"Object\",\"unserializableValue\":\"Uint32Array\",\"description\":\"Uint32Array\",\"objectId\":\"107\"}," "\"writable\":true,\"configurable\":true,\"enumerable\":false,\"isOwn\":true},{\"name\":\"[[Float32Array]]\"," - "\"value\":{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":\"Object\",\"description\":" - "\"Object\",\"objectId\":\"108\"},\"writable\":true,\"configurable\":true,\"enumerable\":false,\"isOwn\":true}," + "\"value\":{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":\"Float32Array\",\"description\":" + "\"Float32Array\",\"objectId\":\"108\"},\"writable\":true,\"configurable\":true,\"enumerable\":false,\"isOwn\":true}," "{\"name\":\"[[Float64Array]]\",\"value\":{\"type\":\"object\",\"className\":\"Object\"," - "\"unserializableValue\":\"Object\",\"description\":\"Object\",\"objectId\":\"109\"},\"writable\":true," + "\"unserializableValue\":\"Float64Array\",\"description\":\"Float64Array\",\"objectId\":\"109\"},\"writable\":true," "\"configurable\":true,\"enumerable\":false,\"isOwn\":true},{\"name\":\"[[BigInt64Array]]\",\"value\":" - "{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":\"Object\",\"description\":\"Object\"," + "{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":\"BigInt64Array\",\"description\":\"BigInt64Array\"," "\"objectId\":\"110\"},\"writable\":true,\"configurable\":true,\"enumerable\":false,\"isOwn\":true},{\"name\":" "\"[[BigUint64Array]]\",\"value\":{\"type\":\"object\",\"className\":\"Object\",\"unserializableValue\":" - "\"Object\",\"description\":\"Object\",\"objectId\":\"111\"},\"writable\":true,\"configurable\":true," + "\"BigUint64Array\",\"description\":\"BigUint64Array\",\"objectId\":\"111\"},\"writable\":true,\"configurable\":true," "\"enumerable\":false,\"isOwn\":true}]}}", "{\"id\":13,\"result\":{\"result\":[{\"name\":\"[[PrimitiveValue]]\",\"value\":{\"type\":\"boolean\"," diff --git a/tooling/test/testcases/js_variable_first_test.h b/tooling/test/testcases/js_variable_first_test.h index 7e5f0e3da212aba0a864bfc15ea6175433c66690..acf14e7f730c31b59fa94bd2ea9c3f6359babef9 100644 --- a/tooling/test/testcases/js_variable_first_test.h +++ b/tooling/test/testcases/js_variable_first_test.h @@ -223,15 +223,15 @@ private: "[[Int8Array]]", "object", "Object", "Int8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint8Array]]", "object", "Object", "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8ClampedArray]]", "object", "Object", "Object", + "[[Uint8ClampedArray]]", "object", "Object", "Uint8ClampedArray", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int16Array]]", "object", "Object", "Int16Array(12)", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint16Array]]", "object", - "Object", "Object", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Object", - "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Object", "0,0,0,0,0,0", - "[[Float64Array]]", "object", "Object", "Object", "0,0,0", "[[BigInt64Array]]", - "object", "Object", "Object", "0,0,0", "[[BigUint64Array]]", "object", "Object", - "Object", "0,0,0" } }, + "Object", "Uint16Array", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", + "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Uint32Array", + "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Float32Array", "0,0,0,0,0,0", + "[[Float64Array]]", "object", "Object", "Float64Array", "0,0,0", "[[BigInt64Array]]", + "object", "Object", "BigInt64Array", "0,0,0", "[[BigUint64Array]]", "object", "Object", + "BigUint64Array", "0,0,0" } }, { "function0", { "function", "Function", "function function0( { [js code] }", "Cannot get source code of funtion" } }, { "generator0", { "function", "Generator", "function* generator0( { [js code] }", @@ -620,7 +620,7 @@ private: { "object9", { "object", "Object", "Object", "[object Object]", "none" } }, { "object10", { "object", "array", "Array", "Array(2)", "Apple,Banana", "0", "string", "Apple", "Apple", "1", "string", "Banana", "Banana", "length", "number", "2", "2" } }, - { "object11", { "object", "Object", "Object", "8998192055486250009", "none" } }, + { "object11", { "object", "Object", "BigInt", "8998192055486250009", "none" } }, { "object12", { "function", "Generator", "function* generator0( { [js code] }", "Cannot get source code of funtion" } }, { "object13", { "object", "regexp", "RegExp", "/^\\d+\\.\\d+$/i", "/^\\d+\\.\\d+$/i", "global", "boolean", @@ -629,20 +629,20 @@ private: "unicode", "boolean", "false", "false", "sticky", "boolean", "false", "false", "flags", "string", "i", "i", "source", "string", "^\\d+\\.\\d+$", "^\\d+\\.\\d+$", "lastIndex", "number", "0", "0" } }, - { "object14", { "object", "Object", "Object", "999", "none" } }, + { "object14", { "object", "Object", "BigInt", "999", "none" } }, { "object15", { "object", "arraybuffer", "Arraybuffer", "ArrayBuffer(24)", "[object ArrayBuffer]", "[[Int8Array]]", "object", "Object", "Int8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint8Array]]", "object", "Object", "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8ClampedArray]]", "object", "Object", "Object", + "[[Uint8ClampedArray]]", "object", "Object", "Uint8ClampedArray", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int16Array]]", "object", "Object", "Int16Array(12)", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint16Array]]", "object", "Object", - "Object", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Object", - "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Object", "0,0,0,0,0,0", - "[[Float64Array]]", "object", "Object", "Object", "0,0,0", "[[BigInt64Array]]", "object", - "Object", "Object", "0,0,0", "[[BigUint64Array]]", - "object", "Object", "Object", "0,0,0" } }, + "Uint16Array", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", + "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Uint32Array", + "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Float32Array", "0,0,0,0,0,0", + "[[Float64Array]]", "object", "Object", "Float64Array", "0,0,0", "[[BigInt64Array]]", "object", + "Object", "BigInt64Array", "0,0,0", "[[BigUint64Array]]", + "object", "Object", "BigUint64Array", "0,0,0" } }, { "object16", { "object", "Object", "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "0", "number", "0", "0", "1", "number", "0", "0", "2", "number", "0", "0", "3", "number", "0", "0", "4", "number", "0", "0", "5", "number", "0", "0", "6", "number", "0", "0", "7", diff --git a/tooling/test/testcases/js_variable_second_test.h b/tooling/test/testcases/js_variable_second_test.h index d5835b1129f60ebc2b99fc82e4d4f31f8c4afa6d..71ae7e6dfce1b0effb540b6d59a130ae39c6b114 100644 --- a/tooling/test/testcases/js_variable_second_test.h +++ b/tooling/test/testcases/js_variable_second_test.h @@ -223,15 +223,15 @@ private: "[[Int8Array]]", "object", "Object", "Int8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint8Array]]", "object", "Object", "Uint8Array(24)", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", - "[[Uint8ClampedArray]]", "object", "Object", "Object", + "[[Uint8ClampedArray]]", "object", "Object", "Uint8ClampedArray", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", "[[Int16Array]]", "object", "Object", "Int16Array(12)", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Uint16Array]]", "object", - "Object", "Object", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", - "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Object", - "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Object", "0,0,0,0,0,0", - "[[Float64Array]]", "object", "Object", "Object", "0,0,0", "[[BigInt64Array]]", - "object", "Object", "Object", "0,0,0", "[[BigUint64Array]]", "object", "Object", - "Object", "0,0,0" } }, + "Object", "Uint16Array", "0,0,0,0,0,0,0,0,0,0,0,0", "[[Int32Array]]", "object", "Object", + "Int32Array(6)", "0,0,0,0,0,0", "[[Uint32Array]]", "object", "Object", "Uint32Array", + "0,0,0,0,0,0", "[[Float32Array]]", "object", "Object", "Float32Array", "0,0,0,0,0,0", + "[[Float64Array]]", "object", "Object", "Float64Array", "0,0,0", "[[BigInt64Array]]", + "object", "Object", "BigInt64Array", "0,0,0", "[[BigUint64Array]]", "object", "Object", + "BigUint64Array", "0,0,0" } }, { "function0", { "function", "Function", "function function0( { [js code] }", "Cannot get source code of funtion" } }, { "generator0", { "function", "Generator", "function* generator0( { [js code] }", @@ -324,15 +324,15 @@ private: "number", "3", "3" } }, { "array21", { "string", "banana", "banana" } }, { "typedarray1", { "object", "Object", "Int8Array(0)", "", "none" } }, - { "typedarray2", { "object", "Object", "Object", "", "none" } }, + { "typedarray2", { "object", "Object", "Uint8ClampedArray", "", "none" } }, { "typedarray3", { "object", "Object", "Int16Array(0)", "", "none" } }, - { "typedarray4", { "object", "Object", "Object", "", "none" } }, + { "typedarray4", { "object", "Object", "Uint16Array", "", "none" } }, { "typedarray5", { "object", "Object", "Int32Array(0)", "", "none" } }, - { "typedarray6", { "object", "Object", "Object", "", "none" } }, - { "typedarray7", { "object", "Object", "Object", "", "none" } }, - { "typedarray8", { "object", "Object", "Object", "", "none" } }, - { "typedarray9", { "object", "Object", "Object", "", "none" } }, - { "typedarray10", { "object", "Object", "Object", "", "none" } }, + { "typedarray6", { "object", "Object", "Uint32Array", "", "none" } }, + { "typedarray7", { "object", "Object", "Float32Array", "", "none" } }, + { "typedarray8", { "object", "Object", "Float64Array", "", "none" } }, + { "typedarray9", { "object", "Object", "BigInt64Array", "", "none" } }, + { "typedarray10", { "object", "Object", "BigUint64Array", "", "none" } }, { "typedarray11", { "object", "Object", "Uint8Array(1)", "0", "0", "number", "0", "0" } }, { "iterator1", { "function", "Function", "function values( { [native code] }", "function values() { [native code] }" } },