target/arc: restore breakpoints in arc_resume()
Presently, we rely on gdb to restore break/watchpoints upon resuming execution in arc_resume(). To match this behavior in absence of gdb (more specifically, when handle_breakpoints is true), this patch explicitly re-enables all breakpoints and watchpoints in arc_resume(). This has previously been committed to the Zephyr project's openocd repo (see https://github.com/zephyrproject-rtos/openocd/pull/31). Change-Id: I59e9c91270ef0b5fd19cfc570663dc67a6022dbd Signed-off-by: Evgeniy Didin <didin@synopsys.com> Signed-off-by: Stephanos Ioannidis <root@stephanos.io> Signed-off-by: Artemiy Volkov <artemiy@synopsys.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7816 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
This commit is contained in:
parent
04eda37263
commit
2c10e3e257
|
@ -50,6 +50,8 @@
|
||||||
|
|
||||||
static int arc_remove_watchpoint(struct target *target,
|
static int arc_remove_watchpoint(struct target *target,
|
||||||
struct watchpoint *watchpoint);
|
struct watchpoint *watchpoint);
|
||||||
|
static int arc_enable_watchpoints(struct target *target);
|
||||||
|
static int arc_enable_breakpoints(struct target *target);
|
||||||
|
|
||||||
void arc_reg_data_type_add(struct target *target,
|
void arc_reg_data_type_add(struct target *target,
|
||||||
struct arc_reg_data_type *data_type)
|
struct arc_reg_data_type *data_type)
|
||||||
|
@ -1262,6 +1264,13 @@ static int arc_resume(struct target *target, int current, target_addr_t address,
|
||||||
return ERROR_TARGET_NOT_HALTED;
|
return ERROR_TARGET_NOT_HALTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!debug_execution) {
|
||||||
|
/* (gdb) continue = execute until we hit break/watch-point */
|
||||||
|
target_free_all_working_areas(target);
|
||||||
|
CHECK_RETVAL(arc_enable_breakpoints(target));
|
||||||
|
CHECK_RETVAL(arc_enable_watchpoints(target));
|
||||||
|
}
|
||||||
|
|
||||||
/* current = 1: continue on current PC, otherwise continue at <address> */
|
/* current = 1: continue on current PC, otherwise continue at <address> */
|
||||||
if (!current) {
|
if (!current) {
|
||||||
target_buffer_set_u32(target, pc->value, address);
|
target_buffer_set_u32(target, pc->value, address);
|
||||||
|
@ -1658,6 +1667,19 @@ static int arc_unset_breakpoint(struct target *target,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int arc_enable_breakpoints(struct target *target)
|
||||||
|
{
|
||||||
|
struct breakpoint *breakpoint = target->breakpoints;
|
||||||
|
|
||||||
|
/* set any pending breakpoints */
|
||||||
|
while (breakpoint) {
|
||||||
|
if (!breakpoint->is_set)
|
||||||
|
CHECK_RETVAL(arc_set_breakpoint(target, breakpoint));
|
||||||
|
breakpoint = breakpoint->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int arc_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
|
static int arc_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
|
||||||
{
|
{
|
||||||
|
@ -1895,6 +1917,20 @@ static int arc_unset_watchpoint(struct target *target,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int arc_enable_watchpoints(struct target *target)
|
||||||
|
{
|
||||||
|
struct watchpoint *watchpoint = target->watchpoints;
|
||||||
|
|
||||||
|
/* set any pending watchpoints */
|
||||||
|
while (watchpoint) {
|
||||||
|
if (!watchpoint->is_set)
|
||||||
|
CHECK_RETVAL(arc_set_watchpoint(target, watchpoint));
|
||||||
|
watchpoint = watchpoint->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int arc_add_watchpoint(struct target *target,
|
static int arc_add_watchpoint(struct target *target,
|
||||||
struct watchpoint *watchpoint)
|
struct watchpoint *watchpoint)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue