[Lldb-commits] [lldb] 259e3f2 - Remove IncrementFalseAlarmsAndReviseHitCount, unused ivars

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 20 15:16:11 PDT 2023


Author: Jason Molenda
Date: 2023-07-20T15:16:02-07:00
New Revision: 259e3f2a4fef5ff2cdc0086f432bbfd2493653f5

URL: https://github.com/llvm/llvm-project/commit/259e3f2a4fef5ff2cdc0086f432bbfd2493653f5
DIFF: https://github.com/llvm/llvm-project/commit/259e3f2a4fef5ff2cdc0086f432bbfd2493653f5.diff

LOG: Remove IncrementFalseAlarmsAndReviseHitCount, unused ivars

Reading through the Watchpoint class, I found this method
that wasn't being used properly, and a couple of ivars that
weren't used at all.  Cleanup.

Differential Revision: https://reviews.llvm.org/D155768

Added: 
    

Modified: 
    lldb/include/lldb/Breakpoint/Watchpoint.h
    lldb/source/Breakpoint/Watchpoint.cpp
    lldb/source/Target/StopInfo.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Breakpoint/Watchpoint.h b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 3ee75516debe8d..8fde3b563a3f06 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -63,8 +63,6 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
 
   ~Watchpoint() override;
 
-  void IncrementFalseAlarmsAndReviseHitCount();
-
   bool IsEnabled() const;
 
   // This doesn't really enable/disable the watchpoint.   It is currently just
@@ -214,12 +212,8 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
   // again, we check the count, if it is more than 1, it means the user-
   // supplied actions actually want the watchpoint to be disabled!
   uint32_t m_watch_read : 1, // 1 if we stop when the watched data is read from
-      m_watch_write : 1,     // 1 if we stop when the watched data is written to
-      m_watch_was_read : 1, // Set to 1 when watchpoint is hit for a read access
-      m_watch_was_written : 1;  // Set to 1 when watchpoint is hit for a write
-                                // access
+      m_watch_write : 1;     // 1 if we stop when the watched data is written to
   uint32_t m_ignore_count;      // Number of times to ignore this watchpoint
-  uint32_t m_false_alarms;      // Number of false alarms.
   std::string m_decl_str;       // Declaration information, if any.
   std::string m_watch_spec_str; // Spec for the watchpoint.
   lldb::ValueObjectSP m_old_value_sp;

diff  --git a/lldb/source/Breakpoint/Watchpoint.cpp b/lldb/source/Breakpoint/Watchpoint.cpp
index b6e6d4a5a32d5e..a20a4ad98c5a84 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -29,8 +29,7 @@ Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
     : StoppointSite(0, addr, size, hardware), m_target(target),
       m_enabled(false), m_is_hardware(hardware), m_is_watch_variable(false),
       m_is_ephemeral(false), m_disabled_count(0), m_watch_read(0),
-      m_watch_write(0), m_watch_was_read(0), m_watch_was_written(0),
-      m_ignore_count(0), m_false_alarms(0), m_being_created(true) {
+      m_watch_write(0), m_ignore_count(0), m_being_created(true) {
 
   if (type && type->IsValid())
     m_type = *type;
@@ -212,19 +211,6 @@ bool Watchpoint::CaptureWatchedValue(const ExecutionContext &exe_ctx) {
   return (m_new_value_sp && m_new_value_sp->GetError().Success());
 }
 
-void Watchpoint::IncrementFalseAlarmsAndReviseHitCount() {
-  ++m_false_alarms;
-  if (m_false_alarms) {
-    if (m_hit_counter.GetValue() >= m_false_alarms) {
-      m_hit_counter.Decrement(m_false_alarms);
-      m_false_alarms = 0;
-    } else {
-      m_false_alarms -= m_hit_counter.GetValue();
-      m_hit_counter.Reset();
-    }
-  }
-}
-
 // RETURNS - true if we should stop at this breakpoint, false if we
 // should continue.
 

diff  --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index 8bcb16c391e031..efc8fd269ac29f 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -894,7 +894,7 @@ class StopInfoWatchpoint : public StopInfo {
 
         if (m_silently_skip_wp) {
           m_should_stop = false;
-          wp_sp->IncrementFalseAlarmsAndReviseHitCount();
+          wp_sp->UndoHitCount();
         }
 
         if (wp_sp->GetHitCount() <= wp_sp->GetIgnoreCount()) {


        


More information about the lldb-commits mailing list