rtos: server: target: ask the RTOS which target to set swbp on.

This is the result of squashing two commits from RISC-V OpenOCD:
- [1] ("Ask the RTOS which target to set swbp on. (#673)")
- [2] ("Fix breackpoint_add for rtos swbp (#734)")

The resulting change lets the RTOS pick the "current" target for setting
the software breakpoint on, which matters if address translation differs
between threads.

Link: https://github.com/riscv-collab/riscv-openocd/commit/52ca5d198e3b [1]
Link: https://github.com/riscv-collab/riscv-openocd/commit/8ae41e86e15d [2]
Change-Id: I67ce24d6aa0ca9225436b380065d1e265424e70f
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9176
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Tim Newsome
2022-01-31 09:23:38 -08:00
committed by Tomas Vanek
parent 7487fade75
commit 7b6496db7e
5 changed files with 40 additions and 12 deletions

View File

@@ -210,16 +210,10 @@ int breakpoint_add(struct target *target,
unsigned int length,
enum breakpoint_type type)
{
if (target->smp) {
struct target_list *head;
if (type == BKPT_SOFT) {
head = list_first_entry(target->smp_targets, struct target_list, lh);
return breakpoint_add_internal(head->target, address, length, type);
}
foreach_smp_target(head, target->smp_targets) {
struct target *curr = head->target;
if (target->smp && type == BKPT_HARD) {
struct target_list *list_node;
foreach_smp_target(list_node, target->smp_targets) {
struct target *curr = list_node->target;
int retval = breakpoint_add_internal(curr, address, length, type);
if (retval != ERROR_OK)
return retval;