X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Ftarget.c;h=cab84b06be9640eafec16a689038c678f96f89a7;hp=c752844b04c082f306c3a1f7099558052695401c;hb=23d8831391bbd167e0061388c87e7ecf7b9891a7;hpb=c1270bcb38477a0c8a8be32921fccda61f9c06c7 diff --git a/src/target/target.c b/src/target/target.c index c752844b04..cab84b06be 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -637,7 +637,18 @@ int target_resume(struct target *target, int current, target_addr_t address, * we poll. The CPU can even halt at the current PC as a result of * a software breakpoint being inserted by (a bug?) the application. */ + /* + * resume() triggers the event 'resumed'. The execution of TCL commands + * in the event handler causes the polling of targets. If the target has + * already halted for a breakpoint, polling will run the 'halted' event + * handler before the pending 'resumed' handler. + * Disable polling during resume() to guarantee the execution of handlers + * in the correct order. + */ + bool save_poll = jtag_poll_get_enabled(); + jtag_poll_set_enabled(false); retval = target->type->resume(target, current, address, handle_breakpoints, debug_execution); + jtag_poll_set_enabled(save_poll); if (retval != ERROR_OK) return retval; @@ -803,6 +814,13 @@ static int target_soft_reset_halt(struct target *target) * algorithm. * * @param target used to run the algorithm + * @param num_mem_params + * @param mem_params + * @param num_reg_params + * @param reg_param + * @param entry_point + * @param exit_point + * @param timeout_ms * @param arch_info target-specific description of the algorithm. */ int target_run_algorithm(struct target *target, @@ -838,6 +856,12 @@ done: * Executes a target-specific native code algorithm and leaves it running. * * @param target used to run the algorithm + * @param num_mem_params + * @param mem_params + * @param num_reg_params + * @param reg_params + * @param entry_point + * @param exit_point * @param arch_info target-specific description of the algorithm. */ int target_start_algorithm(struct target *target, @@ -876,6 +900,12 @@ done: * Waits for an algorithm started with target_start_algorithm() to complete. * * @param target used to run the algorithm + * @param num_mem_params + * @param mem_params + * @param num_reg_params + * @param reg_params + * @param exit_point + * @param timeout_ms * @param arch_info target-specific description of the algorithm. */ int target_wait_algorithm(struct target *target, @@ -947,6 +977,7 @@ done: * @param entry_point address on the target to execute to start the algorithm * @param exit_point address at which to set a breakpoint to catch the * end of the algorithm; can be 0 if target triggers a breakpoint itself + * @param arch_info */ int target_run_flash_async_algorithm(struct target *target, @@ -4036,7 +4067,7 @@ COMMAND_HANDLER(handle_wp_command) } enum watchpoint_rw type = WPT_ACCESS; - uint32_t addr = 0; + target_addr_t addr = 0; uint32_t length = 0; uint32_t data_value = 0x0; uint32_t data_mask = 0xffffffff; @@ -4066,7 +4097,7 @@ COMMAND_HANDLER(handle_wp_command) /* fall through */ case 2: COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length); - COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); + COMMAND_PARSE_ADDRESS(CMD_ARGV[0], addr); break; default: @@ -4086,8 +4117,8 @@ COMMAND_HANDLER(handle_rwp_command) if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; - uint32_t addr; - COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr); + target_addr_t addr; + COMMAND_PARSE_ADDRESS(CMD_ARGV[0], addr); struct target *target = get_current_target(CMD_CTX); watchpoint_remove(target, addr);