From owner-freebsd-questions@FreeBSD.ORG Tue Feb 8 17:20:59 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 39B6316A4CE for ; Tue, 8 Feb 2005 17:20:59 +0000 (GMT) Received: from smtphost.cis.strath.ac.uk (smtphost.cis.strath.ac.uk [130.159.196.96]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2644843D2F for ; Tue, 8 Feb 2005 17:20:58 +0000 (GMT) (envelope-from chodgins@cis.strath.ac.uk) Received: from [192.168.0.4] (chrishodgins.force9.co.uk [84.92.20.141]) j18HKape023796; Tue, 8 Feb 2005 17:20:36 GMT Message-ID: <4208F605.9060402@cis.strath.ac.uk> Date: Tue, 08 Feb 2005 17:25:25 +0000 From: Chris Hodgins User-Agent: Mozilla Thunderbird 1.0 (X11/20050204) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dan Nelson References: <20050208115928.GE8619@alzatex.com> <20050208162429.GA82752@dan.emsphone.com> In-Reply-To: <20050208162429.GA82752@dan.emsphone.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-CIS-MailScanner-Information: Please contact support@cis.strath.ac.uk for more information X-CIS-MailScanner: Found to be clean X-CIS-MailScanner-SpamCheck: not spam, SpamAssassin (score=0, required 6) X-CIS-MailScanner-From: chodgins@cis.strath.ac.uk cc: "Loren M. Lang" cc: FreeBSD Mailing list Subject: Re: ktrace as a replacement for strace X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Feb 2005 17:20:59 -0000 Dan Nelson wrote: > In the last episode (Feb 08), Loren M. Lang said: > >>I'm looking for a replacement for the strace program I used to use on >>linux; freebsd has a port of strace, but it just hangs everytime I >>use it. It looks like the bsd version of strace would be >>ktrace/kdump. I was able to get these to print a trace of the >>program I ran, but it doesn't do all the nice substatuting that >>strace was able to do. Mainly, I just want the first argument of open >>to look like a string instead of a 32 bit pointer that I can't read. >>I'm trying to figure out what files this program is trying to read so >>I can edit it's configuration file. > > > The string in the NAMI line immediately after an open() call is the > filename in kdump output. > > strace actually does work, but I think it's losing a race when it > forks the child process. Try suspending and resuming strace: > > (dan@dan.4) /home/dan> strace date > > ^Z > zsh: 62219 suspended strace date > [1] + suspended strace date > (dan@dan.4) /home/dan> fg > [1] + continued strace date > execve(0xbfbfdef4, [0xbfbfe3b8], [/* 0 vars */]) = 0 > mmap(0, 3920, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0) = 0x28071000 > munmap(0x28071000, 3920) = 0 > ... > > strace hasn't been updated in a while, though, and has problems parsing > newer syscalls. Take a look at the truss command in the base system, > which does about the same thing as strace. Ktrace has the advantage > that it's less intrusive; both strace and truss have to stop the > process to print out data, which really slow it down. > Is truss still being fixed to work without procfs or is ktrace a better replacement? Chris