Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1500977
| From | Stephane Eranian <eranian@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI |
| Date | 2016-10-14 15:30 +0200 |
| Message-ID | <ssaIF-1MD-5@gated-at.bofh.it> (permalink) |
| References | <srM3D-2I3-3@gated-at.bofh.it> <srM3D-2I3-17@gated-at.bofh.it> <srUNz-8lw-1@gated-at.bofh.it> <ss8GS-zD-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Oct 14, 2016 at 4:13 AM, Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
> Em Thu, Oct 13, 2016 at 03:05:40PM -0500, Nilay Vaish escreveu:
>> On 13 October 2016 at 05:59, Stephane Eranian <eranian@google.com> 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, &err_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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/9] perf/jit: various improvements Stephane Eranian <eranian@google.com> - 2016-10-13 13:10 +0200
[PATCH 1/9] perf/jit: improve error messages from JVMTI Stephane Eranian <eranian@google.com> - 2016-10-13 13:10 +0200
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI Nilay Vaish <nilayvaish@gmail.com> - 2016-10-13 22:30 +0200
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-14 13:20 +0200
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI Stephane Eranian <eranian@google.com> - 2016-10-14 15:30 +0200
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-14 17:30 +0200
Re: [PATCH 1/9] perf/jit: improve error messages from JVMTI Stephane Eranian <eranian@google.com> - 2016-10-17 16:00 +0200
[tip:perf/core] perf jit: Improve error messages from JVMTI tip-bot for Stephane Eranian <tipbot@zytor.com> - 2016-10-24 21:10 +0200
[PATCH 5/9] perf/jit: do not assume pgoff is zero Stephane Eranian <eranian@google.com> - 2016-10-13 13:10 +0200
[tip:perf/core] perf jit: Do not assume pgoff is zero tip-bot for Stefano Sanfilippo <tipbot@zytor.com> - 2016-10-24 21:10 +0200
[PATCH 8/9] perf/jit: Check JITHEADER_VERSION Stephane Eranian <eranian@google.com> - 2016-10-13 13:10 +0200
[tip:perf/core] perf jit: Check JITHEADER_VERSION tip-bot for Stefano Sanfilippo <tipbot@zytor.com> - 2016-10-24 21:10 +0200
[PATCH 3/9] perf/jit: remove unecessary padding in jitdump file Stephane Eranian <eranian@google.com> - 2016-10-13 13:10 +0200
[tip:perf/core] perf jit: Remove unecessary padding in jitdump file tip-bot for Stephane Eranian <tipbot@zytor.com> - 2016-10-24 21:00 +0200
[PATCH 6/9] perf/jit: add unwinding support Stephane Eranian <eranian@google.com> - 2016-10-13 13:10 +0200
[tip:perf/core] perf jit: Add unwinding support tip-bot for Stefano Sanfilippo <tipbot@zytor.com> - 2016-10-24 21:10 +0200
[PATCH 2/9] perf/jit: enable jitdump support without dwarf Stephane Eranian <eranian@google.com> - 2016-10-13 13:10 +0200
Re: [PATCH 2/9] perf/jit: enable jitdump support without dwarf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-13 20:20 +0200
Re: [PATCH 2/9] perf/jit: enable jitdump support without dwarf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-13 21:00 +0200
Re: [PATCH 2/9] perf/jit: enable jitdump support without dwarf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-13 21:20 +0200
Re: [PATCH 2/9] perf/jit: enable jitdump support without dwarf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-13 21:50 +0200
Re: [PATCH 2/9] perf/jit: enable jitdump support without dwarf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-13 21:40 +0200
[tip:perf/core] perf jit: Enable jitdump support without dwarf tip-bot for Maciej Debski <tipbot@zytor.com> - 2016-10-24 21:00 +0200
csiph-web