[gjs/master.windows: 5/9] 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: 5/9] gjs/context.cpp: Build heap dumping only on UNIX
- Date: Tue, 26 Feb 2019 09:24:06 +0000 (UTC)
commit 9117b884165ab7c03bec9b020cc4899396ee6f9a
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 922cd7bb..b9c5a403 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -25,7 +25,10 @@
#include <signal.h>
#include <sys/types.h>
-#include <unistd.h>
+
+#ifndef XP_WIN
+# include <unistd.h>
+#endif
#include <array>
#include <codecvt>
@@ -34,6 +37,7 @@
#include <gio/gio.h>
+
#include "byteArray.h"
#include "context-private.h"
#include "engine.h"
@@ -126,6 +130,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 +173,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 +185,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 +193,9 @@ 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]