Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jul 2007 06:22:11 +0000 (UTC)
From:      Steve Watt <steve.removethis@Watt.COM>
To:        hackers@freebsd.org
Subject:   Re: Path to executable of current process?
Message-ID:  <f7pkaj$44l$1@wattres.Watt.COM>
References:  <78c6bd860707191725r14b8bfe3sf15c1f0e30cf82ca@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In <78c6bd860707191725r14b8bfe3sf15c1f0e30cf82ca@mail.gmail.com>,
Michael B Allen <ioplex@gmail.com> wrote:

>Actually what I'm *really* trying to do is port some code that invokes
>GDB to do a backtrace and I need to give GDB the path to the
>executable of the current process (e.g. on linux this is
>/proc/<pid>/exe) and the pid of the process to trace (easy - getpid).
>The first argument is trickey since FreeBSD frequently does not have a
>/proc filesystem. So it seems kvm_getargv should have this path no?

# mount_procfs proc /proc

# /bin/ls -l /proc/<pid>/file

Note that if the executable on disk gets replaced, this won't work.
-- 
Steve Watt KD6GGD  PP-ASEL-IA          ICBM: 121W 56' 57.5" / 37N 20' 15.3"
 Internet: steve @ Watt.COM                      Whois: SW32-ARIN
   Free time?  There's no such thing.  It just comes in varying prices...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f7pkaj$44l$1>