Add version fields for debugger configuration

By adding version information to the debugger protocol
it is possible to report if the debugger client and server
have different expectations on debugger workings (opcodes, types, etc.).

JerryScript-DCO-1.0-Signed-off-by: Peter Gal [email protected]
This commit is contained in:
Peter Gal authored and yichoi committed 2018-01-23 10:17:33 +09:00
1 parent 52a14fa08f
commit 40d05cdca2
4 files changed
+45 -3

No files matched your search

+13 -1
View File
@@ -35,6 +35,9 @@ textarea {
<div>
</div>
<script>
// Expected JerryScript debugger protocol version
var JERRY_DEBUGGER_VERSION = 1;
// Messages sent by the server to client.
var JERRY_DEBUGGER_CONFIGURATION = 1;
var JERRY_DEBUGGER_PARSE_ERROR = 2;
@@ -136,6 +139,7 @@ function DebuggerClient(address)
var outputResult = null;
var exceptionData = null;
var display = 0;
var version = 0;
function assert(expr)
{
@@ -783,7 +787,7 @@ function DebuggerClient(address)
if (cpointerSize == 0)
{
if (message[0] != JERRY_DEBUGGER_CONFIGURATION
|| message.byteLength != 4)
|| message.byteLength != 5)
{
abortConnection("the first message must be configuration.");
}
@@ -792,11 +796,19 @@ function DebuggerClient(address)
cpointerSize = message[2]
littleEndian = (message[3] != 0);
version = message[4];
if (cpointerSize != 2 && cpointerSize != 4)
{
abortConnection("compressed pointer must be 2 or 4 byte long.");
}
if (version != JERRY_DEBUGGER_VERSION)
{
abortConnection("incorrect target debugger version detected: "
+ version + " expected: " + JERRY_DEBUGGER_VERSION);
}
config = false;
return;
}