[NativeProcessLinux] Remove the stop callback
Summary:
The stop callback is a remnant of the ThreadStateCoordinator. We don't need it now that TSC is
gone, as we know exactly which function to call when threads stop. This also removes some
stop-related functions, which were just forwarding calls to one another.
Test Plan: ninja check-lldb continues to pass
Reviewers: chaoren, ovyalov
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9531
llvm-svn: 236814
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
index 1c6f7d9..d5a57b0 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -347,68 +347,51 @@
// ThreadStateCoordinator helper methods.
void
- NotifyThreadCreateStopped (lldb::tid_t tid);
-
- void
- NotifyThreadCreateRunning (lldb::tid_t tid);
-
- void
NotifyThreadDeath (lldb::tid_t tid);
- void
- StopRunningThreads (lldb::tid_t triggering_tid);
-
- void
- StopRunningThreadsWithSkipTID (lldb::tid_t deferred_signal_tid,
- lldb::tid_t skip_stop_request_tid);
-
Error
Detach(lldb::tid_t tid);
- Error
- RequestThreadStop (const lldb::pid_t pid, const lldb::tid_t tid);
-
public:
// Typedefs.
typedef std::unordered_set<lldb::tid_t> ThreadIDSet;
// Callback/block definitions.
- typedef std::function<Error (lldb::tid_t tid)> StopThreadFunction;
typedef std::function<Error (lldb::tid_t tid, bool supress_signal)> ResumeThreadFunction;
private:
- // Notify the coordinator when a thread is created and/or starting to be
- // tracked. is_stopped should be true if the thread is currently stopped;
- // otherwise, it should be set false if it is already running. Will
- // call the error function if the thread id is already tracked.
+ enum class ThreadState
+ {
+ Running,
+ Stopped
+ };
+
+ // Notify that a thread is created and/or starting to be
+ // tracked. The state parameter should reflect whether the thread is created in a running
+ // or stopped state.
void
- NotifyThreadCreate(lldb::tid_t tid, bool is_stopped);
+ NotifyThreadCreate(lldb::tid_t tid, ThreadState state);
// Notify the delegate after a given set of threads stops. The triggering_tid will be set
// as the current thread. The error_function will be fired if either the triggering tid
// or any of the wait_for_stop_tids are unknown.
void
- StopThreads(lldb::tid_t triggering_tid,
- const ThreadIDSet &wait_for_stop_tids,
- const StopThreadFunction &request_thread_stop_function);
+ StopThreads(lldb::tid_t triggering_tid, const ThreadIDSet &wait_for_stop_tids);
// Notify the delegate after all non-stopped threads stop. The triggering_tid will be set
// as the current thread. The error_function will be fired if the triggering tid
// is unknown.
void
- StopRunningThreads(lldb::tid_t triggering_tid,
- const StopThreadFunction &request_thread_stop_function);
+ StopRunningThreads(lldb::tid_t triggering_tid);
// Notify the delegate after all non-stopped threads stop. The triggering_tid will be set
// as the current thread. The error_function will be fired if either the triggering tid
// or any of the wait_for_stop_tids are unknown. This variant will send stop requests to
- // all non-stopped threads except for any contained in skip_stop_request_tids.
+ // all non-stopped threads except skip_stop_request_tid.
void
- StopRunningThreadsWithSkipTID(lldb::tid_t triggering_tid,
- const ThreadIDSet &skip_stop_request_tids,
- const StopThreadFunction &request_thread_stop_function);
+ StopRunningThreadsWithSkipTID(lldb::tid_t triggering_tid, lldb::tid_t skip_stop_request_tid);
// Notify the thread stopped. Will trigger error at time of execution if we
// already think it is stopped.
@@ -436,61 +419,43 @@
private:
- enum class ThreadState
- {
- Running,
- Stopped
- };
-
struct ThreadContext
{
ThreadState m_state;
bool m_stop_requested = false;
ResumeThreadFunction m_request_resume_function;
+
+ explicit ThreadContext(ThreadState state)
+ : m_state(state)
+ {}
};
typedef std::unordered_map<lldb::tid_t, ThreadContext> TIDContextMap;
struct PendingNotification
{
PendingNotification (lldb::tid_t triggering_tid,
- const ThreadIDSet &wait_for_stop_tids,
- const StopThreadFunction &request_thread_stop_function):
- triggering_tid (triggering_tid),
- wait_for_stop_tids (wait_for_stop_tids),
- original_wait_for_stop_tids (wait_for_stop_tids),
- request_thread_stop_function (request_thread_stop_function),
- request_stop_on_all_unstopped_threads (false),
- skip_stop_request_tids ()
+ const ThreadIDSet &wait_for_stop_tids,
+ const ThreadIDSet &skip_stop_request_tids):
+ triggering_tid (triggering_tid),
+ wait_for_stop_tids (wait_for_stop_tids),
+ original_wait_for_stop_tids (wait_for_stop_tids),
+ request_stop_on_all_unstopped_threads (false),
+ skip_stop_request_tids (skip_stop_request_tids)
{
}
- PendingNotification (lldb::tid_t triggering_tid,
- const StopThreadFunction &request_thread_stop_function):
- triggering_tid (triggering_tid),
- wait_for_stop_tids (),
- original_wait_for_stop_tids (),
- request_thread_stop_function (request_thread_stop_function),
- request_stop_on_all_unstopped_threads (true),
- skip_stop_request_tids ()
- {
- }
-
- PendingNotification (lldb::tid_t triggering_tid,
- const StopThreadFunction &request_thread_stop_function,
- const ThreadIDSet &skip_stop_request_tids):
- triggering_tid (triggering_tid),
- wait_for_stop_tids (),
- original_wait_for_stop_tids (),
- request_thread_stop_function (request_thread_stop_function),
- request_stop_on_all_unstopped_threads (true),
- skip_stop_request_tids (skip_stop_request_tids)
+ PendingNotification (lldb::tid_t triggering_tid):
+ triggering_tid (triggering_tid),
+ wait_for_stop_tids (),
+ original_wait_for_stop_tids (),
+ request_stop_on_all_unstopped_threads (true),
+ skip_stop_request_tids ()
{
}
const lldb::tid_t triggering_tid;
ThreadIDSet wait_for_stop_tids;
const ThreadIDSet original_wait_for_stop_tids;
- StopThreadFunction request_thread_stop_function;
const bool request_stop_on_all_unstopped_threads;
ThreadIDSet skip_stop_request_tids;
};
@@ -505,7 +470,7 @@
void
RequestStopOnAllRunningThreads();
- void
+ Error
RequestThreadStop (lldb::tid_t tid, ThreadContext& context);
std::mutex m_event_mutex; // Serializes execution of ProcessEvent. XXX
@@ -521,7 +486,7 @@
DoStopThreads(PendingNotificationUP &¬ification_up);
void
- ThreadWasCreated (lldb::tid_t tid, bool is_stopped);
+ ThreadWasCreated (lldb::tid_t tid, ThreadState state);
void
ThreadDidDie (lldb::tid_t tid);