diff --git a/jerry-core/debugger/debugger.c b/jerry-core/debugger/debugger.c index bc4c5b9532..06e7c58eac 100644 --- a/jerry-core/debugger/debugger.c +++ b/jerry-core/debugger/debugger.c @@ -30,6 +30,15 @@ #include #endif /* HAVE_TIME_H */ +/** + * The number of message types in the debugger should reflect the + * debugger versioning. + */ +JERRY_STATIC_ASSERT (JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT == 26 + && JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT == 16 + && JERRY_DEBUGGER_VERSION == 1, + debugger_version_correlates_to_message_type_count); + /** * Type cast the debugger send buffer into a specific type. */ @@ -707,6 +716,7 @@ jerry_debugger_send_configuration (uint8_t max_message_size) /**< maximum messag configuration_p->max_message_size = max_message_size; configuration_p->cpointer_size = sizeof (jmem_cpointer_t); configuration_p->little_endian = (endian_data.uint8_value[0] == 1); + configuration_p->version = JERRY_DEBUGGER_VERSION; return jerry_debugger_send (sizeof (jerry_debugger_send_configuration_t)); } /* jerry_debugger_send_configuration */ diff --git a/jerry-core/debugger/debugger.h b/jerry-core/debugger/debugger.h index e4039405e3..404964b9df 100644 --- a/jerry-core/debugger/debugger.h +++ b/jerry-core/debugger/debugger.h @@ -23,6 +23,11 @@ /* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */ +/** + * JerryScript debugger protocol version. + */ +#define JERRY_DEBUGGER_VERSION (1) + /** * Frequency of calling jerry_debugger_receive() by the VM. */ @@ -125,6 +130,8 @@ typedef enum JERRY_DEBUGGER_OUTPUT_RESULT = 24, /**< output sent by the program to the debugger */ JERRY_DEBUGGER_OUTPUT_RESULT_END = 25, /**< last output result data */ + JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT, /**< number of different type of output messages by the debugger */ + /* Messages sent by the client to server. */ /* The following messages are accepted in both run and breakpoint modes. */ @@ -147,6 +154,8 @@ typedef enum JERRY_DEBUGGER_GET_BACKTRACE = 13, /**< get backtrace */ JERRY_DEBUGGER_EVAL = 14, /**< first message of evaluating a string */ JERRY_DEBUGGER_EVAL_PART = 15, /**< next message of evaluating a string */ + + JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT, /**< number of different type of input messages */ } jerry_debugger_header_type_t; /** @@ -189,6 +198,7 @@ typedef struct uint8_t max_message_size; /**< maximum incoming message size */ uint8_t cpointer_size; /**< size of compressed pointers */ uint8_t little_endian; /**< little endian machine */ + uint8_t version; /**< debugger version */ } jerry_debugger_send_configuration_t; /** diff --git a/jerry-debugger/jerry-client-ws.html b/jerry-debugger/jerry-client-ws.html index b2d7548670..f4fe9a87ad 100644 --- a/jerry-debugger/jerry-client-ws.html +++ b/jerry-debugger/jerry-client-ws.html @@ -35,6 +35,9 @@

JerryScript HTML (WebSocket) Debugger Client