Date: Wed, 3 Mar 1999 10:37:34 -0600 From: Dan Nelson <dnelson@emsphone.com> To: Greg Black <gjb@comkey.com.au> Cc: freebsd-questions@freebsd.org Subject: Re: strace Message-ID: <19990303103733.A73031@dan.emsphone.com> In-Reply-To: <19990303084634.1279.qmail@alpha.comkey.com.au>; from "Greg Black" on Wed Mar 3 18:46:34 GMT 1999 References: <XFMail.990301004820.fdarkness@iwebb.com> <19990301001743.A17787@dan.emsphone.com> <19990303084634.1279.qmail@alpha.comkey.com.au>
index | next in thread | previous in thread | raw e-mail
In the last episode (Mar 03), Greg Black said:
> > Try truss or the ktrace/kdump pair.
>
> That's an interesting suggestion. I've been using ktrace/kdump for
> years, but thought I'd look for truss. On 2.2.8, the truss manpages
> are for ktrace and there's no other truss stuff. Is it actually
> available for FreeBSD? Is it better than ktrace?
Truss is a 3.0 invention. It runs completely in userspace, and
attaches to the target process via /proc/*/mem. Whereas ktrace works
from 'inside' the kernel, logging syscall arguments, NAMEI calls, and
I/O access, truss works more like gdb and only logs syscalls and
signals. But it has the advantage of being smarter than ktrace. Since
the output is printed in realtime, truss can (but doesn't at the
moment) decode structures like fd_set, timeval, stat inline with the
syscall. Here's an snippet of what DEC Unix's truss command prints for
an "ls" call:
Tracing process /proc/32372
getpagesize () = 8192
obreak (0x140027960) = 0
gettimeofday (0x11ffff4e8, 0x0) = 0, [ {920478551, 945781}, {} ]
getuid () = 1000
ioctl (1, 0x40067408<Out,TIOCGETP,6>, 11ffff4f8) = -1, Errno 25 (Not a typewriter)
obreak (0x140079960) = 0
lstat (".", 0x11fffd4a8) = 0 [ , <8.16384.8576 drwxrwxrwx 5 root system 512 920478547,920477170,920477170> ]
open (".", O_RDONLY, 001) = 4
fcntl (4, F_SETFD, FD_CLOEXEC) = 0
fstat (4, 0x11ffff418) = 0 [ , <8.16384.8576 drwxrwxrwx 5 root system 512 920478547,920477170,920477170> ]
Note that the results of gettimeofday() and lstat() are decoded for
you, and the second argument of open() has been translated into
O_READONLY.
Our current truss doesn't do all this yet, but I am working on adding
this (slowly).
-Dan Nelson
dnelson@emsphone.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990303103733.A73031>
