This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH/RFC 02/02 v2] Refactor PRPSINFO handling on GDB
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: Pedro Alves <palves at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>, Binutils Development <binutils at sourceware dot org>, "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Fri, 11 Jan 2013 18:11:45 +0100
- Subject: Re: [PATCH/RFC 02/02 v2] Refactor PRPSINFO handling on GDB
- References: <m3ip81v0fu.fsf@redhat.com> <20121218171555.GA19639@host2.jankratochvil.net> <m3pq1ykp6j.fsf@redhat.com> <m38v8gfgq9.fsf@redhat.com> <20121231194134.GA17955@host2.jankratochvil.net> <m3623d7e6l.fsf@redhat.com> <50EF0BE3.6040503@redhat.com> <m3vcb4z873.fsf@redhat.com> <50F02661.8020400@redhat.com> <m3libzzm7u.fsf@redhat.com>
On Fri, 11 Jan 2013 18:03:01 +0100, Sergio Durigan Junior wrote:
> On Friday, January 11 2013, Pedro Alves wrote:
> > On 01/11/2013 03:53 AM, Sergio Durigan Junior wrote:
> >>>> + /* Generating and copying the program's arguments. `get_inferior_args'
> >>>> + may throw, but we want to continue the execution anyway. */
> >>>> + TRY_CATCH (ex, RETURN_MASK_ERROR)
> >>>> + {
> >>>> + infargs = get_inferior_args ();
> >>>> + }
> >>>> +
> >>>
> >>> Hmm? We were not doing that before. What exception is that?
> >>
> >> `get_inferior_args' calls `construct_inferior_arguments', which can call
> >> `error' in an specific scenario (not STARTUP_WITH_SHELL, arguments that
> >> contain spaces).
> >
> > This is an example of something that should be split into
> > its own change, along with its own rationale. This is
> > independent of any refactoring of PRPSINFO handling.
> > We're already calling get_inferior_args nowadays, and I don't
> > ever remember this error being reported as a problem.
>
> My first version of the patch didn't contain the TRY_CATCH part. It was
> Jan who made this suggestion, and I thought it made sense.
>
> I really think a TRY_CATCH does not cause any harm here, but if you
> insist, I can easily remove it from the patch.
I do not think there should be code leaking memory in a case of throwsn
exception when the callee contains an error() call. Even if the error() call
is only in a conditional which with the current setup around can never happen.
I agree one can improve get_inferior_args in a way it no longer throws.
That would be another way to fix it. I do not mind which way the memory leak
of linux_nat_fill_prpsinfo gets fixed.
Thanks,
Jan