This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [NFC] Remove some dead code from Watchpoint class, and a method that makes no sense
ClosedPublic

Authored by jasonmolenda on Jul 19 2023, 6:19 PM.

Details

Summary

Johnny Chen added this code to Watchpoint originally in 2012 via 25c0eb4a38d20a4ac37714312cfcabdd082ff74f / llvm-svn: 161892 including the method Watchpoint::IncrementFalseAlarmsAndReviseHitCount. Most of the code from this change has slowly been removed over the years, but that method remained, and was used for watchpoints hit on a MIPS target where the access was *near* a watchpoint, but not actually within a watched region (the hardware doesn't distinguish the low 3 bits, and lldb has an emulation of the LD/ST instruction to disambiguate). The MIPS case was trying to use this method to decrement the hit count, which had already been incremented earlier when the watchpoint hit was first broadcast. The method is doing signed math on unsigned counters and I can't honestly tell what it was meant to be doing in the first place.

We have a method to decrement the hit count. Use it.

Also remove a couple of ivars in Watchpoint that aren't used anywhere.

Diff Detail

Event Timeline

jasonmolenda created this revision.Jul 19 2023, 6:19 PM
jasonmolenda requested review of this revision.Jul 19 2023, 6:19 PM
DavidSpickett accepted this revision.Jul 20 2023, 2:00 AM
DavidSpickett added a subscriber: DavidSpickett.

I don't understand the logic for if the hit counter is < the number of false alarms. I'm not even sure that's possible given that a false alarm would have to come from a reported hit, wouldn't it?

Maybe there is a behaviour difference when using UndohitCount but I don't think it's worth worrying about. LGTM.

This revision is now accepted and ready to land.Jul 20 2023, 2:00 AM

Thanks David, yeah I came to the same conclusion about that method. I made hacked up lldb that behaved like the MIPS case to confirm that the hit count is incremented before we decide it's a fake stop & decrement it again.

This revision was landed with ongoing or failed builds.Jul 20 2023, 3:16 PM
This revision was automatically updated to reflect the committed changes.