linux-proc readlink patch

Daniel Jacobowitz drow@mvista.com
Wed Jan 9 12:15:00 GMT 2002


This patch:

2002-01-08  Michael Snyder  <msnyder@redhat.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?)

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.

(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.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gdb-patches mailing list