X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Fnds32_v3_common.c;h=e88430f2b93e69413ff969af0fbd170379c8933b;hp=b524679e286e2eae1c4fdc8e90e21cff86360fb6;hb=a8d0fec087b18d44a05124e48fa9f2ef111d3e8a;hpb=6b9c491257dead736b4fd35c21b50f3cf3d2807d diff --git a/src/target/nds32_v3_common.c b/src/target/nds32_v3_common.c index b524679e28..e88430f2b9 100644 --- a/src/target/nds32_v3_common.c +++ b/src/target/nds32_v3_common.c @@ -240,6 +240,7 @@ static int nds32_v3_get_exception_address(struct nds32 *nds32, uint32_t match_count; int32_t i; static int32_t number_of_hard_break; + uint32_t bp_control; if (number_of_hard_break == 0) { aice_read_debug_reg(aice, NDS_EDM_SR_EDM_CFG, &edm_cfg); @@ -255,6 +256,14 @@ static int nds32_v3_get_exception_address(struct nds32 *nds32, if (match_bits & (1 << i)) { aice_read_debug_reg(aice, NDS_EDM_SR_BPA0 + i, address); match_count++; + + /* If target hits multiple read/access watchpoint, + * select the first one. */ + aice_read_debug_reg(aice, NDS_EDM_SR_BPC0 + i, &bp_control); + if (0x3 == (bp_control & 0x3)) { + match_count = 1; + break; + } } }