From c5358c84ad0d3e7497498e0457cec7785f72910a Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Sun, 2 Jun 2024 14:39:36 +0100 Subject: [PATCH] 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 Reviewed-on: https://review.openocd.org/c/openocd/+/8314 Reviewed-by: Tomas Vanek Tested-by: jenkins --- src/target/target.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/target/target.c b/src/target/target.c index 7d4947a6e..1f4817d5c 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -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 \"\" \"\"");