2183 JvmtiTagMap::weak_oops_do(is_alive, f); 2184 } 2185 2186 void JvmtiExport::gc_epilogue() { 2187 JvmtiCurrentBreakpoints::gc_epilogue(); 2188 } 2189 2190 // Onload raw monitor transition. 2191 void JvmtiExport::transition_pending_onload_raw_monitors() { 2192 JvmtiPendingMonitors::transition_raw_monitors(); 2193 } 2194 2195 //////////////////////////////////////////////////////////////////////////////////////////////// 2196 2197 // type for the Agent_OnAttach entry point 2198 extern "C" { 2199 typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *); 2200 } 2201 2202 jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { 2203 char ebuf[1024]; 2204 char buffer[JVM_MAXPATHLEN]; 2205 void* library = NULL; 2206 jint result = JNI_ERR; 2207 const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS; 2208 size_t num_symbol_entries = ARRAY_SIZE(on_attach_symbols); 2209 2210 // get agent name and options 2211 const char* agent = op->arg(0); 2212 const char* absParam = op->arg(1); 2213 const char* options = op->arg(2); 2214 2215 // The abs paramter should be "true" or "false" 2216 bool is_absolute_path = (absParam != NULL) && (strcmp(absParam,"true")==0); 2217 2218 // Initially marked as invalid. It will be set to valid if we can find the agent 2219 AgentLibrary *agent_lib = new AgentLibrary(agent, options, is_absolute_path, NULL); 2220 2221 // Check for statically linked in agent. If not found then if the path is 2222 // absolute we attempt to load the library. Otherwise we try to load it 2223 // from the standard dll directory. 2224 2225 if (!os::find_builtin_agent(agent_lib, on_attach_symbols, num_symbol_entries)) { 2226 if (is_absolute_path) { 2227 library = os::dll_load(agent, ebuf, sizeof ebuf); 2228 } else { 2229 // Try to load the agent from the standard dll directory 2230 if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), 2231 agent)) { 2232 library = os::dll_load(buffer, ebuf, sizeof ebuf); 2233 } | 2183 JvmtiTagMap::weak_oops_do(is_alive, f); 2184 } 2185 2186 void JvmtiExport::gc_epilogue() { 2187 JvmtiCurrentBreakpoints::gc_epilogue(); 2188 } 2189 2190 // Onload raw monitor transition. 2191 void JvmtiExport::transition_pending_onload_raw_monitors() { 2192 JvmtiPendingMonitors::transition_raw_monitors(); 2193 } 2194 2195 //////////////////////////////////////////////////////////////////////////////////////////////// 2196 2197 // type for the Agent_OnAttach entry point 2198 extern "C" { 2199 typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *); 2200 } 2201 2202 jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { 2203 // get agent name and options 2204 const char* agent = op->arg(0); 2205 const char* absParam = op->arg(1); 2206 const char* options = op->arg(2); 2207 2208 return load_agent_library(agent, absParam, options, st); 2209 } 2210 2211 jint JvmtiExport::load_agent_library(const char *agent, const char *absParam, 2212 const char *options, outputStream* st) { 2213 char ebuf[1024]; 2214 char buffer[JVM_MAXPATHLEN]; 2215 void* library = NULL; 2216 jint result = JNI_ERR; 2217 const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS; 2218 size_t num_symbol_entries = ARRAY_SIZE(on_attach_symbols); 2219 2220 // The abs paramter should be "true" or "false" 2221 bool is_absolute_path = (absParam != NULL) && (strcmp(absParam,"true")==0); 2222 2223 // Initially marked as invalid. It will be set to valid if we can find the agent 2224 AgentLibrary *agent_lib = new AgentLibrary(agent, options, is_absolute_path, NULL); 2225 2226 // Check for statically linked in agent. If not found then if the path is 2227 // absolute we attempt to load the library. Otherwise we try to load it 2228 // from the standard dll directory. 2229 2230 if (!os::find_builtin_agent(agent_lib, on_attach_symbols, num_symbol_entries)) { 2231 if (is_absolute_path) { 2232 library = os::dll_load(agent, ebuf, sizeof ebuf); 2233 } else { 2234 // Try to load the agent from the standard dll directory 2235 if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), 2236 agent)) { 2237 library = os::dll_load(buffer, ebuf, sizeof ebuf); 2238 } |