[sdb] Fix the checking of the handshake message.
[mono.git] / mono / mini / mini-posix.c
index 8b77cd47ff4b63001c8c00d6ee7aaf93963e053a..d26b4af4e92b4f23f34af747865109a140a43c2a 100644 (file)
@@ -54,6 +54,7 @@
 #include <mono/utils/mono-logger-internal.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/dtrace.h>
+#include <mono/utils/mono-signal-handler.h>
 
 #include "mini.h"
 #include <string.h>
@@ -192,8 +193,7 @@ SIG_HANDLER_SIGNATURE (mono_chain_signal)
        return FALSE;
 }
 
-static void
-SIG_HANDLER_SIGNATURE (sigabrt_signal_handler)
+SIG_HANDLER_FUNC (static, sigabrt_signal_handler)
 {
        MonoJitInfo *ji = NULL;
        GET_CONTEXT;
@@ -207,8 +207,7 @@ SIG_HANDLER_SIGNATURE (sigabrt_signal_handler)
        }
 }
 
-static void
-SIG_HANDLER_SIGNATURE (sigusr1_signal_handler)
+SIG_HANDLER_FUNC (static, sigusr1_signal_handler)
 {
        gboolean running_managed;
        MonoException *exc;
@@ -281,6 +280,7 @@ SIG_HANDLER_SIGNATURE (sigusr1_signal_handler)
        mono_arch_handle_exception (ctx, exc);
 }
 
+
 #if defined(__i386__) || defined(__x86_64__)
 #define FULL_STAT_PROFILER_BACKTRACE 1
 #define CURRENT_FRAME_GET_BASE_POINTER(f) (* (gpointer*)(f))
@@ -296,10 +296,10 @@ SIG_HANDLER_SIGNATURE (sigusr1_signal_handler)
 #define FULL_STAT_PROFILER_BACKTRACE 0
 #endif
 
+#ifdef SIGPROF
 #if defined(__ia64__) || defined(__sparc__) || defined(sparc) || defined(__s390__) || defined(s390)
 
-static void
-SIG_HANDLER_SIGNATURE (sigprof_signal_handler)
+SIG_HANDLER_FUNC (static, sigprof_signal_handler)
 {
        if (mono_chain_signal (SIG_HANDLER_PARAMS))
                return;
@@ -309,8 +309,7 @@ SIG_HANDLER_SIGNATURE (sigprof_signal_handler)
 
 #else
 
-static void
-SIG_HANDLER_SIGNATURE (sigprof_signal_handler)
+SIG_HANDLER_FUNC (static, sigprof_signal_handler)
 {
        int call_chain_depth = mono_profiler_stat_get_call_chain_depth ();
        MonoProfilerCallChainStrategy call_chain_strategy = mono_profiler_stat_get_call_chain_strategy ();
@@ -386,10 +385,10 @@ SIG_HANDLER_SIGNATURE (sigprof_signal_handler)
        mono_chain_signal (SIG_HANDLER_PARAMS);
 }
 
+#endif
 #endif
 
-static void
-SIG_HANDLER_SIGNATURE (sigquit_signal_handler)
+SIG_HANDLER_FUNC (static, sigquit_signal_handler)
 {
        gboolean res;
 
@@ -419,8 +418,7 @@ SIG_HANDLER_SIGNATURE (sigquit_signal_handler)
        mono_chain_signal (SIG_HANDLER_PARAMS);
 }
 
-static void
-SIG_HANDLER_SIGNATURE (sigusr2_signal_handler)
+SIG_HANDLER_FUNC (static, sigusr2_signal_handler)
 {
        gboolean enabled = mono_trace_is_enabled ();
 
@@ -525,6 +523,11 @@ mono_runtime_posix_install_handlers (void)
         */
        sigemptyset (&signal_set);
        sigaddset (&signal_set, mono_thread_get_abort_signal ());
+       if (mono_gc_get_suspend_signal () != -1)
+               sigaddset (&signal_set, mono_gc_get_suspend_signal ());
+       if (mono_gc_get_restart_signal () != -1)
+               sigaddset (&signal_set, mono_gc_get_restart_signal ());
+       sigaddset (&signal_set, SIGCHLD);
        sigprocmask (SIG_UNBLOCK, &signal_set, NULL);
 
        signal (SIGPIPE, SIG_IGN);
@@ -693,8 +696,8 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
                commands = fopen (template, "w");
 
                fprintf (commands, "process attach --pid %ld\n", (long) crashed_pid);
-               fprintf (commands, "script lldb.debugger.HandleCommand (\"thread list\")\n");
-               fprintf (commands, "script lldb.debugger.HandleCommand (\"thread backtrace all\")\n");
+               fprintf (commands, "thread list\n");
+               fprintf (commands, "thread backtrace all\n");
                fprintf (commands, "detach\n");
                fprintf (commands, "quit\n");
 
@@ -727,7 +730,7 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
 #if !defined (__MACH__)
 
 gboolean
-mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoNativeThreadId thread_id, MonoNativeThreadHandle thread_handle)
+mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
 {
        g_error ("Posix systems don't support mono_thread_state_init_from_handle");
        return FALSE;