#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include "galias.h"
#include "glib.h"
#include "gprintfint.h"
#include <sys/times.h>
#endif
#include <sys/types.h>
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
-#ifdef STDC_HEADERS
#include <string.h> /* for bzero on BSD systems */
-#endif
#ifdef G_OS_WIN32
# define STRICT /* Strict typing, please */
+# define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
# include <windows.h>
# undef STRICT
#endif
# endif
#endif
+#include "galias.h"
#ifndef G_OS_WIN32
static void stack_trace (char **args);
g_on_error_query (const gchar *prg_name)
{
#ifndef G_OS_WIN32
- static const gchar *query1 = "[E]xit, [H]alt";
- static const gchar *query2 = ", show [S]tack trace";
- static const gchar *query3 = " or [P]roceed";
+ static const gchar * const query1 = "[E]xit, [H]alt";
+ static const gchar * const query2 = ", show [S]tack trace";
+ static const gchar * const query3 = " or [P]roceed";
gchar buf[16];
if (!prg_name)
void
g_on_error_stack_trace (const gchar *prg_name)
{
-#ifdef G_OS_UNIX
+#if defined(G_OS_UNIX) || defined(G_OS_BEOS)
pid_t pid;
gchar buf[16];
gchar *args[4] = { "gdb", NULL, NULL, NULL };
+ int status;
if (!prg_name)
return;
perror ("unable to fork gdb");
return;
}
-
- while (glib_on_error_halt)
- ;
- glib_on_error_halt = TRUE;
+
+ waitpid (pid, &status, 0);
#else
- abort ();
+ if (IsDebuggerPresent ())
+ G_BREAKPOINT ();
+ else
+ abort ();
#endif
}
}
#endif /* !G_OS_WIN32 */
+
+#define __G_BACKTRACE_C__
+#include "galiasdef.c"