Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvmtiExport.cpp @ 6966:6cb0d32b828b
8001185: parsing of sun.boot.library.path in os::dll_build_name somewhat broken
Summary: dll_dir can contain multiple paths, need to parse them correctly when loading agents
Reviewed-by: dholmes, dlong
Contributed-by: bill.pittore@oracle.com
author | bpittore |
---|---|
date | Wed, 07 Nov 2012 17:53:02 -0500 |
parents | da91efe96a93 |
children | 80e866b1d053 |
comparison
equal
deleted
inserted
replaced
6932:857f3ce858dd | 6966:6cb0d32b828b |
---|---|
2175 | 2175 |
2176 #ifndef SERVICES_KERNEL | 2176 #ifndef SERVICES_KERNEL |
2177 jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { | 2177 jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { |
2178 char ebuf[1024]; | 2178 char ebuf[1024]; |
2179 char buffer[JVM_MAXPATHLEN]; | 2179 char buffer[JVM_MAXPATHLEN]; |
2180 void* library; | 2180 void* library = NULL; |
2181 jint result = JNI_ERR; | 2181 jint result = JNI_ERR; |
2182 | 2182 |
2183 // get agent name and options | 2183 // get agent name and options |
2184 const char* agent = op->arg(0); | 2184 const char* agent = op->arg(0); |
2185 const char* absParam = op->arg(1); | 2185 const char* absParam = op->arg(1); |
2194 | 2194 |
2195 if (is_absolute_path) { | 2195 if (is_absolute_path) { |
2196 library = os::dll_load(agent, ebuf, sizeof ebuf); | 2196 library = os::dll_load(agent, ebuf, sizeof ebuf); |
2197 } else { | 2197 } else { |
2198 // Try to load the agent from the standard dll directory | 2198 // Try to load the agent from the standard dll directory |
2199 os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), agent); | 2199 if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), |
2200 library = os::dll_load(buffer, ebuf, sizeof ebuf); | 2200 agent)) { |
2201 library = os::dll_load(buffer, ebuf, sizeof ebuf); | |
2202 } | |
2201 if (library == NULL) { | 2203 if (library == NULL) { |
2202 // not found - try local path | 2204 // not found - try local path |
2203 char ns[1] = {0}; | 2205 char ns[1] = {0}; |
2204 os::dll_build_name(buffer, sizeof(buffer), ns, agent); | 2206 if (os::dll_build_name(buffer, sizeof(buffer), ns, agent)) { |
2205 library = os::dll_load(buffer, ebuf, sizeof ebuf); | 2207 library = os::dll_load(buffer, ebuf, sizeof ebuf); |
2208 } | |
2206 } | 2209 } |
2207 } | 2210 } |
2208 | 2211 |
2209 // If the library was loaded then we attempt to invoke the Agent_OnAttach | 2212 // If the library was loaded then we attempt to invoke the Agent_OnAttach |
2210 // function | 2213 // function |