• linux 工具系列之 - strace


     what is strace ?

      Linux 解释 

      

      从字面意思上就可道 strace 跟踪程序执行时候的系统调用和信号.

      

     how use?

      man 一下strace 发现它的参数一大坨,是不是很郁闷,不用担心,其实我们只要记住几个常用的参数就可以搞定绝对大多数问题啦

      注意 test指可执行文件

      strace  -i       查看可执行文件的系统调用

       -i           查看可执行文件在那个地址进行了系统调用,可配合gdb 

       -p " pid of test"  附加到运行的进程 Ctrl  +c 结束

       -o trace.log      输出重定向到日志里面

       -f          fork 之后,跟踪fork 之后的进程

       -t          输出每一行加上调用时间,秒为单位

        -tt           输出每一行加上调用时间,毫秒为单位

      -T            显示每一系统调用时间

      

     other:

      -e expr 指定跟踪格式,格式如下

       [qualifier=][!]value1[,value2]...

      手册如下面说明

      where qualifier is one of trace, abbrev, verbose, raw, signal, read, or write and

      value is a qualifier-dependent symbol or number. The default qualifier is trace.
      Using an exclamation mark negates the set of values. For example, -e open means
      literally -e trace=open which in turn means trace only the open system call. By
      contrast, -e trace=!open means to trace every system call except open. In addi‐
      tion, the special values all and none have the obvious meanings.

      Note that some shells use the exclamation point for history expansion even inside
      quoted arguments. If so, you must escape the exclamation point with a backslash.

      这句话很好懂,这里就不解释啦

      strace 就到这里啦,其他的参数man一下就知道了...................

     

        

      

      

      

  • 相关阅读:
    Fortran学习记录1(Fortran数据类型)
    ABAQUS学习记录1——用户子程序综述
    Abaqus用户子程序umat的学习
    信号基础知识---线阵
    信号基础知识--FFT DFT
    信号基础知识
    服务器文件打压缩包下载(java)
    网页鼠标特效-点击漂浮文字
    jQuery父子页面之间元素、方法获取、调用
    常用数字与字母的正则表达式
  • 原文地址:https://www.cnblogs.com/songbingyu/p/3700116.html
Copyright © 2020-2023  润新知