[Lldb-commits] [lldb] r274499 - Remove SIGPIPE handler in LLGS

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 4 06:07:35 PDT 2016


Author: labath
Date: Mon Jul  4 08:07:35 2016
New Revision: 274499

URL: http://llvm.org/viewvc/llvm-project?rev=274499&view=rev
Log:
Remove SIGPIPE handler in LLGS

It is sufficient to set the handeler to SIG_IGN, to get the desired behaviour. Also, the handler
calling a lot of signal-unsafe functions.

Modified:
    lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=274499&r1=274498&r2=274499&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Mon Jul  4 08:07:35 2016
@@ -77,28 +77,9 @@ static struct option g_long_options[] =
 //----------------------------------------------------------------------
 // Watch for signals
 //----------------------------------------------------------------------
-static int g_sigpipe_received = 0;
 static int g_sighup_received_count = 0;
 
 #ifndef _WIN32
-
-static void
-signal_handler(int signo)
-{
-    Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
-
-    fprintf (stderr, "lldb-server:%s received signal %d\n", __FUNCTION__, signo);
-    if (log)
-        log->Printf ("lldb-server:%s received signal %d", __FUNCTION__, signo);
-
-    switch (signo)
-    {
-    case SIGPIPE:
-        g_sigpipe_received = 1;
-        break;
-    }
-}
-
 static void
 sighup_handler(MainLoopBase &mainloop)
 {
@@ -348,7 +329,7 @@ main_gdbserver (int argc, char *argv[])
     MainLoop mainloop;
 #ifndef _WIN32
     // Setup signal handlers first thing.
-    signal (SIGPIPE, signal_handler);
+    signal(SIGPIPE, SIG_IGN);
     MainLoop::SignalHandleUP sighup_handle = mainloop.RegisterSignal(SIGHUP, sighup_handler, error);
 #endif
 




More information about the lldb-commits mailing list