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)
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

index 5a16b3a3bf90f5bccd774a0f62f889b36ee9c49e..5d8a65273fa7daa5376fcf95e628fa7530b74d22 100644 (file)
@@ -846,8 +846,10 @@ static int aarch64_resume(struct target *target, int current,
        struct armv8_common *armv8 = target_to_armv8(target);
        armv8->last_run_control_op = ARMV8_RUNCONTROL_RESUME;
 
-       if (target->state != TARGET_HALTED)
+       if (target->state != TARGET_HALTED) {
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
+       }
 
        /*
         * If this target is part of a SMP group, prepare the others
@@ -1095,7 +1097,7 @@ static int aarch64_step(struct target *target, int current, target_addr_t addres
        armv8->last_run_control_op = ARMV8_RUNCONTROL_STEP;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2135,7 +2137,7 @@ static int aarch64_write_cpu_memory(struct target *target,
        uint32_t dscr;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2353,7 +2355,7 @@ static int aarch64_read_cpu_memory(struct target *target,
                        address, size, count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2790,8 +2792,8 @@ static int aarch64_mmu(struct target *target, int *enabled)
        struct aarch64_common *aarch64 = target_to_aarch64(target);
        struct armv8_common *armv8 = &aarch64->armv8_common;
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("%s: target %s not halted", __func__, target_name(target));
-               return ERROR_TARGET_INVALID;
+               LOG_TARGET_ERROR(target, "not halted");
+               return ERROR_TARGET_NOT_HALTED;
        }
        if (armv8->is_armv8r)
                *enabled = 0;
@@ -3010,8 +3012,10 @@ COMMAND_HANDLER(aarch64_mcrmrc_command)
                return ERROR_FAIL;
        }
 
-       if (target->state != TARGET_HALTED)
+       if (target->state != TARGET_HALTED) {
+               command_print(CMD, "Error: [%s] not halted", target_name(target));
                return ERROR_TARGET_NOT_HALTED;
+       }
 
        if (arm->core_state == ARM_STATE_AARCH64) {
                command_print(CMD, "%s: not 32-bit arm target", target_name(target));
index a8de6f36bead4e47ab0b180d3b27965ac2f60f06..2ca6be16d2f3ffe20c10bc6eb1affa8c200c9cec 100644 (file)
@@ -1258,7 +1258,7 @@ static int arc_resume(struct target *target, int current, target_addr_t address,
        CHECK_RETVAL(arc_reset_caches_states(target));
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1671,7 +1671,7 @@ static int arc_add_breakpoint(struct target *target, struct breakpoint *breakpoi
                return arc_set_breakpoint(target, breakpoint);
 
        } else {
-               LOG_WARNING(" > core was not halted, please try again.");
+               LOG_TARGET_ERROR(target, "not halted (add breakpoint)");
                return ERROR_TARGET_NOT_HALTED;
        }
 }
@@ -1683,7 +1683,7 @@ static int arc_remove_breakpoint(struct target *target,
                if (breakpoint->is_set)
                        CHECK_RETVAL(arc_unset_breakpoint(target, breakpoint));
        } else {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted (remove breakpoint)");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1905,7 +1905,7 @@ static int arc_add_watchpoint(struct target *target,
        struct watchpoint *watchpoint)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1918,7 +1918,7 @@ static int arc_remove_watchpoint(struct target *target,
        struct watchpoint *watchpoint)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2006,7 +2006,7 @@ static int arc_step(struct target *target, int current, target_addr_t address,
        struct reg *pc = &(arc->core_and_aux_cache->reg_list[arc->pc_index_in_cache]);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index c4814d27779137648946557abed0ac0ea1189f27..3264b663b6e2e666a24d608f42e2dd718025533a 100644 (file)
@@ -162,7 +162,7 @@ int arc_mem_write(struct target *target, target_addr_t address, uint32_t size,
                address, size, count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index e48bcf30b06c72d8ee3f1d32e42f1a7fe6c23ac6..50aaa86f12873eafdf8f0511799a108d3651f9de 100644 (file)
@@ -449,7 +449,7 @@ static int arm11_resume(struct target *target, int current,
 
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -551,7 +551,7 @@ static int arm11_step(struct target *target, int current,
                target_state_name(target));
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target was not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -798,7 +798,7 @@ static int arm11_read_memory_inner(struct target *target,
        int retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target was not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -896,7 +896,7 @@ static int arm11_write_memory_inner(struct target *target,
        int retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target was not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index c330dfff9f7e0330c6e81eb930632916681eaafa..beab632c257715329ea8e1431d245151dea606fb 100644 (file)
@@ -241,8 +241,8 @@ static int arm720t_arch_state(struct target *target)
 static int arm720_mmu(struct target *target, int *enabled)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("%s: target not halted", __func__);
-               return ERROR_TARGET_INVALID;
+               LOG_TARGET_ERROR(target, "not halted");
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        *enabled = target_to_arm720(target)->armv4_5_mmu.mmu_enabled;
index f60777dbebba2b43b3ced28e9a3805ff5028c872..bbdbc4981cc5ddca6bf34c385a53d7206dcc92cd 100644 (file)
@@ -184,7 +184,7 @@ static int arm7_9_set_breakpoint(struct target *target, struct breakpoint *break
                breakpoint->type);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -455,7 +455,7 @@ static int arm7_9_set_watchpoint(struct target *target, struct watchpoint *watch
        mask = watchpoint->length - 1;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -524,7 +524,7 @@ static int arm7_9_unset_watchpoint(struct target *target, struct watchpoint *wat
        struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1259,7 +1259,7 @@ static int arm7_9_debug_entry(struct target *target)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1390,7 +1390,7 @@ static int arm7_9_full_context(struct target *target)
        LOG_DEBUG("-");
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1506,7 +1506,7 @@ static int arm7_9_restore_context(struct target *target)
        LOG_DEBUG("-");
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1709,7 +1709,7 @@ int arm7_9_resume(struct target *target,
        LOG_DEBUG("-");
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1907,7 +1907,7 @@ int arm7_9_step(struct target *target, int current, target_addr_t address, int h
        int err, retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2118,7 +2118,7 @@ int arm7_9_read_memory(struct target *target,
                address, size, count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2291,7 +2291,7 @@ int arm7_9_write_memory(struct target *target,
 #endif
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index f4c3f425070f83a1b255c751f02c3ec08e4f7a84..53b4d9d15f3ac6240f81c7fef9b8e9a6de46fa57 100644 (file)
@@ -533,8 +533,8 @@ int arm920t_arch_state(struct target *target)
 static int arm920_mmu(struct target *target, int *enabled)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("%s: target not halted", __func__);
-               return ERROR_TARGET_INVALID;
+               LOG_TARGET_ERROR(target, "not halted");
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        *enabled = target_to_arm920(target)->armv4_5_mmu.mmu_enabled;
@@ -1455,9 +1455,9 @@ COMMAND_HANDLER(arm920t_handle_cp15_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for "
+               command_print(CMD, "Error: target must be stopped for "
                        "\"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        /* one argument, read a register.
index 807d21175d2e11b1636093e4068318a5a424f610..add90c99786878b5a7550b682670088c242e8632 100644 (file)
@@ -754,8 +754,8 @@ static int arm926ejs_mmu(struct target *target, int *enabled)
        struct arm926ejs_common *arm926ejs = target_to_arm926(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
-               return ERROR_TARGET_INVALID;
+               LOG_TARGET_ERROR(target, "not halted");
+               return ERROR_TARGET_NOT_HALTED;
        }
        *enabled = arm926ejs->armv4_5_mmu.mmu_enabled;
        return ERROR_OK;
index 06dab4e977494c47f2625f8791c7bcd984295add..03f7e443fb57a931f26adcdf16bbf3049442bbd9 100644 (file)
@@ -574,7 +574,7 @@ COMMAND_HANDLER(arm946e_handle_cp15)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -624,7 +624,7 @@ COMMAND_HANDLER(arm946e_handle_idcache)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_TARGET_NOT_HALTED;
        }
 
index 3e601720362b96c68642ad75a8b26808e0076b7c..8598d29d9b3438506d197119f2e261bd5655884c 100644 (file)
@@ -174,8 +174,8 @@ COMMAND_HANDLER(arm966e_handle_cp15_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        /* one or more argument, access a single register (write if second argument is given */
index f35d67a57e8c00d8bfa4e3be7340a32e6f28eacb..8e3f22417d3a80407c9604c09c53820ad1567620 100644 (file)
@@ -578,7 +578,7 @@ static int armv4_5_get_core_reg(struct reg *reg)
        struct target *target = reg_arch_info->target;
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -600,7 +600,7 @@ static int armv4_5_set_core_reg(struct reg *reg, uint8_t *buf)
        uint32_t value = buf_get_u32(buf, 0, 32);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -817,8 +817,8 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
        }
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "error: target must be halted for register accesses");
-               return ERROR_FAIL;
+               command_print(CMD, "Error: target must be halted for register accesses");
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if (arm->core_type != ARM_CORE_TYPE_STD) {
@@ -833,7 +833,7 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
        }
 
        if (!arm->full_context) {
-               command_print(CMD, "error: target doesn't support %s",
+               command_print(CMD, "Error: target doesn't support %s",
                        CMD_NAME);
                return ERROR_FAIL;
        }
@@ -1018,8 +1018,10 @@ COMMAND_HANDLER(handle_armv4_5_mcrmrc)
                return ERROR_FAIL;
        }
 
-       if (target->state != TARGET_HALTED)
+       if (target->state != TARGET_HALTED) {
+               command_print(CMD, "Error: [%s] not halted", target_name(target));
                return ERROR_TARGET_NOT_HALTED;
+       }
 
        int cpnum;
        uint32_t op1;
@@ -1307,7 +1309,7 @@ int armv4_5_run_algorithm_inner(struct target *target,
        }
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted (run target algo)");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index 9942f49e4d88869edaf3901af866962395a8e43f..0c09cb4ca74e6bcf2f61e249c5234154573b1115 100644 (file)
@@ -107,8 +107,10 @@ int armv4_5_mmu_read_physical(struct target *target,
 {
        int retval;
 
-       if (target->state != TARGET_HALTED)
+       if (target->state != TARGET_HALTED) {
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
+       }
 
        /* disable MMU and data (or unified) cache */
        retval = armv4_5_mmu->disable_mmu_caches(target, 1, 1, 0);
@@ -135,8 +137,10 @@ int armv4_5_mmu_write_physical(struct target *target,
 {
        int retval;
 
-       if (target->state != TARGET_HALTED)
+       if (target->state != TARGET_HALTED) {
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
+       }
 
        /* disable MMU and data (or unified) cache */
        retval = armv4_5_mmu->disable_mmu_caches(target, 1, 1, 0);
index 995a85611dfed85fdc45636153370e042b02a986..e1f0dfafb0bdd4bc25c65e2ef349ffd6fd3544c5 100644 (file)
@@ -22,7 +22,7 @@ static int armv7a_l1_d_cache_sanity_check(struct target *target)
        struct armv7a_common *armv7a = target_to_armv7a(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("%s: target not halted", __func__);
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -40,7 +40,7 @@ static int armv7a_l1_i_cache_sanity_check(struct target *target)
        struct armv7a_common *armv7a = target_to_armv7a(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("%s: target not halted", __func__);
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index 8c9ff902e5be8b2542518f135055794346281505..d508af7bf0c18d47b52a136c0f09427bc36c73d7 100644 (file)
@@ -525,7 +525,7 @@ int armv7m_start_algorithm(struct target *target,
        }
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted (start target algo)");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index e647c3b4cb21af04a19203da82d19b9dc57df9b3..d197477aceb2afd93af1a61fa3ffbd0380c2555a 100644 (file)
@@ -964,7 +964,7 @@ int armv8_mmu_translate_va_pa(struct target *target, target_addr_t va,
        };
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target %s not halted", target_name(target));
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index bf1445bf3805ab79cf2f86a2cad477d7576dcd77..bbbf236592c012c736c55ec250aac81bb8e1f3a1 100644 (file)
@@ -309,7 +309,7 @@ static int avr32_ap7k_resume(struct target *target, int current,
        int retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -431,7 +431,7 @@ static int avr32_ap7k_read_memory(struct target *target, target_addr_t address,
                count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -471,7 +471,7 @@ static int avr32_ap7k_write_memory(struct target *target, target_addr_t address,
                count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index d9688be13b6d09d26fe693a1b44920569e924feb..abfd6ac5f140c9252330b4037f7978a3c6031ac8 100644 (file)
@@ -1147,7 +1147,7 @@ static int cortex_a_step(struct target *target, int current, target_addr_t addre
        int retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2225,7 +2225,7 @@ static int cortex_a_write_cpu_memory(struct target *target,
        LOG_DEBUG("Writing CPU memory address 0x%" PRIx32 " size %"  PRIu32 " count %"  PRIu32,
                          address, size, count);
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2542,7 +2542,7 @@ static int cortex_a_read_cpu_memory(struct target *target,
        LOG_DEBUG("Reading CPU memory address 0x%" PRIx32 " size %"  PRIu32 " count %"  PRIu32,
                          address, size, count);
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -3183,8 +3183,8 @@ static int cortex_a_mmu(struct target *target, int *enabled)
        struct armv7a_common *armv7a = target_to_armv7a(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("%s: target not halted", __func__);
-               return ERROR_TARGET_INVALID;
+               LOG_TARGET_ERROR(target, "not halted");
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if (armv7a->is_armv7r)
index ebc3bac999fd56de77d7c0b2ee826e2ab9630409..9541caa7921122f7a4bc152660052646daaff472 100644 (file)
@@ -1214,7 +1214,7 @@ static int cortex_m_restore_one(struct target *target, bool current,
        struct reg *r;
 
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_ERROR(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1391,7 +1391,7 @@ static int cortex_m_step(struct target *target, int current,
        bool isr_timed_out = false;
 
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_WARNING(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2092,7 +2092,7 @@ int cortex_m_remove_watchpoint(struct target *target, struct watchpoint *watchpo
 
        /* REVISIT why check? DWT can be updated with core running ... */
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_WARNING(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2948,8 +2948,8 @@ COMMAND_HANDLER(handle_cortex_m_mask_interrupts_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if (CMD_ARGC > 0) {
index 8ea2cb61321d0986ed6d590701542b706cb4867c..5789201547dd92e27ce3f434aef4bbbfc6c604f3 100644 (file)
@@ -1296,7 +1296,7 @@ static int dsp563xx_step(struct target *target,
        struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1381,7 +1381,7 @@ static int dsp563xx_run_algorithm(struct target *target,
        struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted (run target algo)");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1705,7 +1705,7 @@ static int dsp563xx_write_memory_core(struct target *target,
                count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index f86d28d5830a0a2c77cb03266ee715172e1514bf..561edb255a766e18497cdc1e8efe87af247b4c3d 100644 (file)
@@ -318,8 +318,10 @@ static int esirisc_flush_caches(struct target *target)
 
        LOG_DEBUG("-");
 
-       if (target->state != TARGET_HALTED)
+       if (target->state != TARGET_HALTED) {
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
+       }
 
        int retval = esirisc_jtag_flush_caches(jtag_info);
        if (retval != ERROR_OK) {
@@ -855,8 +857,10 @@ static int esirisc_resume_or_step(struct target *target, int current, target_add
 
        LOG_DEBUG("-");
 
-       if (target->state != TARGET_HALTED)
+       if (target->state != TARGET_HALTED) {
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
+       }
 
        if (!debug_execution) {
                target_free_all_working_areas(target);
index 8c35a90cb2a46c93cd17daed2f5f12f071cb0eac..c1bda996ce2f163ee7a4e329179448fde76d4654 100644 (file)
@@ -449,7 +449,7 @@ static int adapter_resume(struct target *target, int current,
                        address, handle_breakpoints, debug_execution);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -538,7 +538,7 @@ static int adapter_step(struct target *target, int current,
        LOG_DEBUG("%s", __func__);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index 1a34f737e4ac5e690e57bde4f9771608ba7969d9..ce16a7b5d63e5e3242799d0b0c2f469d71dd17f1 100644 (file)
@@ -438,7 +438,7 @@ int mips32_run_algorithm(struct target *target, int num_mem_params,
        }
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted (run target algo)");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -921,8 +921,8 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        /* two or more argument, access a single register/select (write if third argument is given) */
index 640b4c8386391fc2f3e5e54cb2e1c047cee78779..bf6095358faeb457c183f5e6567b14923ab5425f 100644 (file)
@@ -606,7 +606,7 @@ static int mips_mips64_resume(struct target *target, int current,
                address = mips64_extend_sign(address);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted %d", target->state);
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -706,7 +706,7 @@ static int mips_mips64_step(struct target *target, int current,
        int retval = ERROR_OK;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -804,7 +804,7 @@ static int mips_mips64_remove_breakpoint(struct target *target,
        int retval = ERROR_OK;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -865,7 +865,7 @@ static int mips_mips64_remove_watchpoint(struct target *target,
        int retval = ERROR_OK;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -886,7 +886,7 @@ static int mips_mips64_read_memory(struct target *target, uint64_t address,
        void *t;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted %d", target->state);
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1014,7 +1014,7 @@ static int mips_mips64_write_memory(struct target *target, uint64_t address,
        int retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index d73bca21094b261d803a33bff84284b56d9137b1..8c386108057e4292cde7a8e2bc5fef46a6049882 100644 (file)
@@ -789,7 +789,7 @@ static int or1k_resume_or_step(struct target *target, int current,
                  address, step ? "yes" : "no", handle_breakpoints ? "yes" : "no");
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1026,7 +1026,7 @@ static int or1k_read_memory(struct target *target, target_addr_t address,
        LOG_DEBUG("Read memory at 0x%08" TARGET_PRIxADDR ", size: %" PRIu32 ", count: 0x%08" PRIx32, address, size, count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1053,7 +1053,7 @@ static int or1k_write_memory(struct target *target, target_addr_t address,
        LOG_DEBUG("Write memory at 0x%08" TARGET_PRIxADDR ", size: %" PRIu32 ", count: 0x%08" PRIx32, address, size, count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("Target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index 48391786dcbd907322e4e3dadea210afb1422781..cb8d04f20176c49fe3e63839ae9c1a73bb048b6c 100644 (file)
@@ -1840,7 +1840,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params,
        }
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted (run target algo)");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index 91a59d79cfcbd0a6b57e15ed984471813a807444..ad4a45298106103c684d450ca79361adbee0c57b 100644 (file)
@@ -994,7 +994,7 @@ static int stm8_resume(struct target *target, int current,
                        handle_breakpoints, debug_execution);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1303,7 +1303,7 @@ static int stm8_step(struct target *target, int current,
        struct breakpoint *breakpoint = NULL;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1518,7 +1518,7 @@ static int stm8_remove_breakpoint(struct target *target,
        struct stm8_common *stm8 = target_to_stm8(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1654,7 +1654,7 @@ static int stm8_remove_watchpoint(struct target *target,
        struct stm8_common *stm8 = target_to_stm8(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
index 5858aa573b8cc4458ac64c3831e5adedd1ac19f1..89eaa23d846a2a2103d069399c93e501fd9d870b 100644 (file)
@@ -1325,7 +1325,7 @@ int target_add_breakpoint(struct target *target,
                struct breakpoint *breakpoint)
 {
        if ((target->state != TARGET_HALTED) && (breakpoint->type != BKPT_HARD)) {
-               LOG_WARNING("target %s is not halted (add breakpoint)", target_name(target));
+               LOG_TARGET_ERROR(target, "not halted (add breakpoint)");
                return ERROR_TARGET_NOT_HALTED;
        }
        return target->type->add_breakpoint(target, breakpoint);
@@ -1335,7 +1335,7 @@ int target_add_context_breakpoint(struct target *target,
                struct breakpoint *breakpoint)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target %s is not halted (add context breakpoint)", target_name(target));
+               LOG_TARGET_ERROR(target, "not halted (add context breakpoint)");
                return ERROR_TARGET_NOT_HALTED;
        }
        return target->type->add_context_breakpoint(target, breakpoint);
@@ -1345,7 +1345,7 @@ int target_add_hybrid_breakpoint(struct target *target,
                struct breakpoint *breakpoint)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target %s is not halted (add hybrid breakpoint)", target_name(target));
+               LOG_TARGET_ERROR(target, "not halted (add hybrid breakpoint)");
                return ERROR_TARGET_NOT_HALTED;
        }
        return target->type->add_hybrid_breakpoint(target, breakpoint);
@@ -1361,7 +1361,7 @@ int target_add_watchpoint(struct target *target,
                struct watchpoint *watchpoint)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target %s is not halted (add watchpoint)", target_name(target));
+               LOG_TARGET_ERROR(target, "not halted (add watchpoint)");
                return ERROR_TARGET_NOT_HALTED;
        }
        return target->type->add_watchpoint(target, watchpoint);
@@ -1375,7 +1375,7 @@ int target_hit_watchpoint(struct target *target,
                struct watchpoint **hit_watchpoint)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target %s is not halted (hit watchpoint)", target->cmd_name);
+               LOG_TARGET_ERROR(target, "not halted (hit watchpoint)");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1457,7 +1457,7 @@ int target_step(struct target *target,
 int target_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target %s is not halted (gdb fileio)", target->cmd_name);
+               LOG_TARGET_ERROR(target, "not halted (gdb fileio)");
                return ERROR_TARGET_NOT_HALTED;
        }
        return target->type->get_gdb_fileio_info(target, fileio_info);
@@ -1466,7 +1466,7 @@ int target_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fi
 int target_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, bool ctrl_c)
 {
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target %s is not halted (gdb fileio end)", target->cmd_name);
+               LOG_TARGET_ERROR(target, "not halted (gdb fileio end)");
                return ERROR_TARGET_NOT_HALTED;
        }
        return target->type->gdb_fileio_end(target, retcode, fileio_errno, ctrl_c);
@@ -6666,8 +6666,8 @@ COMMAND_HANDLER(handle_ps_command)
        struct target *target = get_current_target(CMD_CTX);
        char *display;
        if (target->state != TARGET_HALTED) {
-               LOG_INFO("target not halted !!");
-               return ERROR_OK;
+               command_print(CMD, "Error: [%s] not halted", target_name(target));
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if ((target->rtos) && (target->rtos->type)
@@ -6698,8 +6698,8 @@ COMMAND_HANDLER(handle_test_mem_access_command)
        int retval = ERROR_OK;
 
        if (target->state != TARGET_HALTED) {
-               LOG_INFO("target not halted !!");
-               return ERROR_FAIL;
+               command_print(CMD, "Error: [%s] not halted", target_name(target));
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if (CMD_ARGC != 1)
index 066ff8c918be9d5a4a3dc2431a60a55a15e99676..03aa5166bab5c6f327897a8373d6100b984456d1 100644 (file)
@@ -1118,7 +1118,7 @@ static int xscale_resume(struct target *target, int current,
        LOG_DEBUG("-");
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1382,7 +1382,7 @@ static int xscale_step(struct target *target, int current,
        int retval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1632,7 +1632,7 @@ static int xscale_full_context(struct target *target)
        LOG_DEBUG("-");
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1705,7 +1705,7 @@ static int xscale_restore_banked(struct target *target)
        int i, j;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1781,7 +1781,7 @@ static int xscale_read_memory(struct target *target, target_addr_t address,
                count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1880,7 +1880,7 @@ static int xscale_write_memory(struct target *target, target_addr_t address,
                count);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2073,7 +2073,7 @@ static int xscale_set_breakpoint(struct target *target,
        struct xscale_common *xscale = target_to_xscale(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2163,7 +2163,7 @@ static int xscale_unset_breakpoint(struct target *target,
        struct xscale_common *xscale = target_to_xscale(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2210,7 +2210,7 @@ static int xscale_remove_breakpoint(struct target *target, struct breakpoint *br
        struct xscale_common *xscale = target_to_xscale(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2232,7 +2232,7 @@ static int xscale_set_watchpoint(struct target *target,
        uint32_t dbcon_value = buf_get_u32(dbcon->value, 0, 32);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2336,7 +2336,7 @@ static int xscale_unset_watchpoint(struct target *target,
        uint32_t dbcon_value = buf_get_u32(dbcon->value, 0, 32);
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2369,7 +2369,7 @@ static int xscale_remove_watchpoint(struct target *target, struct watchpoint *wa
        struct xscale_common *xscale = target_to_xscale(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2490,7 +2490,7 @@ static int xscale_read_trace(struct target *target)
        unsigned int num_checkpoints = 0;
 
        if (target->state != TARGET_HALTED) {
-               LOG_WARNING("target must be stopped to read trace data");
+               LOG_TARGET_ERROR(target, "must be stopped to read trace data");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -3131,8 +3131,8 @@ static int xscale_mmu(struct target *target, int *enabled)
        struct xscale_common *xscale = target_to_xscale(target);
 
        if (target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
-               return ERROR_TARGET_INVALID;
+               LOG_TARGET_ERROR(target, "not halted");
+               return ERROR_TARGET_NOT_HALTED;
        }
        *enabled = xscale->armv4_5_mmu.mmu_enabled;
        return ERROR_OK;
@@ -3149,8 +3149,8 @@ COMMAND_HANDLER(xscale_handle_mmu_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if (CMD_ARGC >= 1) {
@@ -3179,8 +3179,8 @@ COMMAND_HANDLER(xscale_handle_idcache_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        bool icache = false;
@@ -3347,8 +3347,8 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if (CMD_ARGC >= 1) {
@@ -3451,8 +3451,8 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
 
        if (CMD_ARGC < 1)
@@ -3514,8 +3514,8 @@ COMMAND_HANDLER(xscale_handle_cp15)
                return retval;
 
        if (target->state != TARGET_HALTED) {
-               command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
-               return ERROR_OK;
+               command_print(CMD, "Error: target must be stopped for \"%s\" command", CMD_NAME);
+               return ERROR_TARGET_NOT_HALTED;
        }
        uint32_t reg_no = 0;
        struct reg *reg = NULL;
index 431c36a2496aec024c2503b571770fede302701a..431be894b91dbe43bef5f9c68d08866531dfa926 100644 (file)
@@ -1541,7 +1541,7 @@ int xtensa_prepare_resume(struct target *target,
                debug_execution);
 
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_WARNING(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
        xtensa->halt_request = false;
@@ -1667,7 +1667,7 @@ int xtensa_do_step(struct target *target, int current, target_addr_t address, in
                current, address, handle_breakpoints);
 
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_WARNING(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -1941,7 +1941,7 @@ int xtensa_read_memory(struct target *target, target_addr_t address, uint32_t si
        bool bswap = xtensa->target->endianness == TARGET_BIG_ENDIAN;
 
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_WARNING(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2037,7 +2037,7 @@ int xtensa_write_memory(struct target *target,
        bool fill_head_tail = false;
 
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_WARNING(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 
@@ -2566,7 +2566,7 @@ int xtensa_watchpoint_add(struct target *target, struct watchpoint *watchpoint)
        xtensa_reg_val_t dbreakcval;
 
        if (target->state != TARGET_HALTED) {
-               LOG_TARGET_WARNING(target, "target not halted");
+               LOG_TARGET_ERROR(target, "not halted");
                return ERROR_TARGET_NOT_HALTED;
        }
 

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)