diff options
author | Imre Kiss <kissi.szeged@partner.samsung.com> | 2017-09-08 09:52:09 +0200 |
---|---|---|
committer | yichoi <duddlf.choi@samsung.com> | 2017-09-13 18:12:44 +0900 |
commit | 77ccdcc585fb978ffb16f243cce14594b66b83b0 (patch) | |
tree | b43c8085a4446022aba05ff74af9b90bd8ad0b95 /jerry-main | |
parent | 04bccea6a6522e5420bab2130ab74558c3cdc7a3 (diff) |
Add context reset to the debugger.
- The context reset request message can be sent anytime from a client.
- After the message received the engine will call the cleanup and init
when in the source waiting mode (which means the currently processed file will be executed).
- After the reinitialization is done, the engine will wait
for a new client connection(rest of the work is the client's responsibility).
JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
Diffstat (limited to 'jerry-main')
-rw-r--r-- | jerry-main/main-unix.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c index c7afe1b1..9b998a02 100644 --- a/jerry-main/main-unix.c +++ b/jerry-main/main-unix.c @@ -728,22 +728,40 @@ main (int argc, do { - receive_status = jerry_debugger_wait_and_run_client_source (&run_result); - - if (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED) + do { - ret_value = jerry_create_error (JERRY_ERROR_COMMON, - (jerry_char_t *) "Connection aborted before source arrived."); + receive_status = jerry_debugger_wait_and_run_client_source (&run_result); + + if (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED) + { + ret_value = jerry_create_error (JERRY_ERROR_COMMON, + (jerry_char_t *) "Connection aborted before source arrived."); + } + + if (receive_status == JERRY_DEBUGGER_SOURCE_END) + { + jerry_port_log (JERRY_LOG_LEVEL_DEBUG, "No more client source.\n"); + } + + jerry_release_value (run_result); } + while (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVED); - if (receive_status == JERRY_DEBUGGER_SOURCE_END) + if (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED) { - jerry_port_log (JERRY_LOG_LEVEL_DEBUG, "No more client source.\n"); - } + jerry_cleanup (); - jerry_release_value (run_result); + jerry_init (flags); + jerry_debugger_init (debug_port); + + register_js_function ("assert", jerryx_handler_assert); + register_js_function ("gc", jerryx_handler_gc); + register_js_function ("print", jerryx_handler_print); + + ret_value = jerry_create_undefined (); + } } - while (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVED); + while (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED); #endif /* JERRY_DEBUGGER */ } |