Skip navigation.
 
mlRe: Solaris-style truss(1) for Mac OS X?
FROM : Nicholas Riley
DATE : Sat Nov 02 17:06:01 2002

On Sat, Nov 02, 2002 at 04:43:14PM -0800, Rich Morin wrote:
> Even with the Developer Tools installed, my Mac OS X system has no truss(1)
> command.  The FreeBSD truss command is, sadly, only a shadow of the Solaris
> version.  Most critically (in my case), it has no option to trace a process
> _and all of its descendents_.
>
> Is there (any chance of getting :-) a Solaris-style truss(1) for Mac OS X?


ktrace -d will trace descendents on OS X 10.2 (and on the FreeBSD 4.6
system I checked; the manpage appears identical).  The equivalent
outputs are below:

[Solaris]
execve("/usr/bin/ls", 0xFFBEF69C, 0xFFBEF6A4)  argc = 1

[FreeBSD]
66518 ktrace  CALL  execve(0xbfbff44c,0xbfbff954,0xbfbff95c)
66518 ktrace  NAMI  "/bin/ls"
66518 ls      RET  execve 0

[OS X]
  2298 ktrace  CALL  execve(0xbffff150,0xbffff748,0xbffff750)
  2298 ktrace  NAMI  "/usr/local/bin/ls"
  2298 ktrace  NAMI  "/usr/lib/dyld"
  2298 ls      RET  execve 0

The only difference appears to be in the representation of arguments,
though obviously Solaris's output is quite a bit more user-friendly.

I don't have a truss command on this FreeBSD system, and the source
code I found fails to compile because I don't have a full source tree.
However, this code has a -f option:

    -f      Follow the child processes of the process being traced.

<http://www.sharma-home.net/~adsharma/projects/freebsd/truss.tar.gz>

--
=Nicholas Riley <<email_removed>> | <http://www.uiuc.edu/ph/www/njriley>
        Pablo Research Group, Department of Computer Science and
  Medical Scholars Program, University of Illinois at Urbana-Champaign

Related mailsAuthorDate
mlSolaris-style truss(1) for Mac OS X? Rich Morin Nov 2, 16:43
mlRe: Solaris-style truss(1) for Mac OS X? Nicholas Riley Nov 2, 17:06