[Lldb-commits] [lldb] 22f0aa0 - [lldb] Remove unused ThreadPlan tracer utilities (NFC)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 15 17:59:53 PST 2021


Author: Dave Lee
Date: 2021-02-15T17:59:25-08:00
New Revision: 22f0aa0d9ebddb004cbf2d0e7c8c015422351d2b

URL: https://github.com/llvm/llvm-project/commit/22f0aa0d9ebddb004cbf2d0e7c8c015422351d2b
DIFF: https://github.com/llvm/llvm-project/commit/22f0aa0d9ebddb004cbf2d0e7c8c015422351d2b.diff

LOG: [lldb] Remove unused ThreadPlan tracer utilities (NFC)

Delete unused `EnableTracer()` and `SetTracer()` functions on `Thread`. By deleting
these, their `ThreadPlan` counterparts also become unused.

Then, by deleting `ThreadPlanStack::EnableTracer`, `EnableSingleStep` becomes unused.
With no more callers to `EnableSingleStep`, the value `m_single_step` is always true and
can be removed as well.

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

Added: 
    

Modified: 
    lldb/include/lldb/Target/Thread.h
    lldb/include/lldb/Target/ThreadPlanStack.h
    lldb/include/lldb/Target/ThreadPlanTracer.h
    lldb/source/Target/Thread.cpp
    lldb/source/Target/ThreadPlan.cpp
    lldb/source/Target/ThreadPlanStack.cpp
    lldb/source/Target/ThreadPlanTracer.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h
index 04fa210fd4e4..b797e4d1ee97 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -1052,10 +1052,6 @@ class Thread : public std::enable_shared_from_this<Thread>,
 
   void RestoreThreadStateFromCheckpoint(ThreadStateCheckpoint &saved_state);
 
-  void EnableTracer(bool value, bool single_step);
-
-  void SetTracer(lldb::ThreadPlanTracerSP &tracer_sp);
-
   // Get the thread index ID. The index ID that is guaranteed to not be re-used
   // by a process. They start at 1 and increase with each new thread. This
   // allows easy command line access by a unique ID that is easier to type than

diff  --git a/lldb/include/lldb/Target/ThreadPlanStack.h b/lldb/include/lldb/Target/ThreadPlanStack.h
index 7b2817b2e8fd..a5fcf00242b3 100644
--- a/lldb/include/lldb/Target/ThreadPlanStack.h
+++ b/lldb/include/lldb/Target/ThreadPlanStack.h
@@ -48,10 +48,6 @@ class ThreadPlanStack {
 
   void ThreadDestroyed(Thread *thread);
 
-  void EnableTracer(bool value, bool single_stepping);
-
-  void SetTracer(lldb::ThreadPlanTracerSP &tracer_sp);
-
   void PushPlan(lldb::ThreadPlanSP new_plan_sp);
 
   lldb::ThreadPlanSP PopPlan();

diff  --git a/lldb/include/lldb/Target/ThreadPlanTracer.h b/lldb/include/lldb/Target/ThreadPlanTracer.h
index 677a2c0dd93c..a6fd2f031dc2 100644
--- a/lldb/include/lldb/Target/ThreadPlanTracer.h
+++ b/lldb/include/lldb/Target/ThreadPlanTracer.h
@@ -50,14 +50,6 @@ class ThreadPlanTracer {
 
   bool TracingEnabled() { return m_enabled; }
 
-  bool EnableSingleStep(bool value) {
-    bool old_value = m_single_step;
-    m_single_step = value;
-    return old_value;
-  }
-
-  bool SingleStepEnabled() { return m_single_step; }
-  
   Thread &GetThread();
 
 protected:
@@ -71,7 +63,6 @@ class ThreadPlanTracer {
 private:
   bool TracerExplainsStop();
 
-  bool m_single_step;
   bool m_enabled;
   lldb::StreamSP m_stream_sp;
   Thread *m_thread;

diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 1fb19aea4fd9..6cbad2376201 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -1180,14 +1180,6 @@ Status Thread::QueueThreadPlan(ThreadPlanSP &thread_plan_sp,
   return status;
 }
 
-void Thread::EnableTracer(bool value, bool single_stepping) {
-  GetPlans().EnableTracer(value, single_stepping);
-}
-
-void Thread::SetTracer(lldb::ThreadPlanTracerSP &tracer_sp) {
-  GetPlans().SetTracer(tracer_sp);
-}
-
 bool Thread::DiscardUserThreadPlansUpToIndex(uint32_t plan_index) {
   // Count the user thread plans from the back end to get the number of the one
   // we want to discard:

diff  --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp
index df59da157319..84fd6b2107b6 100644
--- a/lldb/source/Target/ThreadPlan.cpp
+++ b/lldb/source/Target/ThreadPlan.cpp
@@ -156,8 +156,7 @@ bool ThreadPlan::OkayToDiscard() {
 }
 
 lldb::StateType ThreadPlan::RunState() {
-  if (m_tracer_sp && m_tracer_sp->TracingEnabled() &&
-      m_tracer_sp->SingleStepEnabled())
+  if (m_tracer_sp && m_tracer_sp->TracingEnabled())
     return eStateStepping;
   else
     return GetPlanRunState();

diff  --git a/lldb/source/Target/ThreadPlanStack.cpp b/lldb/source/Target/ThreadPlanStack.cpp
index ad37669c31fd..5a4ca8812136 100644
--- a/lldb/source/Target/ThreadPlanStack.cpp
+++ b/lldb/source/Target/ThreadPlanStack.cpp
@@ -124,20 +124,6 @@ void ThreadPlanStack::ThreadDestroyed(Thread *thread) {
   }
 }
 
-void ThreadPlanStack::EnableTracer(bool value, bool single_stepping) {
-  for (ThreadPlanSP plan : m_plans) {
-    if (plan->GetThreadPlanTracer()) {
-      plan->GetThreadPlanTracer()->EnableTracing(value);
-      plan->GetThreadPlanTracer()->EnableSingleStep(single_stepping);
-    }
-  }
-}
-
-void ThreadPlanStack::SetTracer(lldb::ThreadPlanTracerSP &tracer_sp) {
-  for (ThreadPlanSP plan : m_plans)
-    plan->SetThreadPlanTracer(tracer_sp);
-}
-
 void ThreadPlanStack::PushPlan(lldb::ThreadPlanSP new_plan_sp) {
   // If the thread plan doesn't already have a tracer, give it its parent's
   // tracer:

diff  --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp
index e7ef0af8ec2d..754ce655729c 100644
--- a/lldb/source/Target/ThreadPlanTracer.cpp
+++ b/lldb/source/Target/ThreadPlanTracer.cpp
@@ -35,11 +35,11 @@ using namespace lldb_private;
 
 ThreadPlanTracer::ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp)
     : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()),
-      m_single_step(true), m_enabled(false), m_stream_sp(stream_sp) {}
+      m_enabled(false), m_stream_sp(stream_sp) {}
 
 ThreadPlanTracer::ThreadPlanTracer(Thread &thread)
     : m_process(*thread.GetProcess().get()), m_tid(thread.GetID()),
-      m_single_step(true), m_enabled(false), m_stream_sp() {}
+      m_enabled(false), m_stream_sp() {}
 
 Stream *ThreadPlanTracer::GetLogStream() {
   if (m_stream_sp)
@@ -75,7 +75,7 @@ void ThreadPlanTracer::Log() {
 }
 
 bool ThreadPlanTracer::TracerExplainsStop() {
-  if (m_enabled && m_single_step) {
+  if (m_enabled) {
     lldb::StopInfoSP stop_info = GetThread().GetStopInfo();
     return (stop_info->GetStopReason() == eStopReasonTrace);
   } else


        


More information about the lldb-commits mailing list