diff options
| author | Michal Gorny <mgorny@gentoo.org> | 2019-03-21 19:35:55 +0000 |
|---|---|---|
| committer | Michal Gorny <mgorny@gentoo.org> | 2019-03-21 19:35:55 +0000 |
| commit | 2819136f0a3d75f3b6fefe5f962efdbf66e99c12 (patch) | |
| tree | daa3971def7f0d9e8d59169ca53d594b2940e62b /lldb/source/Plugins | |
| parent | c56872589f1593eb0e6ccd9ee2c3e1be0c947e08 (diff) | |
| download | bcm5719-llvm-2819136f0a3d75f3b6fefe5f962efdbf66e99c12.tar.gz bcm5719-llvm-2819136f0a3d75f3b6fefe5f962efdbf66e99c12.zip | |
[lldb] Add missing EINTR handling
Differential Revision: https://reviews.llvm.org/D59606
llvm-svn: 356703
Diffstat (limited to 'lldb/source/Plugins')
4 files changed, 14 insertions, 7 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp index 440b1274e89..959e5f0dfd8 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp @@ -1387,7 +1387,8 @@ lldb_private::Status ProcessMonitor::Detach(lldb::tid_t tid) { bool ProcessMonitor::DupDescriptor(const FileSpec &file_spec, int fd, int flags) { - int target_fd = open(file_spec.GetCString(), flags, 0666); + int target_fd = llvm::sys::RetryAfterSignal(-1, open, + file_spec.GetCString(), flags, 0666); if (target_fd == -1) return false; diff --git a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp index 01d8ef9d33a..bd1f099f5d4 100644 --- a/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp +++ b/lldb/source/Plugins/Process/Linux/SingleStepCheck.cpp @@ -51,8 +51,10 @@ struct ChildDeleter { ~ChildDeleter() { int status; - kill(pid, SIGKILL); // Kill the child. - waitpid(pid, &status, __WALL); // Pick up the remains. + // Kill the child. + kill(pid, SIGKILL); + // Pick up the remains. + llvm::sys::RetryAfterSignal(-1, waitpid, pid, &status, __WALL); } }; @@ -81,7 +83,8 @@ bool WorkaroundNeeded() { } int status; - ::pid_t wpid = waitpid(child_pid, &status, __WALL); + ::pid_t wpid = llvm::sys::RetryAfterSignal(-1, waitpid, + child_pid, &status, __WALL); if (wpid != child_pid || !WIFSTOPPED(status)) { LLDB_LOG(log, "waitpid() failed (status = {0:x}): {1}", status, Status(errno, eErrorTypePOSIX)); @@ -110,7 +113,8 @@ bool WorkaroundNeeded() { break; } - wpid = waitpid(child_pid, &status, __WALL); + wpid = llvm::sys::RetryAfterSignal(-1, waitpid, + child_pid, &status, __WALL); if (wpid != child_pid || !WIFSTOPPED(status)) { LLDB_LOG(log, "waitpid() failed (status = {0:x}): {1}", status, Status(errno, eErrorTypePOSIX)); diff --git a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp index b0ae54841b1..5ccd5a35f75 100644 --- a/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp +++ b/lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp @@ -665,7 +665,8 @@ Status NativeProcessNetBSD::Attach() { int wstatus; // Need to use WALLSIG otherwise we receive an error with errno=ECHLD At this // point we should have a thread stopped if waitpid succeeds. - if ((wstatus = waitpid(m_pid, NULL, WALLSIG)) < 0) + if ((wstatus = llvm::sys::RetryAfterSignal(-1, waitpid, + m_pid, NULL, WALLSIG)) < 0) return Status(errno, eErrorTypePOSIX); /* Initialize threads */ diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index f82fe612f68..62421238fb0 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -21,6 +21,7 @@ #include "lldb/Utility/Stream.h" #include "llvm/Support/ConvertUTF.h" +#include "llvm/Support/Errno.h" #include <stdio.h> @@ -39,7 +40,7 @@ void StructuredPythonObject::Dump(Stream &s, bool pretty_print) const { void PythonObject::Dump(Stream &strm) const { if (m_py_obj) { - FILE *file = ::tmpfile(); + FILE *file = llvm::sys::RetryAfterSignal(nullptr, ::tmpfile); if (file) { ::PyObject_Print(m_py_obj, file, 0); const long length = ftell(file); |

