target: fix messages and return values of failed op because not halted 19/7819/2
authorTomas Vanek <vanekt@fbl.cz>
Thu, 20 Jul 2023 12:52:54 +0000 (14:52 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Sat, 29 Jul 2023 05:17:44 +0000 (05:17 +0000)
commita5108240f9e12633fea400f92d96cc75e03c86ca
treead263d29852d7646998e34bd14ecc914e361f72a
parent7023deb06a8cac77fe50d341c9e34b80d4fc68fd
target: fix messages and return values of failed op because not halted

Lot of messages was logged as LOG_WARNING, but the operation failed
immediately. Sometimes no error message was logged at all.
Add missing messages, change warnings to errors.

Sometimes ERROR_TARGET_INVALID was returned. Some command handlers
returned ERROR_OK! Always return ERROR_TARGET_NOT_HALTED.

While on it use LOG_TARGET_ERROR() whenever possible.
Prefix command_print() message with 'Error:' to get closer
to LOG_TARGET_ERROR() variant.

Error message was not added to get() and set() methods of
struct xxx_reg_type - the return value is properly checked and a message
is logged by the caller in case of ERROR_TARGET_NOT_HALTED.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I2fe4187c6025f0038956ab387edbf3f461c69398
Reviewed-on: https://review.openocd.org/c/openocd/+/7819
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
29 files changed:
src/target/aarch64.c
src/target/arc.c
src/target/arc_mem.c
src/target/arm11.c
src/target/arm720t.c
src/target/arm7_9_common.c
src/target/arm920t.c
src/target/arm926ejs.c
src/target/arm946e.c
src/target/arm966e.c
src/target/armv4_5.c
src/target/armv4_5_mmu.c
src/target/armv7a_cache.c
src/target/armv7m.c
src/target/armv8.c
src/target/avr32_ap7k.c
src/target/cortex_a.c
src/target/cortex_m.c
src/target/dsp563xx.c
src/target/esirisc.c
src/target/hla_target.c
src/target/mips32.c
src/target/mips_mips64.c
src/target/openrisc/or1k.c
src/target/riscv/riscv.c
src/target/stm8.c
src/target/target.c
src/target/xscale.c
src/target/xtensa/xtensa.c

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)