target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize bp/wp descriptor
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
This commit is contained in:
parent
3991492cc1
commit
88f7650a6d
|
@ -1415,6 +1415,7 @@ static int riscv_add_breakpoint(struct target *target, struct breakpoint *breakp
|
||||||
TARGET_PRIxADDR, breakpoint->length, breakpoint->address);
|
TARGET_PRIxADDR, breakpoint->length, breakpoint->address);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
breakpoint->is_set = true;
|
||||||
|
|
||||||
} else if (breakpoint->type == BKPT_HARD) {
|
} else if (breakpoint->type == BKPT_HARD) {
|
||||||
struct trigger trigger;
|
struct trigger trigger;
|
||||||
|
@ -1422,12 +1423,13 @@ static int riscv_add_breakpoint(struct target *target, struct breakpoint *breakp
|
||||||
int const result = add_trigger(target, &trigger);
|
int const result = add_trigger(target, &trigger);
|
||||||
if (result != ERROR_OK)
|
if (result != ERROR_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
int trigger_idx = find_first_trigger_by_id(target, breakpoint->unique_id);
|
||||||
|
breakpoint_hw_set(breakpoint, trigger_idx);
|
||||||
} else {
|
} else {
|
||||||
LOG_TARGET_INFO(target, "OpenOCD only supports hardware and software breakpoints.");
|
LOG_TARGET_INFO(target, "OpenOCD only supports hardware and software breakpoints.");
|
||||||
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
breakpoint->is_set = true;
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1521,7 +1523,9 @@ int riscv_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
|
||||||
int result = add_trigger(target, &trigger);
|
int result = add_trigger(target, &trigger);
|
||||||
if (result != ERROR_OK)
|
if (result != ERROR_OK)
|
||||||
return result;
|
return result;
|
||||||
watchpoint->is_set = true;
|
|
||||||
|
int trigger_idx = find_first_trigger_by_id(target, watchpoint->unique_id);
|
||||||
|
watchpoint_set(watchpoint, trigger_idx);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue