8080538: hprof does not work well with multiple agents on non-Solaris platforms
authorjmanson
Mon, 18 May 2015 13:34:56 -0700
changeset 30652 d34aad6e0365
parent 30651 31a121d1df9e
child 30653 6ef1144fd561
8080538: hprof does not work well with multiple agents on non-Solaris platforms Summary: Never take the address of Agent_OnLoad. Reviewed-by: sla, martin
jdk/src/jdk.hprof.agent/unix/native/libhprof/hprof_md.c
--- a/jdk/src/jdk.hprof.agent/unix/native/libhprof/hprof_md.c	Mon May 18 19:26:48 2015 +0300
+++ b/jdk/src/jdk.hprof.agent/unix/native/libhprof/hprof_md.c	Mon May 18 13:34:56 2015 -0700
@@ -290,19 +290,7 @@
     Dl_info dlinfo;
 
     libdir[0] = 0;
-#if defined(LINUX) || defined(_ALLBSD_SOURCE) || defined(AIX)
-    addr = (void*)&Agent_OnLoad;
-#else
-    /* Just using &Agent_OnLoad will get the first external symbol with
-     *   this name in the first .so, which may not be libhprof.so.
-     *   On Solaris we can actually ask for the address of our Agent_OnLoad.
-     */
-    addr = dlsym(RTLD_SELF, "Agent_OnLoad");
-    /* Just in case the above didn't work (missing linker patch?). */
-    if ( addr == NULL ) {
-        addr = (void*)&Agent_OnLoad;
-    }
-#endif
+    addr = (void*)&md_get_prelude_path;
 
     /* Use dladdr() to get the full path to libhprof.so, which we use to find
      *  the prelude file.