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>
This commit is contained in:
committed by
Antonio Borneo
parent
ab43721be6
commit
fb43f1ff4e
@@ -923,9 +923,9 @@ static int or1k_add_breakpoint(struct target *target,
|
||||
struct or1k_du *du_core = or1k_to_du(or1k);
|
||||
uint8_t data;
|
||||
|
||||
LOG_DEBUG("Adding breakpoint: addr 0x%08" TARGET_PRIxADDR ", len %d, type %d, set: %d, id: %" PRIu32,
|
||||
LOG_DEBUG("Adding breakpoint: addr 0x%08" TARGET_PRIxADDR ", len %d, type %d, id: %" PRIu32,
|
||||
breakpoint->address, breakpoint->length, breakpoint->type,
|
||||
breakpoint->set, breakpoint->unique_id);
|
||||
breakpoint->unique_id);
|
||||
|
||||
/* Only support SW breakpoints for now. */
|
||||
if (breakpoint->type == BKPT_HARD)
|
||||
@@ -981,9 +981,9 @@ static int or1k_remove_breakpoint(struct target *target,
|
||||
struct or1k_common *or1k = target_to_or1k(target);
|
||||
struct or1k_du *du_core = or1k_to_du(or1k);
|
||||
|
||||
LOG_DEBUG("Removing breakpoint: addr 0x%08" TARGET_PRIxADDR ", len %d, type %d, set: %d, id: %" PRIu32,
|
||||
LOG_DEBUG("Removing breakpoint: addr 0x%08" TARGET_PRIxADDR ", len %d, type %d, id: %" PRIu32,
|
||||
breakpoint->address, breakpoint->length, breakpoint->type,
|
||||
breakpoint->set, breakpoint->unique_id);
|
||||
breakpoint->unique_id);
|
||||
|
||||
/* Only support SW breakpoints for now. */
|
||||
if (breakpoint->type == BKPT_HARD)
|
||||
|
||||
Reference in New Issue
Block a user