Skip to content
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

Match Trigger (type2) tdata1.timing field may be too restricted #1021

Open
Dolu1990 opened this issue Feb 28, 2024 · 6 comments
Open

Match Trigger (type2) tdata1.timing field may be too restricted #1021

Dolu1990 opened this issue Feb 28, 2024 · 6 comments

Comments

@Dolu1990
Copy link
Contributor

Hi,

Currently, if you use a match trigger type 2 on a load/store address, the riscv openocd port only accept implementation with tdata1.timing=0

It is done on purpose ? or maybe we could add the tdata1.timing bit in the match_triggers_tdata1_fields.tdata1_ignore_mask ?

.tdata1_ignore_mask = CSR_MCONTROL_MASKMAX(riscv_xlen(target))

Regards

@TommyMurphyTM1234
Copy link
Collaborator

tdata1.timing=0

Did you mean mcontrol.timing?

@en-sc
Copy link
Collaborator

en-sc commented Feb 28, 2024

Thank you for highlighting the issue!

Your suggestion will cause some troubles with chained triggers: if mcontrol.timing is ignored when setting up the chain, it will be possible to create a chain with different timings, that will never fire.

The mcontrol.timing field can be added to tdata1_ignore_mask conditionally, in case ge_lt triggers are disabled for watchpoints.

But there is still the issue, of mcontrol.timing being recommended to be set to 1 for address watchpoints and HW breakpoints. Data watchpoints are not yet supported in RISC-V OpenOCD for now.

@Dolu1990
Copy link
Contributor Author

Did you mean mcontrol.timing?

Yes right ^^

Data watchpoints are not yet supported in RISC-V OpenOCD for now.

Right. That would be great to have :D
(as hardware breapoint are also used for microcontroller debugging, where you often can't afford the side-effect of GDB evaluating breakpoint conditions without hardware support)

The mcontrol.timing field can be added to tdata1_ignore_mask conditionally, in case ge_lt triggers are disabled for watchpoints

Ahhh i also need those.
Maybe it would be the job of the functions which setup chains to ensure things goes well ? Or else, as a workaround, could add an riscv target option to set the prefered timing mode, but that isn't so nice i guess.

@en-sc
Copy link
Collaborator

en-sc commented Feb 29, 2024

Right. That would be great to have :D (as hardware breapoint are also used for microcontroller debugging, where you often can't afford the side-effect of GDB evaluating breakpoint conditions without hardware support)

It most definitely would, however, do you have an access to a HW/simulator that does support such triggers? AFAIK, Spike does not.

Or else, as a workaround, could add an riscv target option to set the prefered timing mode, but that isn't so nice i guess.

I don't see this as a workaround. In fact, I think this is the preferred approach. Currently, the mcontrol.timing field value is selected as recommended by [Table 5.10: Suggested Trigger Timings]. The change in the value changes user-observable behavior of BPs/WPs. So, IMHO, the user should explicitly ask for it.

@Dolu1990
Copy link
Contributor Author

Dolu1990 commented Mar 1, 2024

It most definitely would, however, do you have an access to a HW/simulator that does support such triggers? AFAIK, Spike does not.

I'm working on adding trigger / watchpoint support in VexRiscv (HW cpu).
So far i was testing in HW simulation using verilator.

My first implementation was about implementing all the address / data triggers to happen after the instruction, but that doesn't work well with GDB, as it kinda realy expect address trigger to cancel the instruction commit.
So i'm now reworking the HW implementation to have triggers working before commit, and dropping load data trigger.

@en-sc
Copy link
Collaborator

en-sc commented Mar 7, 2024

Related to #556

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

No branches or pull requests

3 participants