Useful to display a better message in case of a read hit. The code currently
treats reads and writes identically but displaying something like:
(fhpd) Watchpoint hit: double_
Value before hit = 1.2
Value after hit = 1.2
which has no real meaning in case of a read hit.
I investigated this a bit and this is what I came up with.
- When the user sets a read only watchpoint, they will know that the watchpoint
is triggering due to it being specific read only watchpoint. Writes to memory
will not trigger this watchpoint.
- When the user sets a read and write watchpoint it becomes a bit more
complicated. If the value changed, then obviously a write occurred. If the value
did not change then a read of that memory, or alternatively a write of the same
value at that memory occurred. However in the case of IA32 and X8664 there is no
method in hardware to determine if the watchpoint triggered due to a read, or
write of the same value. All that exists in hardware is a bit set in the debug
status register indicating that the watchpoint fired. There is not enough
information present in the debug registers to make this determination.
A possible way to determine this would be to look at that the last instruction
that occurred when a watchpoint triggers. On IA32 and X8664 the watchpoint
triggers after the instruction that causes it to trigger completes. However this
invariably will change with different ISAs.