Strace: trace 系统调用

strace - trace system calls and signals

如:

strace -s 200 -f -o /var/tmp/trace.log -p <process pid>

-s strsize  Specify  the maximum string size to print (the default is 32).  Note that filenames are not considered strings and are always printed
                   in full. 打处理的最大字符串长度

-p pid      Attach to the process with the process ID pid and begin tracing.  The trace may be terminated at any time  by  a  keyboard  interrupt
                   signal  (CTRL-C).  strace will respond by detaching itself from the traced process(es) leaving it (them) to continue running.  Multi-
                   ple -p options can be used to attach to up to 32 processes in addition to command (which is optional if at least  one  -p  option  is
                   given).

-o file     输出到文件


-f          Trace child processes as they are created by currently traced processes as a result of the fork(2) system call.

                   On non-Linux platforms the new process is attached to as soon as its pid is known (through the return value of fork(2) in the  parent
                   process).  This means that such children may run uncontrolled for a while (especially in the case of a vfork(2)), until the parent is
                   scheduled again to complete its (v)fork(2) call.  On Linux the child is traced from its first instruction with no delay.  If the par-
                   ent  process decides to wait(2) for a child that is currently being traced, it is suspended until an appropriate child process either
                   terminates or incurs a signal that would cause it to terminate (as determined from the child’s current signal disposition).

                   On SunOS 4.x the tracing of vforks is accomplished with some dynamic linking trickery.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值