mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-12 12:48:59 +00:00
[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
This commit is contained in:
parent
6924dcdf6f
commit
7a9495bcd5
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user