target: Rework 'set' variable of break-/watchpoints
authorMarc Schink <dev@zapb.de>
Sun, 13 Jun 2021 09:21:18 +0000 (11:21 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 19 Mar 2022 09:14:39 +0000 (09:14 +0000)
commitfb43f1ff4e2f0638110ffcc4e63bee8b5361db64
treed0becbf2571ba22a36de3b5c5d5b42063a1a8861
parentab43721be6ff7470ff8b9771c95c1d5661a5a689
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>
21 files changed:
src/target/aarch64.c
src/target/arc.c
src/target/arm7_9_common.c
src/target/arm_dpm.c
src/target/armv8_dpm.c
src/target/breakpoints.c
src/target/breakpoints.h
src/target/cortex_a.c
src/target/cortex_m.c
src/target/esirisc.c
src/target/lakemont.c
src/target/mips_m4k.c
src/target/mips_mips64.c
src/target/nds32.c
src/target/nds32_v3_common.c
src/target/openrisc/or1k.c
src/target/riscv/riscv.c
src/target/stm8.c
src/target/target.c
src/target/x86_32_common.c
src/target/xscale.c