From 6072e65cafb320ef42fc821c2b32e97bf7ecb213 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 13 Sep 1999 22:17:27 +0000 Subject: [PATCH] in case we have to abort the program, debugging is enabled and we are not Mon Sep 13 23:25:59 1999 Tim Janik * gmessages.c (g_logv): in case we have to abort the program, debugging is enabled and we are not called recursively, try to abort with raise (SIGTRAP) first, so developers may ignore certain failure conditions during debugging stage. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ glib/gmessages.c | 12 +++++++++++- gmessages.c | 12 +++++++++++- 10 files changed, 78 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index af51049..4864359 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index af51049..4864359 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index af51049..4864359 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index af51049..4864359 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index af51049..4864359 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index af51049..4864359 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index af51049..4864359 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index af51049..4864359 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Mon Sep 13 23:25:59 1999 Tim Janik + + * gmessages.c (g_logv): in case we have to abort the program, + debugging is enabled and we are not called recursively, try + to abort with raise (SIGTRAP) first, so developers may ignore + certain failure conditions during debugging stage. + Thu Aug 26 15:09:36 1999 Tim Janik * Makefile.am: diff --git a/glib/gmessages.c b/glib/gmessages.c index c229ff5..786f768 100644 --- a/glib/gmessages.c +++ b/glib/gmessages.c @@ -40,6 +40,7 @@ #ifdef HAVE_UNISTD_H #include #endif +#include #ifdef NATIVE_WIN32 # define STRICT @@ -387,7 +388,16 @@ g_logv (const gchar *log_domain, /* *domain can be cluttered now */ if (test_level & G_LOG_FLAG_FATAL) - abort (); + { +#if defined (G_ENABLE_DEBUG) && defined (SIGTRAP) + if (!(test_level & G_LOG_FLAG_RECURSION)) + raise (SIGTRAP); + else + abort (); +#else /* !G_ENABLE_DEBUG || !SIGTRAP */ + abort (); +#endif /* !G_ENABLE_DEBUG || !SIGTRAP */ + } depth--; g_private_set (g_log_depth, GUINT_TO_POINTER (depth)); diff --git a/gmessages.c b/gmessages.c index c229ff5..786f768 100644 --- a/gmessages.c +++ b/gmessages.c @@ -40,6 +40,7 @@ #ifdef HAVE_UNISTD_H #include #endif +#include #ifdef NATIVE_WIN32 # define STRICT @@ -387,7 +388,16 @@ g_logv (const gchar *log_domain, /* *domain can be cluttered now */ if (test_level & G_LOG_FLAG_FATAL) - abort (); + { +#if defined (G_ENABLE_DEBUG) && defined (SIGTRAP) + if (!(test_level & G_LOG_FLAG_RECURSION)) + raise (SIGTRAP); + else + abort (); +#else /* !G_ENABLE_DEBUG || !SIGTRAP */ + abort (); +#endif /* !G_ENABLE_DEBUG || !SIGTRAP */ + } depth--; g_private_set (g_log_depth, GUINT_TO_POINTER (depth)); -- 2.7.4