Merge pull request #2854 from alexrp/lock-free-queue-docs
[mono.git] / mono / mini / mini-darwin.c
index ab0024c41ba702293f2a6f99422328e2e5fcbe97..4f8fbcf65853f668acdb0cc1be9140ae552f395a 100644 (file)
@@ -8,7 +8,7 @@
  * Copyright 2003-2011 Novell, Inc (http://www.novell.com)
  * Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
  *
- * See LICENSE for licensing information.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 #include <config.h>
 #include <signal.h>
 #include <mono/metadata/verify-internals.h>
 #include <mono/metadata/mempool-internals.h>
 #include <mono/metadata/attach.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/dtrace.h>
 
@@ -255,12 +255,14 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
        FILE *commands;
        gboolean using_lldb = FALSE;
 
+       using_lldb = TRUE;
+
        argv [0] = g_find_program_in_path ("gdb");
-       if (!argv [0]) {
-               // FIXME: LLDB doesn't quit when given the 'quit' command
-               //argv [0] = g_find_program_in_path ("lldb");
-               //using_lldb = TRUE;
-       }
+       if (argv [0])
+               using_lldb = FALSE;
+
+       if (using_lldb)
+               argv [0] = g_find_program_in_path ("lldb");
 
        if (argv [0] == NULL)
                return;
@@ -282,6 +284,7 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
        } else {
                fprintf (commands, "attach %ld\n", (long) crashed_pid);
                fprintf (commands, "info threads\n");
+               fprintf (commands, " t a a info thread\n");
                fprintf (commands, "thread apply all bt\n");
                argv [1] = "-batch";
                argv [2] = "-x";
@@ -291,6 +294,8 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
        fflush (commands);
        fclose (commands);
 
+       fclose (stdin);
+
        execv (argv [0], (char**)argv);
        unlink (template);
 #else