More cleanup.

Change-Id: I804bdcec23b69d77dfc376e23c6d1f29f99e7335
This commit is contained in:
Tim Newsome
2019-01-25 15:31:42 -08:00
parent 96df1db7b1
commit e186f62962
5 changed files with 8 additions and 47 deletions
-2
View File
@@ -549,8 +549,6 @@ int watchpoint_hit(struct target *target, enum watchpoint_rw *rw,
int retval;
struct watchpoint *hit_watchpoint;
LOG_DEBUG("[%d]", target->coreid);
retval = target_hit_watchpoint(target, &hit_watchpoint);
if (retval != ERROR_OK)
return ERROR_FAIL;
+6 -39
View File
@@ -648,33 +648,12 @@ static void trigger_from_watchpoint(struct trigger *trigger,
int riscv_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
{
LOG_DEBUG("[%d] @0x%" TARGET_PRIxADDR, target->coreid, watchpoint->address);
struct trigger trigger;
trigger_from_watchpoint(&trigger, watchpoint);
if (target->smp) {
struct target *failed = NULL;
for (struct target_list *list = target->head; list != NULL;
list = list->next) {
struct target *t = list->target;
if (add_trigger(t, &trigger) != ERROR_OK) {
failed = t;
break;
}
}
if (failed) {
for (struct target_list *list = target->head;
list->target != failed; list = list->next) {
struct target *t = list->target;
remove_trigger(t, &trigger);
}
return ERROR_FAIL;
}
} else {
int result = add_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
}
int result = add_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
watchpoint->set = true;
return ERROR_OK;
@@ -688,21 +667,9 @@ int riscv_remove_watchpoint(struct target *target,
struct trigger trigger;
trigger_from_watchpoint(&trigger, watchpoint);
if (target->smp) {
bool failed = false;
for (struct target_list *list = target->head; list != NULL;
list = list->next) {
struct target *t = list->target;
if (remove_trigger(t, &trigger) != ERROR_OK)
failed = true;
}
if (failed)
return ERROR_FAIL;
} else {
int result = remove_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
}
int result = remove_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
watchpoint->set = false;
return ERROR_OK;
-2
View File
@@ -1206,8 +1206,6 @@ int target_hit_watchpoint(struct target *target,
return ERROR_FAIL;
}
LOG_DEBUG("[%d]", target->coreid);
return target->type->hit_watchpoint(target, hit_watchpoint);
}