From ee74c9e5fdd8c8bcd08d219ed6132713323113a6 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 25 Jul 2019 06:38:33 +0000 Subject: LLGS: fix tracking execve on linux Summary: Due to a logic error, lldb-server ended up asserting/crashing every time the debugged process attempted an execve(). This fixes the error, and extends TestExec to work on other platforms too. The "extension" consists of avoiding non-standard posix_spawn extensions and using the classic execve() call, which should be available on any platform that actually supports re-execing. I change the test decorator from @skipUnlessDarwin to @skipIfWindows. Reviewers: clayborg, jasonmolenda Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D65207 llvm-svn: 366985 --- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 7637237aa16b..c1da6f3d2575 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -599,12 +599,9 @@ void NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info, // which only copies the main thread. LLDB_LOG(log, "exec received, stop tracking all but main thread"); - for (auto i = m_threads.begin(); i != m_threads.end();) { - if ((*i)->GetID() == GetID()) - i = m_threads.erase(i); - else - ++i; - } + llvm::erase_if(m_threads, [&](std::unique_ptr &t) { + return t->GetID() != GetID(); + }); assert(m_threads.size() == 1); auto *main_thread = static_cast(m_threads[0].get()); -- cgit v1.2.3