diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index f5c881f50..26d10ac30 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -21,11 +21,11 @@ * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. + * GLib at ftp://ftp.gtk.org/pub/gtk/. */ -/* - * MT safe ; except for g_on_error_stack_trace, but who wants thread safety +/* + * MT safe ; except for g_on_error_stack_trace, but who wants thread safety * then */ @@ -35,8 +35,6 @@ #include #include #include -#include "glib.h" -#include "gprintfint.h" #ifdef HAVE_SYS_TIME_H #include @@ -61,12 +59,16 @@ #include /* for bzero on BSD systems */ #ifdef G_OS_WIN32 -# define STRICT /* Strict typing, please */ +# define STRICT /* Strict typing, please */ # define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */ # include # undef STRICT #endif +#include "gtypes.h" +#include "gprintfint.h" + + #ifndef NO_FD_SET # define SELECT_MASK fd_set #else @@ -96,27 +98,27 @@ g_on_error_query (const gchar *prg_name) if (!prg_name) prg_name = g_get_prgname (); - + retry: - + if (prg_name) _g_fprintf (stdout, - "%s (pid:%u): %s%s%s: ", - prg_name, - (guint) getpid (), - query1, - query2, - query3); + "%s (pid:%u): %s%s%s: ", + prg_name, + (guint) getpid (), + query1, + query2, + query3); else _g_fprintf (stdout, - "(process:%u): %s%s: ", - (guint) getpid (), - query1, - query3); + "(process:%u): %s%s: ", + (guint) getpid (), + query1, + query3); fflush (stdout); - + if (isatty(0) && isatty(1)) - fgets (buf, 8, stdin); + fgets (buf, 8, stdin); else strcpy (buf, "E\n"); @@ -124,20 +126,20 @@ g_on_error_query (const gchar *prg_name) && buf[1] == '\n') _exit (0); else if ((buf[0] == 'P' || buf[0] == 'p') - && buf[1] == '\n') + && buf[1] == '\n') return; else if (prg_name - && (buf[0] == 'S' || buf[0] == 's') - && buf[1] == '\n') + && (buf[0] == 'S' || buf[0] == 's') + && buf[1] == '\n') { g_on_error_stack_trace (prg_name); goto retry; } else if ((buf[0] == 'H' || buf[0] == 'h') - && buf[1] == '\n') + && buf[1] == '\n') { while (glib_on_error_halt) - ; + ; glib_on_error_halt = TRUE; return; } @@ -146,10 +148,10 @@ g_on_error_query (const gchar *prg_name) #else if (!prg_name) prg_name = g_get_prgname (); - + MessageBox (NULL, "g_on_error_query called, program terminating", - (prg_name && *prg_name) ? prg_name : NULL, - MB_OK|MB_ICONERROR); + (prg_name && *prg_name) ? prg_name : NULL, + MB_OK|MB_ICONERROR); _exit(0); #endif } diff --git a/glib/gbacktrace.h b/glib/gbacktrace.h index 2e74b49a3..43a0c46a2 100644 --- a/glib/gbacktrace.h +++ b/glib/gbacktrace.h @@ -52,16 +52,16 @@ void g_on_error_stack_trace (const gchar *prg_name); * Actual use is strongly discouraged of course ;) */ #if (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2 -# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END +# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END #elif (defined (_MSC_VER) || defined (__DMC__)) && defined (_M_IX86) -# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END +# define G_BREAKPOINT() G_STMT_START{ __asm int 3h }G_STMT_END #elif defined (_MSC_VER) -# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END +# define G_BREAKPOINT() G_STMT_START{ __debugbreak(); }G_STMT_END #elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2 -# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END -#else /* !__i386__ && !__alpha__ */ -# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END -#endif /* __i386__ */ +# define G_BREAKPOINT() G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END +#else /* !__i386__ && !__alpha__ */ +# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END +#endif /* __i386__ */ G_END_DECLS