This is an automated email from Gerrit. "Anatoly P <kupokupokup...@gmail.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8167
-- gerrit commit 7db933233444f51f54dbe287181bf88e760c016c Author: Parshintsev Anatoly <anatoly.parshint...@syntacore.com> Date: Fri Jan 19 01:40:10 2024 +0300 target: add warning if memory read/write fail on a non-halted target Change-Id: I9340de33ffeff695c174bef3c2313a0779428b15 Signed-off-by: Parshintsev Anatoly <anatoly.parshint...@syntacore.com> diff --git a/src/target/target.c b/src/target/target.c index 45698a66c5..695bd72041 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1245,7 +1245,10 @@ int target_read_memory(struct target *target, LOG_ERROR("Target %s doesn't support read_memory", target_name(target)); return ERROR_FAIL; } - return target->type->read_memory(target, address, size, count, buffer); + int result = target->type->read_memory(target, address, size, count, buffer); + if (result != ERROR_OK && target->state != TARGET_HALTED) + LOG_TARGET_WARNING(target, "failed to read_memory while target is not halted"); + return result; } int target_read_phys_memory(struct target *target, @@ -1259,7 +1262,10 @@ int target_read_phys_memory(struct target *target, LOG_ERROR("Target %s doesn't support read_phys_memory", target_name(target)); return ERROR_FAIL; } - return target->type->read_phys_memory(target, address, size, count, buffer); + int result = target->type->read_phys_memory(target, address, size, count, buffer); + if (result != ERROR_OK && target->state != TARGET_HALTED) + LOG_TARGET_WARNING(target, "failed to read_phys_memory while target is not halted"); + return result; } int target_write_memory(struct target *target, @@ -1273,7 +1279,10 @@ int target_write_memory(struct target *target, LOG_ERROR("Target %s doesn't support write_memory", target_name(target)); return ERROR_FAIL; } - return target->type->write_memory(target, address, size, count, buffer); + int result = target->type->write_memory(target, address, size, count, buffer); + if (result != ERROR_OK && target->state != TARGET_HALTED) + LOG_TARGET_WARNING(target, "failed to write_memory while target is not halted"); + return result; } int target_write_phys_memory(struct target *target, @@ -1287,7 +1296,10 @@ int target_write_phys_memory(struct target *target, LOG_ERROR("Target %s doesn't support write_phys_memory", target_name(target)); return ERROR_FAIL; } - return target->type->write_phys_memory(target, address, size, count, buffer); + int result = target->type->write_phys_memory(target, address, size, count, buffer); + if (result != ERROR_OK && target->state != TARGET_HALTED) + LOG_TARGET_WARNING(target, "failed to write_phys_memory while target is not halted"); + return result; } int target_add_breakpoint(struct target *target, --