From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 20 06:32:37 2007 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A16C116A419 for ; Fri, 20 Jul 2007 06:32:37 +0000 (UTC) (envelope-from news@Watt.COM) Received: from wattres.watt.com (wattres.watt.com [66.93.133.130]) by mx1.freebsd.org (Postfix) with ESMTP id 8073F13C468 for ; Fri, 20 Jul 2007 06:32:37 +0000 (UTC) (envelope-from news@Watt.COM) Received: from wattres.watt.com (localhost.watt.com [127.0.0.1]) by wattres.watt.com (8.13.8/8.13.8) with ESMTP id l6K6MBOV004760 for ; Thu, 19 Jul 2007 23:22:16 -0700 (PDT) (envelope-from news@wattres.watt.com) Received: (from news@localhost) by wattres.watt.com (8.13.8/8.13.8/Submit) id l6K6MBB9004759 for hackers@freebsd.org; Thu, 19 Jul 2007 23:22:11 -0700 (PDT) (envelope-from news) To: hackers@freebsd.org Path: not-for-mail From: Steve Watt Newsgroups: local.freebsd-hackers Date: Fri, 20 Jul 2007 06:22:11 +0000 (UTC) Organization: Watt Consultants, San Jose, CA, USA Lines: 19 Message-ID: References: <78c6bd860707191725r14b8bfe3sf15c1f0e30cf82ca@mail.gmail.com> NNTP-Posting-Host: localhost.watt.com X-Trace: wattres.Watt.COM 1184912531 4245 127.0.0.1 (20 Jul 2007 06:22:11 GMT) X-Complaints-To: usenet@wattres.Watt.COM NNTP-Posting-Date: Fri, 20 Jul 2007 06:22:11 +0000 (UTC) X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: steve@Watt.COM (Steve Watt) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (wattres.watt.com [127.0.0.1]); Thu, 19 Jul 2007 23:22:16 -0700 (PDT) X-Archived: 1184912536.695686415@wattres.Watt.COM X-Mailman-Approved-At: Fri, 20 Jul 2007 11:23:25 +0000 Cc: Subject: Re: Path to executable of current process? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2007 06:32:37 -0000 In <78c6bd860707191725r14b8bfe3sf15c1f0e30cf82ca@mail.gmail.com>, Michael B Allen 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//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//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...