aboutsummaryrefslogtreecommitdiff
path: root/src/target/armv8_dpm.c
diff options
context:
space:
mode:
authorMarc Schink <dev@zapb.de>2021-06-13 11:21:18 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2022-03-19 09:14:39 +0000
commitfb43f1ff4e2f0638110ffcc4e63bee8b5361db64 (patch)
treed0becbf2571ba22a36de3b5c5d5b42063a1a8861 /src/target/armv8_dpm.c
parentab43721be6ff7470ff8b9771c95c1d5661a5a689 (diff)
downloadriscv-openocd-fb43f1ff4e2f0638110ffcc4e63bee8b5361db64.zip
riscv-openocd-fb43f1ff4e2f0638110ffcc4e63bee8b5361db64.tar.gz
riscv-openocd-fb43f1ff4e2f0638110ffcc4e63bee8b5361db64.tar.bz2
target: Rework 'set' variable of break-/watchpoints
The 'set' variable name suggests a boolean data type which determines whether a breakpoint (or watchpoint) is active. However, it is also used to store the number of the breakpoint. This encoding leads to inconsistent value assignments: boolean and integer values are mixed. Also, associated hardware comparator numbers, which are usually numbered from 0, cannot be used directly. An additional offset is required to store the comparator numbers. In order to make the code more readable and the value assignment more consistent, change the variable name to 'is_set', its data type to 'bool' and introduce a dedicated variable for the break-/watchpoint number. In order to make the review easier, the data types of various related variables (e.g. number of breakpoints) are not changed. While at it, fix a few coding style issues. Change-Id: I2193f5639247cce6b80580d4c1c6afee916aeb82 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/6319 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/target/armv8_dpm.c')
-rw-r--r--src/target/armv8_dpm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/target/armv8_dpm.c b/src/target/armv8_dpm.c
index 188e588..765f1b7 100644
--- a/src/target/armv8_dpm.c
+++ b/src/target/armv8_dpm.c
@@ -818,7 +818,7 @@ fail:
* or running debugger code.
*/
static int dpmv8_maybe_update_bpwp(struct arm_dpm *dpm, bool bpwp,
- struct dpm_bpwp *xp, int *set_p)
+ struct dpm_bpwp *xp, bool *set_p)
{
int retval = ERROR_OK;
bool disable;
@@ -892,7 +892,7 @@ int armv8_dpm_write_dirty_registers(struct arm_dpm *dpm, bool bpwp)
struct breakpoint *bp = dbp->bp;
retval = dpmv8_maybe_update_bpwp(dpm, bpwp, &dbp->bpwp,
- bp ? &bp->set : NULL);
+ bp ? &bp->is_set : NULL);
if (retval != ERROR_OK)
goto done;
}
@@ -904,7 +904,7 @@ int armv8_dpm_write_dirty_registers(struct arm_dpm *dpm, bool bpwp)
struct watchpoint *wp = dwp->wp;
retval = dpmv8_maybe_update_bpwp(dpm, bpwp, &dwp->bpwp,
- wp ? &wp->set : NULL);
+ wp ? &wp->is_set : NULL);
if (retval != ERROR_OK)
goto done;
}