Reworking jerry_debugger_send_string method

From now on, jerry_debugger_send_string can send a subtype of the string, making it more simple to send over strings with special parameters, therefore seperating different types of messages are simpler.
Enumerations for various subtypes can be made, while there's only need to have 2 entries for the header type.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
Daniel Balla
2017-08-07 10:33:50 +02:00
committed by yichoi
parent ad608e30dc
commit a48f24f8da
7 changed files with 60 additions and 24 deletions
+15 -3
View File
@@ -33,6 +33,11 @@
*/
#define JERRY_DEBUGGER_TIMEOUT 100
/**
* This constant represents that the string to be sent has no subtype.
*/
#define JERRY_DEBUGGER_NO_SUBTYPE 0
/**
* Limited resources available for the engine, so it is important to
* check the maximum buffer size. It needs to be between 64 and 256 bytes.
@@ -114,8 +119,6 @@ typedef enum
JERRY_DEBUGGER_BACKTRACE_END = 20, /**< last backtrace data */
JERRY_DEBUGGER_EVAL_RESULT = 21, /**< eval result */
JERRY_DEBUGGER_EVAL_RESULT_END = 22, /**< last part of eval result */
JERRY_DEBUGGER_EVAL_ERROR = 23, /**< eval result when an error is occured */
JERRY_DEBUGGER_EVAL_ERROR_END = 24, /**< last part of eval result when an error is occured */
/* Messages sent by the client to server. */
@@ -139,6 +142,15 @@ typedef enum
JERRY_DEBUGGER_EVAL_PART = 13, /**< next message of evaluating a string */
} jerry_debugger_header_type_t;
/**
* Subtypes of send_eval.
*/
typedef enum
{
JERRY_DEBUGGER_EVAL_OK = 1, /**< eval result, no error */
JERRY_DEBUGGER_EVAL_ERROR = 2, /**< eval result when an error is occured */
} jerry_debugger_eval_subtype_t;
/**
* Delayed free of byte code data.
*/
@@ -318,7 +330,7 @@ void jerry_debugger_breakpoint_hit (uint8_t message_type);
void jerry_debugger_send_type (jerry_debugger_header_type_t type);
bool jerry_debugger_send_configuration (uint8_t max_message_size);
void jerry_debugger_send_data (jerry_debugger_header_type_t type, const void *data, size_t size);
bool jerry_debugger_send_string (uint8_t message_type, const uint8_t *string_p, size_t string_length);
bool jerry_debugger_send_string (uint8_t message_type, uint8_t sub_type, const uint8_t *string_p, size_t string_length);
bool jerry_debugger_send_function_cp (jerry_debugger_header_type_t type, ecma_compiled_code_t *compiled_code_p);
bool jerry_debugger_send_parse_function (uint32_t line, uint32_t column);
void jerry_debugger_send_memstats (void);