diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2020-06-02 14:43:29 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2020-06-27 15:34:51 +0100 |
commit | 7c88e76a76588fa0e3ab645adfc46e8baff6a3e4 (patch) | |
tree | d59e1ad178deaaeed7906b962b6c56b878bd5f03 /src/target/target.c | |
parent | 64733434e23d42bfd75932c1e71c39800a5c01e4 (diff) | |
download | riscv-openocd-7c88e76a76588fa0e3ab645adfc46e8baff6a3e4.zip riscv-openocd-7c88e76a76588fa0e3ab645adfc46e8baff6a3e4.tar.gz riscv-openocd-7c88e76a76588fa0e3ab645adfc46e8baff6a3e4.tar.bz2 |
target: do not print an error on shutdown in target events
Before commit b3ce5a0ae545 ("target: use LOG_USER to print errors
in events") an error in an event handler was silently lost, while
now the associated message is printed out.
A "shutdown" command in a target event (e.g. in gdb-detach) causes
the event to end with error code ERROR_COMMAND_CLOSE_CONNECTION,
that triggers the error message:
shutdown command invoked
Error executing event <event-name> on target <target-name>:
The error code returned by the command "shutdown" is required to
stop the execution in a script/proc and avoid executing any
further command in the script/proc.
It is then normal to get an error code from the "shutdown" command
and it should not be printed out.
Intercept the return code of the event in case of "shutdown", then
skip scheduling other target events and return without printing
the incorrect error message.
Change-Id: Ia3085fb46beacb90a5e4bf0abf7c6e28bb9e6a9b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Laurent Lemele <laurent.lemele@st.com>
Reviewed-on: http://openocd.zylin.com/5710
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Diffstat (limited to 'src/target/target.c')
-rw-r--r-- | src/target/target.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/target/target.c b/src/target/target.c index c0953a3..2ea1e20 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -4582,8 +4582,14 @@ void target_handle_event(struct target *target, enum target_event e) struct command_context *cmd_ctx = current_command_context(teap->interp); struct target *saved_target_override = cmd_ctx->current_target_override; cmd_ctx->current_target_override = target; + retval = Jim_EvalObj(teap->interp, teap->body); + cmd_ctx->current_target_override = saved_target_override; + + if (retval == ERROR_COMMAND_CLOSE_CONNECTION) + return; + if (retval == JIM_RETURN) retval = teap->interp->returnCode; @@ -4596,8 +4602,6 @@ void target_handle_event(struct target *target, enum target_event e) /* clean both error code and stacktrace before return */ Jim_Eval(teap->interp, "error \"\" \"\""); } - - cmd_ctx->current_target_override = saved_target_override; } } } |