Compare commits

...
2 Commits
Author SHA1 Message Date
Rolf Bjarne Kvinge 9435de91f2 Fix gdb backtraces on OSX.
We can't redirect output from gdb: since gdb will suspend us we won't
be able to read from the pipe we've redirected output to, and we'll
end up deadlocking if gdb outputs a lot of data (see bug #2548).
2012-01-30 15:10:02 -05:00
Duncan Mak 1281853553 Bump version number to 2.10.9 2012-01-30 14:56:23 -05:00
5 changed files with 9 additions and 37 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(mono,2.10.8.1)
AM_INIT_AUTOMAKE(mono,2.10.9)
AM_MAINTAINER_MODE
API_VER=2.0
+2 -5
View File
@@ -226,16 +226,15 @@ mono_runtime_syscall_fork ()
return (pid_t) fork ();
}
gboolean
void
mono_gdb_render_native_backtraces (pid_t crashed_pid)
{
return FALSE; // disable for now due to #2548.
const char *argv [5];
char gdb_template [] = "/tmp/mono-gdb-commands.XXXXXX";
argv [0] = g_find_program_in_path ("gdb");
if (argv [0] == NULL) {
return FALSE;
return;
}
if (mkstemp (gdb_template) != -1) {
@@ -257,6 +256,4 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
unlink (gdb_template);
}
return TRUE;
}
+3 -26
View File
@@ -2170,16 +2170,10 @@ mono_handle_native_sigsegv (int signal, void *ctx)
#if !defined(HOST_WIN32) && defined(HAVE_SYS_SYSCALL_H) && defined(SYS_fork)
if (!mini_get_debug_options ()->no_gdb_backtrace && !mono_debug_using_mono_debugger ()) {
/* From g_spawn_command_line_sync () in eglib */
int res;
int stdout_pipe [2] = { -1, -1 };
pid_t pid;
int status;
char buffer [1024];
pid_t crashed_pid = getpid ();
res = pipe (stdout_pipe);
g_assert (res != -1);
//pid = fork ();
/*
* glibc fork acquires some locks, so if the crash happened inside malloc/free,
@@ -2188,31 +2182,14 @@ mono_handle_native_sigsegv (int signal, void *ctx)
pid = mono_runtime_syscall_fork ();
if (pid == 0) {
close (stdout_pipe [0]);
dup2 (stdout_pipe [1], STDOUT_FILENO);
for (i = getdtablesize () - 1; i >= 3; i--)
close (i);
if (!mono_gdb_render_native_backtraces (crashed_pid))
close (STDOUT_FILENO);
dup2 (STDERR_FILENO, STDOUT_FILENO);
mono_gdb_render_native_backtraces (crashed_pid);
exit (1);
}
close (stdout_pipe [1]);
fprintf (stderr, "\nDebug info from gdb:\n\n");
while (1) {
int nread = read (stdout_pipe [0], buffer, 1024);
if (nread <= 0)
break;
write (STDERR_FILENO, buffer, nread);
}
waitpid (pid, &status, WNOHANG);
waitpid (pid, &status, 0);
}
#endif
/*
+2 -4
View File
@@ -635,7 +635,7 @@ mono_runtime_syscall_fork ()
#endif
}
gboolean
void
mono_gdb_render_native_backtraces (pid_t crashed_pid)
{
const char *argv [9];
@@ -643,7 +643,7 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
argv [0] = g_find_program_in_path ("gdb");
if (argv [0] == NULL) {
return FALSE;
return;
}
argv [1] = "-ex";
@@ -657,8 +657,6 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
argv [8] = 0;
execv (argv [0], (char**)argv);
return TRUE;
}
#endif
#endif /* __native_client__ */
+1 -1
View File
@@ -2400,7 +2400,7 @@ void mono_runtime_setup_stat_profiler (void) MONO_INTERNAL;
void mono_runtime_shutdown_stat_profiler (void) MONO_INTERNAL;
void mono_runtime_posix_install_handlers (void) MONO_INTERNAL;
pid_t mono_runtime_syscall_fork (void) MONO_INTERNAL;
gboolean mono_gdb_render_native_backtraces (pid_t crashed_pid) MONO_INTERNAL;
void mono_gdb_render_native_backtraces (pid_t crashed_pid) MONO_INTERNAL;
/*
* Signal handling