#include "target/target.h"
#include "target/algorithm.h"
#include "target/target_type.h"
+#include <target/smp.h>
#include "jtag/jtag.h"
#include "target/register.h"
#include "target/breakpoints.h"
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
- breakpoint->set = true;
+ breakpoint->is_set = true;
return ERROR_OK;
}
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
- breakpoint->set = false;
+ breakpoint->is_set = false;
return ERROR_OK;
}
int result = add_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
- watchpoint->set = true;
+ watchpoint->is_set = true;
return ERROR_OK;
}
int result = remove_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
- watchpoint->set = false;
+ watchpoint->is_set = false;
return ERROR_OK;
}
int result = ERROR_OK;
if (target->smp) {
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ struct target_list *tlist;
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
if (halt_prep(t) != ERROR_OK)
result = ERROR_FAIL;
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
riscv_info_t *i = riscv_info(t);
if (i->prepped) {
}
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target(tlist, target->smp_targets) {
struct target *t = tlist->target;
if (halt_finish(t) != ERROR_OK)
return ERROR_FAIL;
struct watchpoint *watchpoint = target->watchpoints;
int i = 0;
while (watchpoint) {
- LOG_DEBUG("watchpoint %d: set=%d", i, watchpoint->set);
- state[i] = watchpoint->set;
- if (watchpoint->set) {
+ LOG_DEBUG("watchpoint %d: set=%d", i, watchpoint->is_set);
+ state[i] = watchpoint->is_set;
+ if (watchpoint->is_set) {
if (riscv_remove_watchpoint(target, watchpoint) != ERROR_OK)
return ERROR_FAIL;
}
LOG_DEBUG("handle_breakpoints=%d", handle_breakpoints);
int result = ERROR_OK;
if (target->smp && !single_hart) {
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ struct target_list *tlist;
+ foreach_smp_target_direction(resume_order == RO_NORMAL,
+ tlist, target->smp_targets) {
struct target *t = tlist->target;
if (resume_prep(t, current, address, handle_breakpoints,
debug_execution) != ERROR_OK)
result = ERROR_FAIL;
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target_direction(resume_order == RO_NORMAL,
+ tlist, target->smp_targets) {
struct target *t = tlist->target;
riscv_info_t *i = riscv_info(t);
if (i->prepped) {
}
}
- for (struct target_list *tlist = target->head; tlist; tlist = tlist->next) {
+ foreach_smp_target_direction(resume_order == RO_NORMAL,
+ tlist, target->smp_targets) {
struct target *t = tlist->target;
if (resume_finish(t) != ERROR_OK)
return ERROR_FAIL;
unsigned halts_discovered = 0;
unsigned should_remain_halted = 0;
unsigned should_resume = 0;
- unsigned i = 0;
- for (struct target_list *list = target->head; list;
- list = list->next, i++) {
+ struct target_list *list;
+ foreach_smp_target(list, target->smp_targets) {
struct target *t = list->target;
riscv_info_t *r = riscv_info(t);
enum riscv_poll_hart out = riscv_poll_hart(t, r->current_hartid);
}
/* Sample memory if any target is running. */
- for (struct target_list *list = target->head; list;
- list = list->next, i++) {
+ foreach_smp_target(list, target->smp_targets) {
struct target *t = list->target;
if (t->state == TARGET_RUNNING) {
sample_memory(target);