DavidSpickett wrote:

Will need some time to give this proper attention, but - 

> The original goal of my work was to enable watchpoint functionality at any 
> cost on targets without hardware watchpoint support, in particular riscv.

Can you be specific here, what is the state of watchpoints for RISC-V? 
Proposal, ratified, available in hardware, only available in simulation?

If this were the only reason to have software watchpoints, I would be hesitant 
to accept them if in a few years time RISC-V was going to have hardware 
watchpoints anyway.

See also hardware single stepping being missing for a while, but in that case 
at least the software step is not user visible. So we could remove it once the 
majority of hardware does support it.

Windows on Arm in theory has hardware watchpoints but the APIs to discover them 
are immature. Happy to wait for Microsoft to fix that though, wouldn't justify 
this feature on its own.

> Moreover, while hardware watchpoints only work for memory locations, software 
> watchpoints don't have this limitation. In the future, we could use them to 
> monitor registers and other complex expressions, like gdb do.

This sounds like a more persuasive use case for me.

> This functionality has long been available in GDB, so it is also necessary 
> for LLDB.

I am interested in what they have done with them. Can you link any relevant 
documentation for it? A set of examples would be ideal.

> All logic is implemented at the LLDB client level, as the
> GDB remote protocol currently does not support packets
> that establish software watchpoints.

I take from this that GDB also does not use extra remote protocol packets to 
implement this? Which is fine, we would aim to match GDB first before extending 
anything.

GDB code breaks actually can have a condition list that's evaluated on the 
target side:
```
cond_list is an optional list of conditional expressions in bytecode form that 
should be evaluated on the target’s side. These are the conditions that should 
be taken into consideration when deciding if the breakpoint trigger should be 
reported back to GDB.
```
Which is along the same lines, but they'd need the debug server to be aware 
that a software watch was set for this to be used in that situation.

https://github.com/llvm/llvm-project/pull/151195
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to