-static int script_command_run(Jim_Interp *interp,
- int argc, Jim_Obj *const *argv, struct command *c, bool capture)
-{
- target_call_timer_callbacks_now();
- LOG_USER_N("%s", ""); /* Keep GDB connection alive*/
-
- unsigned nwords;
- const char **words = script_command_args_alloc(argc, argv, &nwords);
- if (NULL == words)
- return JIM_ERR;
-
- struct log_capture_state *state = NULL;
- if (capture)
- state = command_log_capture_start(interp);
-
- struct command_context *cmd_ctx = current_command_context(interp);
- int retval = run_command(cmd_ctx, c, (const char **)words, nwords);
-
- command_log_capture_finish(state);
-
- script_command_args_free(words, nwords);
- return command_retval_set(interp, retval);
-}
-
-static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- /* the private data is stashed in the interp structure */
-
- struct command *c = interp->cmdPrivData;
- assert(c);
- script_debug(interp, c->name, argc, argv);
- return script_command_run(interp, argc, argv, c, true);
-}
-
-static struct command *command_root(struct command *c)
-{
- while (NULL != c->parent)
- c = c->parent;
- return c;
-}
-