Esempio n. 1
0
/* Capture progress output and return as tcl return value. If the
 * progress output was empty, return tcl return value.
 */
static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
	if (argc != 2)
		return JIM_ERR;

	struct log_capture_state *state = command_log_capture_start(interp);

	/* disable polling during capture. This avoids capturing output
	 * from polling.
	 *
	 * This is necessary in order to avoid accidentally getting a non-empty
	 * string for tcl fn's.
	 */
	bool save_poll = jtag_poll_get_enabled();

	jtag_poll_set_enabled(false);

	const char *str = Jim_GetString(argv[1], NULL);
	int retcode = Jim_Eval_Named(interp, str, __THIS__FILE__, __LINE__);

	jtag_poll_set_enabled(save_poll);

	command_log_capture_finish(state);

	return retcode;
}
Esempio n. 2
0
static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    if (argc != 2)
        return JIM_ERR;

    struct log_capture_state *state = command_log_capture_start(interp);

    const char *str = Jim_GetString(argv[1], NULL);
    int retcode = Jim_Eval_Named(interp, str, __THIS__FILE__, __LINE__);

    command_log_capture_finish(state);

    return retcode;
}
Esempio n. 3
0
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;
	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);
}