target/cortex_a: fix number of watchpoints
Decrement the available watchpoints only when succeed setting it. Initialize the available watchpoint with the correct value. Change-Id: I0f93b347300b8ebedbcd9e718d4ba32b26cf6846 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6196 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
This commit is contained in:
parent
1fb736f6c5
commit
ffaef5809c
|
@ -1802,8 +1802,12 @@ static int cortex_a_add_watchpoint(struct target *target, struct watchpoint *wat
|
||||||
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int retval = cortex_a_set_watchpoint(target, watchpoint);
|
||||||
|
if (retval != ERROR_OK)
|
||||||
|
return retval;
|
||||||
|
|
||||||
cortex_a->wrp_num_available--;
|
cortex_a->wrp_num_available--;
|
||||||
return cortex_a_set_watchpoint(target, watchpoint);
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3007,7 +3011,7 @@ static int cortex_a_examine_first(struct target *target)
|
||||||
|
|
||||||
/* Setup Watchpoint Register Pairs */
|
/* Setup Watchpoint Register Pairs */
|
||||||
cortex_a->wrp_num = ((didr >> 28) & 0x0F) + 1;
|
cortex_a->wrp_num = ((didr >> 28) & 0x0F) + 1;
|
||||||
cortex_a->wrp_num_available = cortex_a->brp_num;
|
cortex_a->wrp_num_available = cortex_a->wrp_num;
|
||||||
free(cortex_a->wrp_list);
|
free(cortex_a->wrp_list);
|
||||||
cortex_a->wrp_list = calloc(cortex_a->wrp_num, sizeof(struct cortex_a_wrp));
|
cortex_a->wrp_list = calloc(cortex_a->wrp_num, sizeof(struct cortex_a_wrp));
|
||||||
for (i = 0; i < cortex_a->wrp_num; i++) {
|
for (i = 0; i < cortex_a->wrp_num; i++) {
|
||||||
|
|
Loading…
Reference in New Issue