omjavaid added a comment.

I agree that silent continue was wrong and should be fixed. I tried for  to 
remember what I was trying to do when I wrote that patch ... still dont 
remember much but digged out some information that may be useful for this patch 
review.

We had a bunch of funny behaving hardware mostly Nexus phones with different 
types of watchpoint behavior being implement by every vendor.

From our local record i found that stp issue was never fixed. Some vendor 
machines reported correct hit_address while some didnt. In LLVM we do have bug 
report for another of these issues in one of the cases where STP instruction 
can trigger multiple watchpoints located side by side. 
https://bugs.llvm.org/show_bug.cgi?id=30758

On Linux ptrace is responsible for reporting a watchpoint hit address and also 
responsible for setting/unsetting watchpoints. In case of Arm64 ptrace while 
reporting watchpoints performs some heuristic based calculations to exactly 
cater for the case you have mentioned where access reports a address out of 
range. See watchpoint_handler code 
here:https://elixir.bootlin.com/linux/latest/source/arch/arm64/kernel/hw_breakpoint.c#L754

And this comment copied from same file :
/*

- Arm64 hardware does not always report a watchpoint hit address that matches
- one of the watchpoints set. It can also report an address "near" the
- watchpoint if a single instruction access both watched and unwatched
- addresses. There is no straight-forward way, short of disassembling the
- offending instruction, to map that address back to the watchpoint. This
- function computes the distance of the memory access from the watchpoint as a
- heuristic for the likelihood that a given access triggered the watchpoint. *
- See Section D2 <https://reviews.llvm.org/D2>.10.5 "Determining the memory 
location that caused a Watchpoint
- exception" of ARMv8 Architecture Reference Manual for details. *
- The function returns the distance of the address from the bytes watched by
- the watchpoint. In case of an exact match, it returns 0. */


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147674/new/

https://reviews.llvm.org/D147674

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to