Commit 84cf2d0b authored by Lubomir Bulej's avatar Lubomir Bulej
Browse files

Be a bit more verbose in error messages

parent 8775d418
......@@ -124,7 +124,7 @@ connection_send_full (struct connection * connection, const void * buf, const si
assert ((buf != NULL) || (buf == NULL && len == 0));
ssize_t sent = __socket_xfer_full ((xfer_fn) send, connection->sockfd, buf, len);
check_std_error (sent < 0, "connection_send_full: error sending data to server");
check_std_error (sent < 0, "connection_send_full: error sending %zu bytes to server", len);
#ifdef DEBUG
connection->sent_bytes += sent;
......@@ -144,7 +144,7 @@ connection_recv_full (struct connection * connection, void * buf, const size_t l
assert ((buf != NULL) || (buf == NULL && len == 0));
ssize_t received = __socket_xfer_full ((xfer_fn) recv, connection->sockfd, buf, len);
check_std_error (received < 0, "connection_recv_full: error receiving data from server");
check_std_error (received < 0, "connection_recv_full: error receiving %zu bytes from server", len);
#ifdef DEBUG
connection->recv_bytes += received;
......
......@@ -183,7 +183,7 @@ jlong
jvmti_get_object_tag (jvmtiEnv * jvmti, jobject object) {
jlong tag;
jvmtiError error = (*jvmti)->GetTag (jvmti, object, &tag);
check_jvmti_error (jvmti, error, "failed to get object tag");
check_jvmti_error (jvmti, error, "failed to get object %p tag", object);
return tag;
}
......@@ -195,7 +195,7 @@ jvmti_get_object_tag (jvmtiEnv * jvmti, jobject object) {
jlong
jvmti_set_object_tag (jvmtiEnv * jvmti, jobject object, jlong tag) {
jvmtiError error = (*jvmti)->SetTag (jvmti, object, tag);
check_jvmti_error (jvmti, error, "failed to set object tag");
check_jvmti_error (jvmti, error, "failed to set object %p tag to %" PRId64, object, tag);
return tag;
}
......
......@@ -77,7 +77,7 @@ __alloc_buffer (size_t len) {
//
uint8_t * buf = (uint8_t *) malloc (len + 1);
check_error (buf == NULL, "failed to allocate buffer");
check_error (buf == NULL, "failed to allocate buffer of size %zu", len);
buf [len] = '\0';
return buf;
......
......@@ -25,7 +25,7 @@ void
send_client_message (const ClientMessage * message, struct connection * restrict conn) {
size_t send_size = client_message__get_packed_size (message);
void * buffer = malloc (send_size);
check_error (buffer == NULL, "failed to allocate buffer for client message");
check_error (buffer == NULL, "failed to allocate %zu bytes for client message buffer", send_size);
client_message__pack (message, buffer);
message_send (conn, buffer, send_size);
......@@ -42,7 +42,7 @@ receive_server_message (struct connection * restrict conn) {
size_t recv_size = message_recv (conn, &buffer);
ServerMessage * response = server_message__unpack (NULL, recv_size, buffer);
check_error (response == NULL, "failed to receive server message");
check_error (response == NULL, "failed to unpack server message");
free (buffer);
return (response);
......
......@@ -4,6 +4,7 @@
#include "jvmtiutil.h"
#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -217,7 +218,7 @@ jlong
jvmti_get_object_tag (jvmtiEnv * jvmti, jobject object) {
jlong tag;
jvmtiError error = (*jvmti)->GetTag (jvmti, object, &tag);
check_jvmti_error (jvmti, error, "failed to get object tag");
check_jvmti_error (jvmti, error, "failed to get object %p tag", object);
return tag;
}
......@@ -229,10 +230,11 @@ jvmti_get_object_tag (jvmtiEnv * jvmti, jobject object) {
jlong
jvmti_set_object_tag (jvmtiEnv * jvmti, jobject object, jlong tag) {
jvmtiError error = (*jvmti)->SetTag (jvmti, object, tag);
check_jvmti_error (jvmti, error, "failed to set object tag");
check_jvmti_error (jvmti, error, "failed to set object %p tag to %" PRId64, object, tag);
return tag;
}
/**
* Obtains the JVM(TM) Tool Interface from JVM(TM) instance.
*/
......@@ -260,6 +262,7 @@ jvm_get_jvmti (JavaVM * jvm) {
return jvmti;
}
/*
* Set new capabilities by adding the capabilities whose values are set to one
* (1) in *caps. All previous capabilities are retained. Typically
......@@ -274,6 +277,7 @@ jvmti_add_capabilities (jvmtiEnv * jvmti, const jvmtiCapabilities * caps) {
check_jvmti_error (jvmti, error, "failed to add JVMTI capabilities");
}
/*
* Set the functions to be called for each event. This method may only be
* called during the OnLoad or the live phase.
......@@ -287,6 +291,7 @@ jvmti_register_callbacks (jvmtiEnv * jvmti, const jvmtiEventCallbacks * callback
check_jvmti_error (jvmti, error, "failed to register event callbacks");
}
/*
* Enables given JVMTI events.
*/
......
......@@ -121,7 +121,7 @@ connection_send_full (struct connection * connection, const void * buf, const si
assert ((buf != NULL) || (buf == NULL && len == 0));
ssize_t sent = __socket_xfer_full ((xfer_fn) send, connection->sockfd, buf, len);
check_std_error (sent < 0, "connection_send_full: error sending data to server");
check_std_error (sent < 0, "connection_send_full: error sending %zu bytes to server", len);
#ifdef DEBUG
connection->sent_bytes += sent;
......@@ -141,7 +141,7 @@ connection_recv_full (struct connection * connection, void * buf, const size_t l
assert ((buf != NULL) || (buf == NULL && len == 0));
ssize_t received = __socket_xfer_full ((xfer_fn) recv, connection->sockfd, buf, len);
check_std_error (received < 0, "connection_recv_full: error receiving data from server");
check_std_error (received < 0, "connection_recv_full: error receiving %zu bytes from server", len);
#ifdef DEBUG
connection->recv_bytes += received;
......
......@@ -75,7 +75,7 @@ __alloc_buffer (size_t len) {
//
uint8_t * buf = (uint8_t *) malloc (len + 1);
check_error (buf == NULL, "failed to allocate buffer");
check_error (buf == NULL, "failed to allocate buffer of size %zu", len);
buf [len] = '\0';
return buf;
......
Supports Markdown
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