Commit f7c43471 authored by Lubomir Bulej's avatar Lubomir Bulej

Move agent initialization after JVMTI initialization

This is safe, as no JVMTI events should be generated before the
agent initialization is complete.
parent c8e00783
......@@ -766,19 +766,6 @@ Agent_OnLoad (JavaVM * jvm, char * options, void * reserved) {
__jvmti_add_capabilities (jvmti, &caps);
// configure agent and init connections
__configure_from_options (options, &agent_config);
__configure_from_properties (jvmti, &agent_config);
jvm_is_started = false;
jvm_is_initialized = false;
agent_code_flags = __calc_code_flags (&agent_config, true);
rdaprintf ("agent loaded, initializing connections\n");
network_init (agent_config.server_host, agent_config.server_port);
session_start(&agent_config);
// Register JVMTI event callbacks.
jvmtiEventCallbacks callbacks = {
.VMStart = &jvmti_callback_vm_start,
......@@ -801,9 +788,18 @@ Agent_OnLoad (JavaVM * jvm, char * options, void * reserved) {
__jvmti_enable_events (jvmti, events, sizeof_array (events));
// configure agent and init connections
__configure_from_options (options, &agent_config);
__configure_from_properties (jvmti, &agent_config);
jvm_is_started = false;
jvm_is_initialized = false;
agent_code_flags = __calc_code_flags (&agent_config, true);
rdaprintf ("agent loaded, initializing connections\n");
network_init (agent_config.server_host, agent_config.server_port);
session_start(&agent_config);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment