[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
This commit is contained in:
Dave Lee 2021-02-13 15:48:05 -08:00
parent 2a2464eb76
commit 22f0aa0d9e
7 changed files with 4 additions and 44 deletions

View File

@ -1052,10 +1052,6 @@ public:
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

View File

@ -48,10 +48,6 @@ public:
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();

View File

@ -50,14 +50,6 @@ public:
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 @@ protected:
private:
bool TracerExplainsStop();
bool m_single_step;
bool m_enabled;
lldb::StreamSP m_stream_sp;
Thread *m_thread;

View File

@ -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:

View File

@ -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();

View File

@ -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:

View File

@ -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