changeset 4985:dc0086b1cad0

[TOOLS] GLTrace.java is not initialized on Mac OS X
author Oleg Mazurov <oleg.mazurov@oracle.com>
date Thu, 05 Sep 2013 15:19:46 -0700
parents 877523a1e150
children f00dbf5f48e9
files tools/gltrace/agent.c tools/gltrace/os.h tools/gltrace/retrace.c
diffstat 3 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tools/gltrace/agent.c	Thu Sep 05 15:44:58 2013 -0400
+++ b/tools/gltrace/agent.c	Thu Sep 05 15:19:46 2013 -0700
@@ -42,7 +42,7 @@
 static void
 init()
 {
-    char *lib = getenv("LD_PRELOAD");
+    char *lib = getenv(OS_ENV_PRELOAD);
     if (lib == NULL) return;
     strncpy(tools_envvar, "JAVA_TOOL_OPTIONS=-agentpath:", sizeof(tools_envvar));
     strncat(tools_envvar, lib, sizeof(tools_envvar));
--- a/tools/gltrace/os.h	Thu Sep 05 15:44:58 2013 -0400
+++ b/tools/gltrace/os.h	Thu Sep 05 15:19:46 2013 -0700
@@ -34,6 +34,11 @@
 #if MACOSX
 #define MAP_POPULATE 0
 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#define OS_ENV_PRELOAD "DYLD_INSERT_LIBRARIES"
+#endif
+
+#if linux
+#define OS_ENV_PRELOAD "LD_PRELOAD"
 #endif
 
 #endif /* GLTRACE_OS_H */
--- a/tools/gltrace/retrace.c	Thu Sep 05 15:44:58 2013 -0400
+++ b/tools/gltrace/retrace.c	Thu Sep 05 15:19:46 2013 -0700
@@ -2461,7 +2461,7 @@
         // prefix commands
         if (cmd == OPC_THREAD) {
             curThread = getPtr();
-            if (printFlag) {
+            if (printFlag && !printThread) {
                 fprintf(stdout, "THREAD %llu\n", curThread);
             }
             cmd = getCmd();