clayborg added a comment.

In D140630#4056641 <https://reviews.llvm.org/D140630#4056641>, @cimacmillan 
wrote:

> @clayborg Thanks for your feedback. I'm part the way through implementing 
> your changes. Specifically about this point:
>
>> I seem to remember that it will disable this watchpoint as soon as a local 
>> variable goes out of scope, though I might not be remember things correctly
>
> This is a behaviour I'd like to address, where for instance watchpoints are 
> triggered in different functions because the stack frame addresses align. I 
> have this example, I can add a test for:
>
>   int test_a() {
>       int x = 10; <- watchpoint set here
>       x = 20; <- watchpoint triggered here
>   }
>   
>   int test_b() {
>       int b = 10; <- watchpoint triggered here also
>       b = 20;
>   }
>   
>   int main() {
>       test_a();
>       test_b();
>
> I've refactored the Watchpoint class to use "SBValue::Watch", and I can still 
> reproduce this behaviour. I also can't find where this watchpoint disable on 
> scope change might be implemented. Do you have any suggestions for this? 
> Thanks

Upon further examination it doesn't seem like this is happening, though it 
should be possible to add some things to the watchpoint classes to make this 
happen. This is beyond the scope of this fix though, so no need to do it unless 
you have time. What we would need to do is store a StackID (see 
"lldb/Target/StackID.h") and thread ID with the watchpoint. When the watchpoint 
triggers, we would need to check if the StackID + thread ID is valid (we should 
store this info with the watchpoint when setting it from a SBValue::Watch(...), 
or not if we just watch the address) still exists in the thread's stack 
somewhere. If it does still exist then stop and report, else clear the 
watchpoint and don't report anything. If the stack ID isn't valid then we 
always stop.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140630

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

Reply via email to