[gjs/master.windows: 11/18] gjs/context.cpp: Build heap dumping only on UNIX
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/master.windows: 11/18] gjs/context.cpp: Build heap dumping only on UNIX
- Date: Mon, 4 Mar 2019 08:38:48 +0000 (UTC)
commit 9796da0cdae8d2a4ef74abe3f3ebc5d718d60a92
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri Feb 22 13:20:27 2019 +0800
gjs/context.cpp: Build heap dumping only on UNIX
The heap dumping code will need to be ported in order to be used on
Windows, so don't build those portions for now. Instead, show a message
that indicates this when running on Windows and attempting to setup the
heap dump.
gjs/context.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 57353759..0f4b77f7 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -25,7 +25,6 @@
#include <signal.h>
#include <sys/types.h>
-#include <unistd.h>
#include <array>
#include <codecvt>
@@ -59,6 +58,10 @@
#include <windows.h>
#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#include <string.h>
static void gjs_context_dispose (GObject *object);
@@ -126,6 +129,8 @@ static GList *all_contexts = NULL;
static GjsAutoChar dump_heap_output;
static unsigned dump_heap_idle_id = 0;
+#ifdef G_OS_UNIX
+/* Currently heap dumping is only supported on UNIX platforms! */
static void
gjs_context_dump_heaps(void)
{
@@ -167,6 +172,7 @@ dump_heap_signal_handler(int signum)
dump_heap_idle_id = g_idle_add_full(G_PRIORITY_HIGH_IDLE,
dump_heap_idle, nullptr, nullptr);
}
+#endif
static void
setup_dump_heap(void)
@@ -178,6 +184,7 @@ setup_dump_heap(void)
/* install signal handler only if environment variable is set */
const char *heap_output = g_getenv("GJS_DEBUG_HEAP_OUTPUT");
if (heap_output) {
+#ifdef G_OS_UNIX
struct sigaction sa;
dump_heap_output = g_strdup(heap_output);
@@ -185,6 +192,10 @@ setup_dump_heap(void)
memset(&sa, 0, sizeof(sa));
sa.sa_handler = dump_heap_signal_handler;
sigaction(SIGUSR1, &sa, nullptr);
+#else
+ g_message(
+ "heap dump is currently only supported on UNIX platforms");
+#endif
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]