2017-09-21

猎数博客

数据挖掘,机器学习

有用的工具strace

作者:江航 / 2011-12-29 / (阅读 1,346 次) /



strace可以显示用户空间程序发出的全部系统调用。

strace echo ‘”hello”

将显示这个命令所有的系统调用。如果只关注其中的某种调用,可以用-e参数,如只关心open函数,

strace -e trace=open echo “hello”

或者trace open和close:

strace -e trace=open,close echo “hello”

输出如下:

open(“./tls/x86_64/libc.so.6”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“./tls/libc.so.6”, O_RDONLY)       = -1 ENOENT (No such file or directory)
open(“./x86_64/libc.so.6”, O_RDONLY)    = -1 ENOENT (No such file or directory)
open(“./libc.so.6”, O_RDONLY)           = -1 ENOENT (No such file or directory)
open(“/usr/lib/tls/x86_64/libc.so.6”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/lib/tls/libc.so.6”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/lib/x86_64/libc.so.6”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/lib/libc.so.6”, O_RDONLY)    = -1 ENOENT (No such file or directory)
open(“/etc/ld.so.cache”, O_RDONLY)      = 3
close(3)                                = 0
open(“/lib64/tls/libc.so.6”, O_RDONLY)  = 3
close(3)                                = 0
hello
Process 26347 detached



本文地址: http://www.bagualu.net/wordpress/archives/1178 转载请注明






相关文章

  • GDB 找不到源代码( 9,621 )
  • vim 获取当前文件名( 8,198 )
  • dump fsdb看波形step by step( 6,315 )
  • windows下设置别名(alias)( 5,759 )
  • 程序性能分析之Valgrind( 4,568 )
  • GDB 查看内存/指针( 4,221 )
  • 用pandoc把markdown转化为pdf文档( 4,008 )
  • 怎样获得动态链接库的装载地址( 3,963 )
  • gdb debug 信息 stabs 格式( 3,486 )
  • vim 多文件搜索并实现自动跳转( 3,471 )
  • Leave a Reply

    您必须登录以发表评论,

    沪ICP备11036560号
    联系我: jianghang at bagualu.net