diff options
| author | Pavel Labath <labath@google.com> | 2015-09-01 15:00:51 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2015-09-01 15:00:51 +0000 |
| commit | 7a9495bcd59402b888207cae6bdb927643cc81a5 (patch) | |
| tree | 4723130031acfc82e2c9ac793dc30740c8fc06ac /lldb/source/Plugins/Process/Linux | |
| parent | 6924dcdf6f7370756098598020a0a53f5f248a3f (diff) | |
| download | bcm5719-llvm-7a9495bcd59402b888207cae6bdb927643cc81a5.tar.gz bcm5719-llvm-7a9495bcd59402b888207cae6bdb927643cc81a5.zip | |
[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.
llvm-svn: 246549
Diffstat (limited to 'lldb/source/Plugins/Process/Linux')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 0551596f4cc..dfc92887fa8 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -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; } |

