diff options
author | Imre Kiss <kissi@inf.u-szeged.hu> | 2017-08-03 14:29:47 +0200 |
---|---|---|
committer | Zoltan Herczeg <zherczeg.u-szeged@partner.samsung.com> | 2017-08-03 14:29:47 +0200 |
commit | 3e3d6373b8be850fceb763181b1c57fffc6d5793 (patch) | |
tree | a58ddee7e18a590b801f2773cd12a8380a26beb1 /jerry-main | |
parent | a3885be6ce3e11b6e03b3fcb59894fff6590a7bb (diff) |
Add source sending feature to the debugger. (#1932)
With this feature the debugger webIDE and the python client can able to send a source code to the debugger while that is running in wait mode.
This feature can be activated with the --debugger-wait-source switch and the debugger will wait for the source messages.
If every message part are received the debugger will continue the exectuion with the initalized options.
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 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c index bfb8f634..2f749964 100644 --- a/jerry-main/main-unix.c +++ b/jerry-main/main-unix.c @@ -281,6 +281,7 @@ typedef enum OPT_SHOW_RE_OP, OPT_DEBUG_SERVER, OPT_DEBUG_PORT, + OPT_DEBUGGER_WAIT_SOURCE, OPT_SAVE_SNAP_GLOBAL, OPT_SAVE_SNAP_EVAL, OPT_SAVE_LIT_LIST, @@ -312,6 +313,8 @@ static const cli_opt_t main_opts[] = .help = "start debug server and wait for a connecting client"), CLI_OPT_DEF (.id = OPT_DEBUG_PORT, .longopt = "debug-port", .meta = "NUM", .help = "debug server port (default: 5001)"), + CLI_OPT_DEF (.id = OPT_DEBUGGER_WAIT_SOURCE, .longopt = "debugger-wait-source", + .help = "wait for an executable source from the client"), CLI_OPT_DEF (.id = OPT_SAVE_SNAP_GLOBAL, .longopt = "save-snapshot-for-global", .meta = "FILE", .help = "save binary snapshot of parsed JS input (for execution in global context)"), CLI_OPT_DEF (.id = OPT_SAVE_SNAP_EVAL, .longopt = "save-snapshot-for-eval", .meta = "FILE", @@ -407,6 +410,7 @@ main (int argc, uint16_t debug_port = 5001; bool is_repl_mode = false; + bool is_wait_mode = false; bool no_prompt = false; cli_state_t cli_state = cli_init (main_opts, argc - 1, argv + 1); @@ -472,6 +476,14 @@ main (int argc, } break; } + case OPT_DEBUGGER_WAIT_SOURCE: + { + if (check_feature (JERRY_FEATURE_DEBUGGER, cli_state.arg)) + { + is_wait_mode = true; + } + break; + } case OPT_SAVE_SNAP_GLOBAL: case OPT_SAVE_SNAP_EVAL: { @@ -707,6 +719,21 @@ main (int argc, } } + if (is_wait_mode) + { + is_repl_mode = false; +#ifdef JERRY_DEBUGGER + jerry_value_t wait_and_run_value; + + if (jerry_debugger_wait_and_run_client_source (&wait_and_run_value) == JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED) + { + ret_value = jerry_create_error (JERRY_ERROR_COMMON, (jerry_char_t *) "Connection aborted before source arrived."); + } + + jerry_release_value (wait_and_run_value); +#endif /* JERRY_DEBUGGER */ + } + if (is_repl_mode) { const char *prompt = !no_prompt ? "jerry> " : ""; |