[glib: 1/2] Don't fall back to raise(SIGTRAP) on Windows
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] Don't fall back to raise(SIGTRAP) on Windows
- Date: Thu, 28 May 2020 09:02:07 +0000 (UTC)
commit 77346d903d1095dded10bc044cfed4d1fc465d6a
Author: Martin Storsjö <martin martin st>
Date: Tue Mar 31 23:11:05 2020 +0300
Don't fall back to raise(SIGTRAP) on Windows
When targeting mingw on architectures other than x86, the earlier cases
don't apply, and the final fallback, raise(SIGTRAP) isn't usable there.
GCC and Clang both support __builtin_trap(), so in case we have no
other alternatives, and are on windows (where raise() isn't available),
we can resort to this.
glib/gbacktrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gbacktrace.h b/glib/gbacktrace.h
index 9e9cba151..09b8ccbd3 100644
--- a/glib/gbacktrace.h
+++ b/glib/gbacktrace.h
@@ -61,7 +61,7 @@ void g_on_error_stack_trace (const gchar *prg_name);
# 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
-#elif defined (__APPLE__)
+#elif defined (__APPLE__) || (defined(_WIN32) && (defined(__clang__) || defined(__GNUC__)))
# define G_BREAKPOINT() G_STMT_START{ __builtin_trap(); }G_STMT_END
#else /* !__i386__ && !__alpha__ */
# define G_BREAKPOINT() G_STMT_START{ raise (SIGTRAP); }G_STMT_END
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]