[Lldb-commits] [PATCH] D57959: [lldb] [MainLoop] Initialize empty sigset_t correctly

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 8 09:27:47 PST 2019

mgorny created this revision.
mgorny added reviewers: zturner, labath, krytarowski.
Herald added a project: LLDB.

Fix MainLoop::RunImpl::get_sigmask() to correctly return empty sigset_t
when SIGNAL_POLLING_UNSUPPORTED is true.  On NetBSD (and probably
on some other platforms), integers are not implicitly convertible to
sigset_t, so 'return 0' is erraneous.  Instead, sigset_t should be reset
through sigemptyset().

While at it, move common parts out of the #ifdef.

// FTR: I don't know if this wouldn't break Windows. I'd appreciate if somebody could test it. Alternatively, I can watch buildbots after merging.




Index: lldb/source/Host/common/MainLoop.cpp
--- lldb/source/Host/common/MainLoop.cpp
+++ lldb/source/Host/common/MainLoop.cpp
@@ -137,18 +137,18 @@
 sigset_t MainLoop::RunImpl::get_sigmask() {
+  sigset_t sigmask;
-  return 0;
+  sigemptyset(&sigmask);
-  sigset_t sigmask;
   int ret = pthread_sigmask(SIG_SETMASK, nullptr, &sigmask);
   assert(ret == 0);
   (void) ret;
   for (const auto &sig : loop.m_signals)
     sigdelset(&sigmask, sig.first);
-  return sigmask;
+  return sigmask;
 #ifdef __ANDROID__

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57959.185992.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190208/62c7de6d/attachment.bin>

More information about the lldb-commits mailing list