Add ability to attach/detach to multi-threaded inferiors on Linux.
All running threads will be detected and stopped on attach and all threads get resumed on detach.
llvm-svn: 183049
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
index b2db43e..1e0fa05 100644
--- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
+++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
@@ -329,7 +329,14 @@
return error;
}
- error = m_monitor->Detach();
+ uint32_t thread_count = m_thread_list.GetSize(false);
+ for (uint32_t i = 0; i < thread_count; ++i)
+ {
+ POSIXThread *thread = static_cast<POSIXThread*>(
+ m_thread_list.GetThreadAtIndex(i, false).get());
+ error = m_monitor->Detach(thread->GetID());
+ }
+
if (error.Success())
SetPrivateState(eStateDetached);
@@ -393,7 +400,7 @@
if (m_exit_now)
{
SetPrivateState(eStateExited);
- m_monitor->Detach();
+ m_monitor->Detach(GetID());
}
else
{