projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #2865 from akoeplinger/maccore-fixes
[mono.git]
/
mono
/
mini
/
mini-darwin.c
diff --git
a/mono/mini/mini-darwin.c
b/mono/mini/mini-darwin.c
index 9a57d363ce2dae59aabfb87a9d6c56d30ffca62e..4f8fbcf65853f668acdb0cc1be9140ae552f395a 100644
(file)
--- a/
mono/mini/mini-darwin.c
+++ b/
mono/mini/mini-darwin.c
@@
-8,7
+8,7
@@
* Copyright 2003-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*
* 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 <config.h>
#include <signal.h>
@@
-44,11
+44,11
@@
#include <mono/metadata/verify-internals.h>
#include <mono/metadata/mempool-internals.h>
#include <mono/metadata/attach.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-internal
s
.h>
#include <mono/utils/mono-math.h>
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-counters.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-internal
s
.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/dtrace.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/dtrace.h>
@@
-239,22
+239,30
@@
mono_runtime_install_handlers (void)
pid_t
mono_runtime_syscall_fork ()
{
pid_t
mono_runtime_syscall_fork ()
{
+#ifdef HAVE_FORK
return (pid_t) fork ();
return (pid_t) fork ();
+#else
+ g_assert_not_reached ();
+#endif
}
void
mono_gdb_render_native_backtraces (pid_t crashed_pid)
{
}
void
mono_gdb_render_native_backtraces (pid_t crashed_pid)
{
+#ifdef HAVE_EXECV
const char *argv [5];
char template [] = "/tmp/mono-gdb-commands.XXXXXX";
FILE *commands;
gboolean using_lldb = FALSE;
const char *argv [5];
char template [] = "/tmp/mono-gdb-commands.XXXXXX";
FILE *commands;
gboolean using_lldb = FALSE;
+ using_lldb = TRUE;
+
argv [0] = g_find_program_in_path ("gdb");
argv [0] = g_find_program_in_path ("gdb");
- if (!argv [0]) {
+ if (argv [0])
+ using_lldb = FALSE;
+
+ if (using_lldb)
argv [0] = g_find_program_in_path ("lldb");
argv [0] = g_find_program_in_path ("lldb");
- using_lldb = TRUE;
- }
if (argv [0] == NULL)
return;
if (argv [0] == NULL)
return;
@@
-276,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");
} 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";
fprintf (commands, "thread apply all bt\n");
argv [1] = "-batch";
argv [2] = "-x";
@@
-285,8
+294,13
@@
mono_gdb_render_native_backtraces (pid_t crashed_pid)
fflush (commands);
fclose (commands);
fflush (commands);
fclose (commands);
+ fclose (stdin);
+
execv (argv [0], (char**)argv);
unlink (template);
execv (argv [0], (char**)argv);
unlink (template);
+#else
+ fprintf (stderr, "mono_gdb_render_native_backtraces not supported on this platform\n");
+#endif // HAVE_EXECV
}
gboolean
}
gboolean