Open en-sc opened 3 months ago
Moreover, seems like the state
array is redundant here -- all watchpoints are enabled/disabled at once.
It sounds like a reasonable fix would be to:
target->watchpoints
or similar data structure.trigger_unique_id
in struct riscv_info
.target->watchpoints
structure in the process.
Currently,
disable_triggers()
just goes through all the WPs and disables them one-by-one (the case whenr->manual_hwbp_set
isfalse
): https://github.com/riscv-collab/riscv-openocd/blob/5afed58fcdb67ff87842dad9c3ab7f73ca0c8cd8/src/target/riscv/riscv.c#L2487-L2499enable_triggers()
works accordingly: https://github.com/riscv-collab/riscv-openocd/blob/5afed58fcdb67ff87842dad9c3ab7f73ca0c8cd8/src/target/riscv/riscv.c#L2526-L2536Now consider the following situation:
taget->watchpoints
points to WP 2.taget->watchpoints->next
points to WP 3.disable_triggers()
is called (e.g. duringstep
).enable_triggers()
will try to re-enable the disabled WP, but will fail, since WP 2 will occupy 1-st trigger and 2-nd triggerdoes not support WP 3.