target: Do not use LOG_USER() for error messages

Use LOG_TARGET_ERROR() to print the error messages and additionally add
a reference to the related target.

Change-Id: I06722f3911ef4034fdd05dc9b0e2571b01b657a4
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8314
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
This commit is contained in:
Marc Schink 2024-06-02 14:39:36 +01:00 committed by Tomas Vanek
parent 4892e32294
commit c5358c84ad
1 changed files with 3 additions and 4 deletions

View File

@ -2997,14 +2997,14 @@ static int handle_target(void *priv)
target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT);
}
if (target->backoff.times > 0) {
LOG_USER("Polling target %s failed, trying to reexamine", target_name(target));
LOG_TARGET_ERROR(target, "Polling failed, trying to reexamine");
target_reset_examined(target);
retval = target_examine_one(target);
/* Target examination could have failed due to unstable connection,
* but we set the examined flag anyway to repoll it later */
if (retval != ERROR_OK) {
target_set_examined(target);
LOG_USER("Examination failed, GDB will be halted. Polling again in %dms",
LOG_TARGET_ERROR(target, "Examination failed, GDB will be halted. Polling again in %dms",
target->backoff.times * polling_interval);
return retval;
}
@ -4691,9 +4691,8 @@ void target_handle_event(struct target *target, enum target_event e)
if (retval != JIM_OK) {
Jim_MakeErrorMessage(teap->interp);
LOG_USER("Error executing event %s on target %s:\n%s",
LOG_TARGET_ERROR(target, "Execution of event %s failed:\n%s",
target_event_name(e),
target_name(target),
Jim_GetString(Jim_GetResult(teap->interp), NULL));
/* clean both error code and stacktrace before return */
Jim_Eval(teap->interp, "error \"\" \"\"");