summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-07-25 06:38:33 +0000
committerPavel Labath <pavel@labath.sk>2019-07-25 06:38:33 +0000
commitee74c9e5fdd8c8bcd08d219ed6132713323113a6 (patch)
tree3332b4b3ca90b96ccb9635a0a061b9b00b6abde0 /lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
parentd5177643f0e16264a5e09b85dcafb9069db4abf5 (diff)
downloadbcm5719-llvm-ee74c9e5fdd8c8bcd08d219ed6132713323113a6.tar.gz
bcm5719-llvm-ee74c9e5fdd8c8bcd08d219ed6132713323113a6.zip
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
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 7637237aa16..c1da6f3d257 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<NativeThreadProtocol> &t) {
+ return t->GetID() != GetID();
+ });
assert(m_threads.size() == 1);
auto *main_thread = static_cast<NativeThreadLinux *>(m_threads[0].get());
OpenPOWER on IntegriCloud