Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4262253
  • 博文数量: 601
  • 博客积分: 15410
  • 博客等级: 上将
  • 技术积分: 6884
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-16 08:11
个人简介

独学而无友,则孤陋而寡闻!

文章分类

全部博文(601)

文章存档

2020年(1)

2018年(4)

2017年(7)

2016年(42)

2015年(25)

2014年(15)

2013年(36)

2012年(46)

2011年(117)

2010年(148)

2009年(82)

2008年(37)

2007年(41)

分类: BSD

2011-02-25 22:45:47

TRUSS(1)                FreeBSD General Commands Manual               TRUSS(1)

NAME
     truss — trace system calls

SYNOPSIS
     truss [-facedDS] [-o file] [-s strsize] -p pid
     truss [-facedDS] [-o file] [-s strsize] command [args]

DESCRIPTION
     The truss utility traces the system calls called by the specified process
     or program.  Output is to the specified output file, or standard error by
     default.  It does this by stopping and restarting the process being moni‐
     tored via ptrace(2).

     The options are as follows:

     -f      Trace descendants of the original traced process created by
             fork(2), vfork(2), etc.

     -a      Show the argument strings that are passed in each execve(2) sys‐
             tem call.

     -c      Do not display individual system calls.  Instead, before exiting,
             print a summary containing for each system call: the total system
             time used, the number of times the call was invoked, and the num‐
             ber of times the call returned with an error.

     -e      Show the environment strings that are passed in each execve(2)
             system call.

     -d      Include timestamps in the output showing the time elapsed since
             the trace was started.

     -D      Include timestamps in the output showing the time elapsed since
             the last recorded event.

     -S      Do not display information about signals received by the process.
             (Normally, truss displays signal as well as system call events.)

     -o file
             Print the output to the specified file instead of standard error.

     -s strsize
             Display strings using at most strsize characters.  If the buffer
             is larger, “...” will be displayed at the end of the string.  The
             default strsize is 32.

     -p pid  Follow the process specified by pid instead of a new command.

     command [args]
             Execute command and trace the system calls of it.  (The -p and
             command options are mutually exclusive.)

EXAMPLES
     # Follow the system calls used in echoing "hello"
           $ truss /bin/echo hello
     # Do the same, but put the output into a file
           $ truss -o /tmp/truss.out /bin/echo hello
     # Follow an already-running process
           $ truss -p 34

SEE ALSO
     kdump(1), ktrace(1), ptrace(2)

HISTORY
     The truss command was written by Sean Eric Fagan for FreeBSD.  It was
     modeled after similar commands available for System V Release 4 and
     SunOS.

FreeBSD 8.2                      May 12, 2009                      FreeBS
阅读(1815) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~