Skip to content

Commit

Permalink
target/riscv: Reject size 2 soft breakpoints when C extension not sup…
Browse files Browse the repository at this point in the history
…ported

This patch disables software breakpoints of size 2 for targets
which don't support compressed instructions.

Change-Id: I8200b22a51c97ba2aa89e6328beadde8dd35cdd5
Signed-off-by: Marek Vrbka <[email protected]>
  • Loading branch information
MarekVCodasip committed Aug 25, 2023
1 parent 928f2b3 commit 159a49d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/target/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ static int riscv_add_breakpoint(struct target *target, struct breakpoint *breakp
assert(breakpoint);
if (breakpoint->type == BKPT_SOFT) {
/** @todo check RVC for size/alignment */
if (!(breakpoint->length == 4 || breakpoint->length == 2)) {
if (!(breakpoint->length == 4 || (breakpoint->length == 2 && riscv_supports_extension(target, 'C')))) {
LOG_TARGET_ERROR(target, "Invalid breakpoint length %d", breakpoint->length);
return ERROR_FAIL;
}
Expand Down

0 comments on commit 159a49d

Please sign in to comment.