2198 extern "C" { |
2198 extern "C" { |
2199 typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *); |
2199 typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *); |
2200 } |
2200 } |
2201 |
2201 |
2202 jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) { |
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) { |
2203 char ebuf[1024]; |
2213 char ebuf[1024]; |
2204 char buffer[JVM_MAXPATHLEN]; |
2214 char buffer[JVM_MAXPATHLEN]; |
2205 void* library = NULL; |
2215 void* library = NULL; |
2206 jint result = JNI_ERR; |
2216 jint result = JNI_ERR; |
2207 const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS; |
2217 const char *on_attach_symbols[] = AGENT_ONATTACH_SYMBOLS; |
2208 size_t num_symbol_entries = ARRAY_SIZE(on_attach_symbols); |
2218 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 |
2219 |
2215 // The abs paramter should be "true" or "false" |
2220 // The abs paramter should be "true" or "false" |
2216 bool is_absolute_path = (absParam != NULL) && (strcmp(absParam,"true")==0); |
2221 bool is_absolute_path = (absParam != NULL) && (strcmp(absParam,"true")==0); |
2217 |
2222 |
2218 // Initially marked as invalid. It will be set to valid if we can find the agent |
2223 // Initially marked as invalid. It will be set to valid if we can find the agent |