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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57959

Files:
  lldb/source/Host/common/MainLoop.cpp


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;
 #if SIGNAL_POLLING_UNSUPPORTED
-  return 0;
+  sigemptyset(&sigmask);
 #else
-  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;
 #endif
+  return sigmask;
 }
 
 #ifdef __ANDROID__


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;
 #if SIGNAL_POLLING_UNSUPPORTED
-  return 0;
+  sigemptyset(&sigmask);
 #else
-  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;
 #endif
+  return sigmask;
 }
 
 #ifdef __ANDROID__
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to