Commit c60bc6a3 authored by Lubomir Bulej's avatar Lubomir Bulej

Miscellaneous cleanups

parent 12893c1a
......@@ -106,15 +106,15 @@ static volatile bool jvm_is_initialized;
(((name) == NULL) ? "<unknown>" : (name))
#define rdaprefix(args...) \
rdoutput ("disl-agent: "); \
rdoutput (AGENT_NAME ": "); \
rdoutput (args);
#define rdatprefix(info, args...) \
rdoutput ("disl-agent [%s]: ", __safe_name ((info)->name)); \
rdoutput (AGENT_NAME " [%s]: ", __safe_name ((info)->name)); \
rdoutput (args);
#define rdatiprefix(info, args...) \
rdoutput ("disl-agent [%s, %" PRId64 "]: ", __safe_name ((info)->name), (info)->id); \
rdoutput (AGENT_NAME " [%s, %" PRId64 "]: ", __safe_name ((info)->name), (info)->id); \
rdoutput (args);
#define rdaprintf(args...) \
......@@ -182,7 +182,7 @@ __instrument_class (
) {
//
// Put the class data into a request message, acquire a connection and
// send the it to the server. Receive the response and release the
// send the it to the server. Wait for a response and release the
// connection again.
//
ClientMessage message = CLIENT_MESSAGE__INIT;
......@@ -201,20 +201,21 @@ __instrument_class (
message.request_case = CLIENT_MESSAGE__REQUEST_INSTRUMENT_CLASS_REQUEST;
message.instrument_class_request = &request;
struct connection * conn = network_acquire_connection ();
send_client_message(message, conn);
//
ServerMessage * resp = receive_server_message(conn);
struct connection * conn = network_acquire_connection ();
send_client_message (message, conn);
ServerMessage * resp = receive_server_message (conn);
network_release_connection(conn);
assert( resp->response_case == SERVER_MESSAGE__RESPONSE_INSTRUMENT_CLASS_RESPONSE );
InstrumentClassResponse * response = resp->instrument_class_response;
//
// Check if error occurred on the server.
// The control field of the response contains the error message.
// Check the response and if it indicates an error during instrumentation,
// bail out with an error message.
//
assert (resp->response_case == SERVER_MESSAGE__RESPONSE_INSTRUMENT_CLASS_RESPONSE);
InstrumentClassResponse * response = resp->instrument_class_response;
if (response->result == INSTRUMENT_CLASS_RESPONSE__INSTRUMENT_CLASS_RESULT__ERROR) {
fprintf (
stderr, AGENT_NAME ": instrumentation server error:\n%s\n",
......@@ -225,9 +226,8 @@ __instrument_class (
}
//
// Update the class definition and signal that the class has been
// modified if non-empty class code has been returned. Otherwise,
// signal that the class has not been modified.
// Update the class definition and signal whether the class has been
// modified at the server or not.
//
if (response->result == INSTRUMENT_CLASS_RESPONSE__INSTRUMENT_CLASS_RESULT__CLASS_MODIFIED) {
class_def->class_byte_count = response->classbytes.len;
......@@ -393,7 +393,7 @@ __thread_name (jvmtiEnv * jvmti, JNIEnv * jni) {
//
// Release the thread_group and context_class_loader
// references because we dont not need them.
// references because we do not need them.
//
if (jni != NULL) {
(* jni)->DeleteLocalRef (jni, info.thread_group);
......@@ -518,8 +518,8 @@ jvmti_callback_class_file_load (
}
//
// Force loading of the super class or the interface classes. This is
// only used when the VM is out of the primordial phase, which allows
// Force loading of the super class or the interface classes. This can
// only be done when the VM is out of the PRIMORDIAL phase, which allows
// JNI calls to be made.
//
if (agent_config.force_superclass || agent_config.force_interfaces) {
......@@ -865,7 +865,7 @@ Agent_OnLoad (JavaVM * jvm, char * options, void * reserved) {
rdaprintf ("agent loaded, initializing connections\n");
network_init (agent_config.server_host, agent_config.server_port);
session_start(&agent_config);
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