target: Rework 'set' variable of break-/watchpoints 19/6319/10
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

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)