Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
On Fri, Oct 14, 2016 at 8:20 AM, Arnaldo Carvalho de Melowrote: > Em Fri, Oct 14, 2016 at 05:57:25AM -0700, Stephane Eranian escreveu: >> On Fri, Oct 14, 2016 at 4:13 AM, Arnaldo Carvalho de Melo >> wrote: >> > Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: >> >> Do we not need to release the memory for err_msg if the condition for >> >> the 'if' statement evaluates to false? Is it that we are going to >> >> kill the process, so no need to release the memory? > >> > I guess that print_error() is called only when an error was returned >> > somewhere, that ret parameter, then if there was no error >> > (JVMTI_ERROR_NONE) in translating that numeric code to an string, >> > err_msg, it can then be used with warnx() (the main purpose of >> > print_error()) and then deallocated. >> > >> > For err != JVMTI_ERROR_NONE it silently goes back to the caller that >> > expected it to print something. >> > >> > I.e. probably it should have an else clause, something like: >> > >> > if (err == JVMTI_ERROR_NONE) { >> > warnx("%s failed with %s", msg, err_msg); >> > (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); >> > } else { >> > warnx("%s failed with an unknown error %d", msg, (int)ret); >> > } >> > >> > Stephane? >> I will fix all of the comments over the week-end. I am away from office >> today. > > I have almost all of them fixed, will fix this one too, if you agree > with the analysis. > Ok, the proposed fix is correct. Thanks for fixing issues. Now, I am tracking down another issue with the injection of jitdump. It seems something goes wrong with ordering and timestamps and some valid jitdump samples are not symbolized. It is not clear what is causing this yet. It may be the issue raised by Adrian a while ago about the finished_round processing. > - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
On Fri, Oct 14, 2016 at 8:20 AM, Arnaldo Carvalho de Melo wrote: > Em Fri, Oct 14, 2016 at 05:57:25AM -0700, Stephane Eranian escreveu: >> On Fri, Oct 14, 2016 at 4:13 AM, Arnaldo Carvalho de Melo >> wrote: >> > Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: >> >> Do we not need to release the memory for err_msg if the condition for >> >> the 'if' statement evaluates to false? Is it that we are going to >> >> kill the process, so no need to release the memory? > >> > I guess that print_error() is called only when an error was returned >> > somewhere, that ret parameter, then if there was no error >> > (JVMTI_ERROR_NONE) in translating that numeric code to an string, >> > err_msg, it can then be used with warnx() (the main purpose of >> > print_error()) and then deallocated. >> > >> > For err != JVMTI_ERROR_NONE it silently goes back to the caller that >> > expected it to print something. >> > >> > I.e. probably it should have an else clause, something like: >> > >> > if (err == JVMTI_ERROR_NONE) { >> > warnx("%s failed with %s", msg, err_msg); >> > (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); >> > } else { >> > warnx("%s failed with an unknown error %d", msg, (int)ret); >> > } >> > >> > Stephane? >> I will fix all of the comments over the week-end. I am away from office >> today. > > I have almost all of them fixed, will fix this one too, if you agree > with the analysis. > Ok, the proposed fix is correct. Thanks for fixing issues. Now, I am tracking down another issue with the injection of jitdump. It seems something goes wrong with ordering and timestamps and some valid jitdump samples are not symbolized. It is not clear what is causing this yet. It may be the issue raised by Adrian a while ago about the finished_round processing. > - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
Em Fri, Oct 14, 2016 at 05:57:25AM -0700, Stephane Eranian escreveu: > On Fri, Oct 14, 2016 at 4:13 AM, Arnaldo Carvalho de Melo> wrote: > > Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: > >> Do we not need to release the memory for err_msg if the condition for > >> the 'if' statement evaluates to false? Is it that we are going to > >> kill the process, so no need to release the memory? > > I guess that print_error() is called only when an error was returned > > somewhere, that ret parameter, then if there was no error > > (JVMTI_ERROR_NONE) in translating that numeric code to an string, > > err_msg, it can then be used with warnx() (the main purpose of > > print_error()) and then deallocated. > > > > For err != JVMTI_ERROR_NONE it silently goes back to the caller that > > expected it to print something. > > > > I.e. probably it should have an else clause, something like: > > > > if (err == JVMTI_ERROR_NONE) { > > warnx("%s failed with %s", msg, err_msg); > > (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > > } else { > > warnx("%s failed with an unknown error %d", msg, (int)ret); > > } > > > > Stephane? > I will fix all of the comments over the week-end. I am away from office today. I have almost all of them fixed, will fix this one too, if you agree with the analysis. - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
Em Fri, Oct 14, 2016 at 05:57:25AM -0700, Stephane Eranian escreveu: > On Fri, Oct 14, 2016 at 4:13 AM, Arnaldo Carvalho de Melo > wrote: > > Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: > >> Do we not need to release the memory for err_msg if the condition for > >> the 'if' statement evaluates to false? Is it that we are going to > >> kill the process, so no need to release the memory? > > I guess that print_error() is called only when an error was returned > > somewhere, that ret parameter, then if there was no error > > (JVMTI_ERROR_NONE) in translating that numeric code to an string, > > err_msg, it can then be used with warnx() (the main purpose of > > print_error()) and then deallocated. > > > > For err != JVMTI_ERROR_NONE it silently goes back to the caller that > > expected it to print something. > > > > I.e. probably it should have an else clause, something like: > > > > if (err == JVMTI_ERROR_NONE) { > > warnx("%s failed with %s", msg, err_msg); > > (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > > } else { > > warnx("%s failed with an unknown error %d", msg, (int)ret); > > } > > > > Stephane? > I will fix all of the comments over the week-end. I am away from office today. I have almost all of them fixed, will fix this one too, if you agree with the analysis. - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
On Fri, Oct 14, 2016 at 4:13 AM, Arnaldo Carvalho de Melowrote: > Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: >> On 13 October 2016 at 05:59, Stephane Eranian wrote: >> > +++ b/tools/perf/jvmti/libjvmti.c >> > @@ -12,6 +12,17 @@ >> > +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) >> > +{ >> > + char *err_msg = NULL; >> > + jvmtiError err; >> > + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); >> > + if (err == JVMTI_ERROR_NONE) { >> > + warnx("%s failed with %s", msg, err_msg); >> > + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); >> > + } >> > +} >> >> Do we not need to release the memory for err_msg if the condition for >> the 'if' statement evaluates to false? Is it that we are going to >> kill the process, so no need to release the memory? > > I guess that print_error() is called only when an error was returned > somewhere, that ret parameter, then if there was no error > (JVMTI_ERROR_NONE) in translating that numeric code to an string, > err_msg, it can then be used with warnx() (the main purpose of > print_error()) and then deallocated. > > For err != JVMTI_ERROR_NONE it silently goes back to the caller that > expected it to print something. > > I.e. probably it should have an else clause, something like: > > if (err == JVMTI_ERROR_NONE) { > warnx("%s failed with %s", msg, err_msg); > (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > } else { > warnx("%s failed with an unknown error %d", msg, (int)ret); > } > > Stephane? >'I will fix all of the comments over the week-end. I am away from office today. > - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
On Fri, Oct 14, 2016 at 4:13 AM, Arnaldo Carvalho de Melo wrote: > Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: >> On 13 October 2016 at 05:59, Stephane Eranian wrote: >> > +++ b/tools/perf/jvmti/libjvmti.c >> > @@ -12,6 +12,17 @@ >> > +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) >> > +{ >> > + char *err_msg = NULL; >> > + jvmtiError err; >> > + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); >> > + if (err == JVMTI_ERROR_NONE) { >> > + warnx("%s failed with %s", msg, err_msg); >> > + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); >> > + } >> > +} >> >> Do we not need to release the memory for err_msg if the condition for >> the 'if' statement evaluates to false? Is it that we are going to >> kill the process, so no need to release the memory? > > I guess that print_error() is called only when an error was returned > somewhere, that ret parameter, then if there was no error > (JVMTI_ERROR_NONE) in translating that numeric code to an string, > err_msg, it can then be used with warnx() (the main purpose of > print_error()) and then deallocated. > > For err != JVMTI_ERROR_NONE it silently goes back to the caller that > expected it to print something. > > I.e. probably it should have an else clause, something like: > > if (err == JVMTI_ERROR_NONE) { > warnx("%s failed with %s", msg, err_msg); > (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > } else { > warnx("%s failed with an unknown error %d", msg, (int)ret); > } > > Stephane? >'I will fix all of the comments over the week-end. I am away from office today. > - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: > On 13 October 2016 at 05:59, Stephane Eranianwrote: > > +++ b/tools/perf/jvmti/libjvmti.c > > @@ -12,6 +12,17 @@ > > +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) > > +{ > > + char *err_msg = NULL; > > + jvmtiError err; > > + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); > > + if (err == JVMTI_ERROR_NONE) { > > + warnx("%s failed with %s", msg, err_msg); > > + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > > + } > > +} > > Do we not need to release the memory for err_msg if the condition for > the 'if' statement evaluates to false? Is it that we are going to > kill the process, so no need to release the memory? I guess that print_error() is called only when an error was returned somewhere, that ret parameter, then if there was no error (JVMTI_ERROR_NONE) in translating that numeric code to an string, err_msg, it can then be used with warnx() (the main purpose of print_error()) and then deallocated. For err != JVMTI_ERROR_NONE it silently goes back to the caller that expected it to print something. I.e. probably it should have an else clause, something like: if (err == JVMTI_ERROR_NONE) { warnx("%s failed with %s", msg, err_msg); (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); } else { warnx("%s failed with an unknown error %d", msg, (int)ret); } Stephane? - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu: > On 13 October 2016 at 05:59, Stephane Eranian wrote: > > +++ b/tools/perf/jvmti/libjvmti.c > > @@ -12,6 +12,17 @@ > > +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) > > +{ > > + char *err_msg = NULL; > > + jvmtiError err; > > + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); > > + if (err == JVMTI_ERROR_NONE) { > > + warnx("%s failed with %s", msg, err_msg); > > + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > > + } > > +} > > Do we not need to release the memory for err_msg if the condition for > the 'if' statement evaluates to false? Is it that we are going to > kill the process, so no need to release the memory? I guess that print_error() is called only when an error was returned somewhere, that ret parameter, then if there was no error (JVMTI_ERROR_NONE) in translating that numeric code to an string, err_msg, it can then be used with warnx() (the main purpose of print_error()) and then deallocated. For err != JVMTI_ERROR_NONE it silently goes back to the caller that expected it to print something. I.e. probably it should have an else clause, something like: if (err == JVMTI_ERROR_NONE) { warnx("%s failed with %s", msg, err_msg); (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); } else { warnx("%s failed with an unknown error %d", msg, (int)ret); } Stephane? - Arnaldo
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
On 13 October 2016 at 05:59, Stephane Eranianwrote: > diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c > index ac12e4b91a92..2d9bc04b79a8 100644 > --- a/tools/perf/jvmti/libjvmti.c > +++ b/tools/perf/jvmti/libjvmti.c > @@ -12,6 +12,17 @@ > static int has_line_numbers; > void *jvmti_agent; > > +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) > +{ > + char *err_msg = NULL; > + jvmtiError err; > + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); > + if (err == JVMTI_ERROR_NONE) { > + warnx("%s failed with %s", msg, err_msg); > + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > + } > +} Do we not need to release the memory for err_msg if the condition for the 'if' statement evaluates to false? Is it that we are going to kill the process, so no need to release the memory? -- Nilay
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI
On 13 October 2016 at 05:59, Stephane Eranian wrote: > diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c > index ac12e4b91a92..2d9bc04b79a8 100644 > --- a/tools/perf/jvmti/libjvmti.c > +++ b/tools/perf/jvmti/libjvmti.c > @@ -12,6 +12,17 @@ > static int has_line_numbers; > void *jvmti_agent; > > +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) > +{ > + char *err_msg = NULL; > + jvmtiError err; > + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); > + if (err == JVMTI_ERROR_NONE) { > + warnx("%s failed with %s", msg, err_msg); > + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); > + } > +} Do we not need to release the memory for err_msg if the condition for the 'if' statement evaluates to false? Is it that we are going to kill the process, so no need to release the memory? -- Nilay
[PATCH 1/9] perf/jit: improve error messages from JVMTI
This patch improves the usefulness of error messages generated by the JVMTI interfac.e This can help identify the root cause of a problem by printing the actual error code. The patch adds a new helper function called print_error(). Signed-off-by: Stephane Eranian--- tools/perf/jvmti/libjvmti.c | 37 +++-- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c index ac12e4b91a92..2d9bc04b79a8 100644 --- a/tools/perf/jvmti/libjvmti.c +++ b/tools/perf/jvmti/libjvmti.c @@ -12,6 +12,17 @@ static int has_line_numbers; void *jvmti_agent; +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) +{ + char *err_msg = NULL; + jvmtiError err; + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); + if (err == JVMTI_ERROR_NONE) { + warnx("%s failed with %s", msg, err_msg); + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); + } +} + static jvmtiError do_get_line_numbers(jvmtiEnv *jvmti, void *pc, jmethodID m, jint bci, jvmti_line_info_t *tab, jint *nr) @@ -22,8 +33,10 @@ do_get_line_numbers(jvmtiEnv *jvmti, void *pc, jmethodID m, jint bci, jvmtiError ret; ret = (*jvmti)->GetLineNumberTable(jvmti, m, _lines, _tab); - if (ret != JVMTI_ERROR_NONE) + if (ret != JVMTI_ERROR_NONE) { + print_error(jvmti, "GetLineNumberTable", ret); return ret; + } for (i = 0; i < nr_lines; i++) { if (loc_tab[i].start_location < bci) { @@ -71,6 +84,8 @@ get_line_numbers(jvmtiEnv *jvmti, const void *compile_info, jvmti_line_info_t ** /* free what was allocated for nothing */ (*jvmti)->Deallocate(jvmti, (unsigned char *)lne); nr_total += (int)nr; + } else { + print_error(jvmti, "GetLineNumberTable", ret); } } } @@ -130,7 +145,7 @@ compiled_method_load_cb(jvmtiEnv *jvmti, ret = (*jvmti)->GetMethodDeclaringClass(jvmti, method, _class); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: cannot get declaring class"); + print_error(jvmti, "GetMethodDeclaringClass", ret); return; } @@ -144,21 +159,21 @@ compiled_method_load_cb(jvmtiEnv *jvmti, ret = (*jvmti)->GetSourceFileName(jvmti, decl_class, _name); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: cannot get source filename ret=%d", ret); + print_error(jvmti, "GetSourceFileName", ret); goto error; } ret = (*jvmti)->GetClassSignature(jvmti, decl_class, _sign, NULL); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: getclassignature failed"); + print_error(jvmti, "GetClassSignature", ret); goto error; } ret = (*jvmti)->GetMethodName(jvmti, method, _name, _sign, NULL); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: failed getmethodname"); + print_error(jvmti, "GetMethodName", ret); goto error; } @@ -253,7 +268,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused) ret = (*jvmti)->AddCapabilities(jvmti, ); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: acquire compiled_method capability failed"); + print_error(jvmti, "AddCapabilities", ret); return -1; } ret = (*jvmti)->GetJLocationFormat(jvmti, ); @@ -264,7 +279,9 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused) ret = (*jvmti)->AddCapabilities(jvmti, ); if (ret == JVMTI_ERROR_NONE) has_line_numbers = 1; -} +} else if (ret != JVMTI_ERROR_NONE) + print_error(jvmti, "GetJLocationFormat", ret); + memset(, 0, sizeof(cb)); @@ -273,21 +290,21 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused) ret = (*jvmti)->SetEventCallbacks(jvmti, , sizeof(cb)); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: cannot set event callbacks"); + print_error(jvmti, "SetEventCallbacks", ret); return -1; } ret = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: setnotification failed for method_load"); + print_error(jvmti,
[PATCH 1/9] perf/jit: improve error messages from JVMTI
This patch improves the usefulness of error messages generated by the JVMTI interfac.e This can help identify the root cause of a problem by printing the actual error code. The patch adds a new helper function called print_error(). Signed-off-by: Stephane Eranian --- tools/perf/jvmti/libjvmti.c | 37 +++-- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c index ac12e4b91a92..2d9bc04b79a8 100644 --- a/tools/perf/jvmti/libjvmti.c +++ b/tools/perf/jvmti/libjvmti.c @@ -12,6 +12,17 @@ static int has_line_numbers; void *jvmti_agent; +static void print_error(jvmtiEnv *jvmti, const char *msg, jvmtiError ret) +{ + char *err_msg = NULL; + jvmtiError err; + err = (*jvmti)->GetErrorName(jvmti, ret, _msg); + if (err == JVMTI_ERROR_NONE) { + warnx("%s failed with %s", msg, err_msg); + (*jvmti)->Deallocate(jvmti, (unsigned char *)err_msg); + } +} + static jvmtiError do_get_line_numbers(jvmtiEnv *jvmti, void *pc, jmethodID m, jint bci, jvmti_line_info_t *tab, jint *nr) @@ -22,8 +33,10 @@ do_get_line_numbers(jvmtiEnv *jvmti, void *pc, jmethodID m, jint bci, jvmtiError ret; ret = (*jvmti)->GetLineNumberTable(jvmti, m, _lines, _tab); - if (ret != JVMTI_ERROR_NONE) + if (ret != JVMTI_ERROR_NONE) { + print_error(jvmti, "GetLineNumberTable", ret); return ret; + } for (i = 0; i < nr_lines; i++) { if (loc_tab[i].start_location < bci) { @@ -71,6 +84,8 @@ get_line_numbers(jvmtiEnv *jvmti, const void *compile_info, jvmti_line_info_t ** /* free what was allocated for nothing */ (*jvmti)->Deallocate(jvmti, (unsigned char *)lne); nr_total += (int)nr; + } else { + print_error(jvmti, "GetLineNumberTable", ret); } } } @@ -130,7 +145,7 @@ compiled_method_load_cb(jvmtiEnv *jvmti, ret = (*jvmti)->GetMethodDeclaringClass(jvmti, method, _class); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: cannot get declaring class"); + print_error(jvmti, "GetMethodDeclaringClass", ret); return; } @@ -144,21 +159,21 @@ compiled_method_load_cb(jvmtiEnv *jvmti, ret = (*jvmti)->GetSourceFileName(jvmti, decl_class, _name); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: cannot get source filename ret=%d", ret); + print_error(jvmti, "GetSourceFileName", ret); goto error; } ret = (*jvmti)->GetClassSignature(jvmti, decl_class, _sign, NULL); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: getclassignature failed"); + print_error(jvmti, "GetClassSignature", ret); goto error; } ret = (*jvmti)->GetMethodName(jvmti, method, _name, _sign, NULL); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: failed getmethodname"); + print_error(jvmti, "GetMethodName", ret); goto error; } @@ -253,7 +268,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused) ret = (*jvmti)->AddCapabilities(jvmti, ); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: acquire compiled_method capability failed"); + print_error(jvmti, "AddCapabilities", ret); return -1; } ret = (*jvmti)->GetJLocationFormat(jvmti, ); @@ -264,7 +279,9 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused) ret = (*jvmti)->AddCapabilities(jvmti, ); if (ret == JVMTI_ERROR_NONE) has_line_numbers = 1; -} +} else if (ret != JVMTI_ERROR_NONE) + print_error(jvmti, "GetJLocationFormat", ret); + memset(, 0, sizeof(cb)); @@ -273,21 +290,21 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved __unused) ret = (*jvmti)->SetEventCallbacks(jvmti, , sizeof(cb)); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: cannot set event callbacks"); + print_error(jvmti, "SetEventCallbacks", ret); return -1; } ret = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); if (ret != JVMTI_ERROR_NONE) { - warnx("jvmti: setnotification failed for method_load"); + print_error(jvmti, "SetEventNotificationMode(METHOD_LOAD)", ret);