This is the mail archive of the
mailing list for the GDB project.
Re: linux-proc readlink patch
- From: Michael Snyder <msnyder at redhat dot com>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 09 Jan 2002 14:18:53 -0800
- Subject: Re: linux-proc readlink patch
- Organization: Red Hat, Inc.
- References: <20020109151622.A842@nevyn.them.org>
Daniel Jacobowitz wrote:
> This patch:
> 2002-01-08 Michael Snyder <email@example.com>
> * linux-proc.c (child_pid_to_exec_file): Use readlink to get the
> real name of the executable, rather than the /proc name.
> (which I never saw posted on gdb-patches; was that an artifact of the email
> breakage yesterday?)
Coulda been. I sent so many yesterday (and had to resend so many of
that I can't remember.
> seems to have at least one problem.
> (1) It introduces a memory leak, if I understand the semantics of cleanups
> correctly. make_cleanup's cleanups will only be called (according to the
> comment in utils.c) after a failed command.
Nope, that's not the semantics. Cleanups are always done, no later than
when the command is finished executing (if not earlier). I even checked
to make sure that these were done. There's no memory leak.
> (2) It is not, IIRC, always correct in the case of chroots. Handling for
> this has changed across Linux versions several times. On 2.2 it seems to be
> correct (to my surprise, actually), but I believe it is not on 2.0. Do we
> care? Probably not, as 2.0 is now -very- old.
Well, if it fails, the code falls back to using the original /proc name.