summaryrefslogtreecommitdiff
path: root/wrappers/dlsym.cpp
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/dlsym.cpp
parent215515ee810d1bd5af408744365870437a75b700 (diff)
glxtrace: Intercept and flush on _exit.
As suggested in https://github.com/apitrace/apitrace/issues/479#issuecomment-239666769
Diffstat (limited to 'wrappers/dlsym.cpp')
-rw-r--r--wrappers/dlsym.cpp21
1 files changed, 21 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__ */