[Lldb-commits] [lldb] r246549 - [NativeProcessLinux] Fix detach of multithreaded inferiors
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 1 08:00:52 PDT 2015
Author: labath
Date: Tue Sep 1 10:00:51 2015
New Revision: 246549
URL: http://llvm.org/viewvc/llvm-project?rev=246549&view=rev
Log:
[NativeProcessLinux] Fix detach of multithreaded inferiors
When detaching, we need to detach from all threads of the inferior and not just the main one.
Without this, a multi-threaded inferior would usually crash once the server exits.
Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=246549&r1=246548&r2=246549&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Tue Sep 1 10:00:51 2015
@@ -1794,14 +1794,20 @@ NativeProcessLinux::Detach ()
{
Error error;
- // Tell ptrace to detach from the process.
- if (GetID () != LLDB_INVALID_PROCESS_ID)
- error = Detach (GetID ());
-
// Stop monitoring the inferior.
m_sigchld_handle.reset();
- // No error.
+ // Tell ptrace to detach from the process.
+ if (GetID () == LLDB_INVALID_PROCESS_ID)
+ return error;
+
+ for (auto thread_sp : m_threads)
+ {
+ Error e = Detach(thread_sp->GetID());
+ if (e.Fail())
+ error = e; // Save the error, but still attempt to detach from other threads.
+ }
+
return error;
}
More information about the lldb-commits
mailing list