Author: [email protected]
Date: Thu Jan 15 06:05:23 2009
New Revision: 1083
Modified:
wiki/DebuggerProtocol.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/DebuggerProtocol.wiki
==============================================================================
--- wiki/DebuggerProtocol.wiki (original)
+++ wiki/DebuggerProtocol.wiki Thu Jan 15 06:05:23 2009
@@ -433,27 +433,41 @@
= Response object serialization =
-Some responses contain values as part of the body, e.g. the response to
the evaluate request contains the result of the expression evaluated. For
all values the JSON serialization contains the type of the object.
+Some responses contain objects as part of the body, e.g. the response to
the evaluate request contains the result of the expression evaluated.
+
+All objects exposed through the debugger is assigned an ID called a
handle. This handle is serialized and can be used to identify objects. A
handle has a certain lifetime after which it will no longer refer to the
same object. Currently the lifetime of handles match the processing of a
debug event. For each debug event handles are recycled.
+
+An object can be serialized either as a reference to a given handle or as
a value representation containing the object content.
+
+An object serialized as a reference looks follows this where `<handle>` is
an integer.
+
+{{{
+{"ref":<handle>}
+}}}
+
+For objects serialized as value they all contains the handle and the type
of the object.
{{{
-{ "type" :
<"undefined", "null", "boolean", "number", "string", "object", "function"
or "frame">
+{ "handle" : <handle>,
+ "type" :
<"undefined", "null", "boolean", "number", "string", "object", "function"
or "frame">
}
}}}
For the primitive JavaScript types `undefined` and `null` the type
describes the value fully.
{{{
-{"type":"undefined"}
+{"handle":<handle>,"type":"undefined"}
}}}
{{{
-{"type":"null"}
+{"handle":<handle>,"type":"null"}
}}}
For the rest of the primitive types `boolean`, `number` and `string` the
value is part of the result.
{{{
-{ "type" : <"boolean", "number" or "string">
+{ "handle":<handle>,
+ "type" : <"boolean", "number" or "string">
"value" : <JSON encoded value>
}
}}}
@@ -461,30 +475,32 @@
Boolean value.
{{{
-{"type":"boolean","value":true}
+{"handle":7,"type":"boolean","value":true}
}}}
Number value.
{{{
-{"type":"number","value":42}
+{"handle":8,"type":"number","value":42}
}}}
String value.
{{{
-{"type":"string","value":"a string"}
+{"handle":9,"type":"string","value":"a string"}
}}}
An object is encoded with additional information.
{{{
-{ "type" : "object"
- "cls" : <Class name, ECMA-262 property [[Class]]>
- "ctor" : <JSON encoded value>
- "proto" : <JSON encoded value>
+{ "handle" : <handle>,
+ "type" : "object",
+ "className" : <Class name, ECMA-262 property [[Class]]>,
+ "constructorFunction" : {"ref":<handle>},
+ "protoObject" : {"ref":<handle>},
+ "prototypeObject" : {"ref":<handle>},
"properties" : [ {"name" : <name>,
- "value" : <JSON encoded value>
+ "ref" : <handle>
},
...
]
@@ -492,43 +508,24 @@
}}}
{{{
-{"type":"object","cls":"Object","ctor":{...},"proto":{...},"properties":[{"name":"a","value:1},{"name":"b","value":2}]}
+{"handle":3,"type":"object","className":"Object","constructorFunction":{"ref":4},"protoObject":{"ref":5},"prototypeObject":{"ref":6},"properties":[{"name":"a","ref:7},{"name":"b","ref":8}]}
}}}
An function is encoded as an object but with additional information.
{{{
-{ "type" : "function"
- "cls" : "Function"
- "name" : "function name"
- "source" : <function source>
- "ctor" : <JSON encoded value>
- "proto" : <JSON encoded value>
+{ "handle" : <handle>,
+ "type" : "function",
+ "className" : "Function",
+ "className" : <Class name, ECMA-262 property [[Class]]>,
+ "constructorFunction" : {"ref":<handle>},
+ "protoObject" : {"ref":<handle>},
+ "prototypeObject" : {"ref":<handle>},
+ "name" : "function name",
"properties" : [ {"name" : <name>,
- "value" : <JSON encoded value>
+ "ref" : <handle>
},
...
]
-}
-}}}
-
-Array objects are encoded like objects but the properties are split into
indexed properties and named properties. Also for Arrays the length is
encoded. The `indexedProperties` part does not contain indexes for which
the value is undefined.
-
-{{{
-{ "type" : "object"
- "cls" : "Array"
- "ctor" : <JSON encoded value>
- "proto" : <JSON encoded value>
- ""length" : <length of the array>
- "indexedProperties" : [ {"index" : <index number>,
- "value" : <JSON encoded value>
- },
- ...
- ]
- "namedProperties" : [ {"name" : <name>,
- "value" : <JSON encoded value>
- },
- ...
- ]
}
}}}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---