summaryrefslogtreecommitdiff
path: root/wrappers
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2016-08-27 19:26:19 +0100
committerJose Fonseca <jfonseca@vmware.com>2016-08-27 19:26:19 +0100
commit886e2aeefb352550831aa04643b817926bf7ef01 (patch)
treee98ea53b7caaa9494747d068a0238676ec1bd61b /wrappers
parent215515ee810d1bd5af408744365870437a75b700 (diff)
glxtrace: Intercept and flush on _exit.
As suggested in https://github.com/apitrace/apitrace/issues/479#issuecomment-239666769
Diffstat (limited to 'wrappers')
-rw-r--r--wrappers/dlsym.cpp21
-rw-r--r--wrappers/glxtrace.version1
2 files changed, 22 insertions, 0 deletions
diff --git a/wrappers/dlsym.cpp b/wrappers/dlsym.cpp
index d7dc0865..2eda082a 100644
--- a/wrappers/dlsym.cpp
+++ b/wrappers/dlsym.cpp
@@ -228,3 +228,24 @@ void * dlopen(const char *filename, int flag)
return handle;
}
+
+
+#ifdef __linux__
+
+#include "trace_writer_local.hpp"
+
+/*
+ * Intercept _exit so we can flush our trace even when the app (eg. Wine)
+ * aborts.
+ *
+ * TODO: Currently we dispatch to _Exit, but for completness we should
+ * intercept _Exit too.
+ */
+void
+_exit(int status)
+{
+ trace::localWriter.flush();
+ _Exit(status);
+}
+
+#endif /* __linux__ */
diff --git a/wrappers/glxtrace.version b/wrappers/glxtrace.version
index 7d7a1624..0546a05e 100644
--- a/wrappers/glxtrace.version
+++ b/wrappers/glxtrace.version
@@ -4,6 +4,7 @@
_fini;
gl[A-Z]*;
dlopen;
+ _exit;
local:
*;
};