Skip to content

target/riscv/riscv.c: support auto-selection of software breakpoint size #1273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: riscv
Choose a base branch
from

Conversation

AlexandraKulyatskaya
Copy link

Add auto-selection of breakpoint size for RISC-V targets. The new length depends on C extension. If the C extension is used, the auto-selected length is 2 bytes. Otherwise, the default length is 4 bytes.

Change-Id: Ie3473514beace15b76714aa6d5441122cd3262aa

@aap-sc aap-sc requested review from JanMatCodasip and en-sc and removed request for JanMatCodasip July 3, 2025 14:39
@AlexandraKulyatskaya AlexandraKulyatskaya force-pushed the a.kulyatskaya/auto-selection-bp-size branch 2 times, most recently from 427b9ee to 3cf367c Compare July 3, 2025 15:16
Add auto-selection of breakpoint size for RISC-V targets. The new length
depends on C extension. If the C extension is used, the auto-selected
length is 2 bytes. Otherwise, the default length is 4 bytes.

Change-Id: Ie3473514beace15b76714aa6d5441122cd3262aa
Signed-off-by: Kulyatskaya Alexandra <a.kulyatskaya@syntacore.com>
@AlexandraKulyatskaya AlexandraKulyatskaya force-pushed the a.kulyatskaya/auto-selection-bp-size branch from 3cf367c to e307df1 Compare July 3, 2025 15:26
@aap-sc aap-sc requested a review from JanMatCodasip July 3, 2025 16:43
@en-sc
Copy link
Collaborator

en-sc commented Jul 7, 2025

@AlexandraKulyatskaya, I'd suggest avoiding modifying the length of the breakpoint.

Consider instead introducing a new target_type method, something like get_default_breakpoint_length to be used in handle_bp_command_set() in case the user wants a default-length breakpoint.
IMHO, this will allow to avoid introducing special cases and simplify reasoning about breacpoint's lifecycle.

Please, note that in general get_default_breakpoint_length may fail if it requires communication with the target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants