linux申请strace ,lstrace, ptrace, dtrace
ltrace命令是用来跟踪进程调用库函数的情况。
ltrace -h
Usage: ltrace [option ...] [command [arg ...]]
Trace library calls of a given program.
-a, --align=COLUMN align return values in a secific column.
-A MAXELTS maximum number of array elements to print.
-b, --no-signals don't print signals.
-c count time and calls, and report a summary on exit.
-C, --demangle decode low-level symbol names into user-level names.
-D, --debug=MASK enable debugging (see -Dh or --debug=help).
-Dh, --debug=help show help on debugging.
-e FILTER modify which library calls to trace.
-f trace children (fork() and clone()).
-F, --config=FILE load alternate configuration file (may be repeated).
-h, --help display this help and exit.
-i print instruction pointer at time of library call.
-l, --library=LIBRARY_PATTERN only trace symbols implemented by this library.
-L do NOT display library calls.
-n, --indent=NR indent output by NR spaces for each call level nesting.
-o, --output=FILENAME write the trace output to file with given name.
-p PID attach to the process with the process ID pid.
-r print relative timestamps.
-s STRSIZE specify the maximum string size to print.
-S trace system calls as well as library calls.
-t, -tt, -ttt print absolute timestamps.
-T show the time spent inside each call.
-u USERNAME run command with the userid, groupid of username.
-V, --version output version information and exit.
-x FILTER modify which static functions to trace.
https://blog.csdn.net/macky0668/article/details/6839520
运行strace,出现问题:
ptrace: Operation not permitted.
早上发现一个进程没有相应, 试图gdb之.
(gdb) attach 30721
Attaching to program: /data0/s/bin/s, process 30721
ptrace: Operation not permitted.
晕倒, 俺已经是sudo权限了. 后来看到一篇博客说:当他已经在 gdb 某个进程时, 试图再利用 gcore 来手动产生一个 core 文件而不得(可以在gdb下用 generate-core-file 完成), 我有所启发, 莫非还有别人在gdb 这个进程.
ps 一下, 发现我的猜想是对的, 我进一步猜想, strace 也应该会失败.
0> strace -p 30721
attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
果然如此, 两者都用到了 ptrace 这个系统调用. man ptrace 可以查看详情:
The ptrace system call provides a means by which a parent process may observe and control the execution of another pro-cess, and examine and change its core image and registers. It is primarily used to implement breakpoint debugging and system call tracing.
看linux内核详解的话, 应该能给出更深层次的解释, 我现在还留在意会阶段.
linux申请strace ,lstrace, ptrace, dtrace的更多相关文章
- Linux利器 strace [看出process呼叫哪個system call]
Linux利器 strace strace常用来跟踪进程执行时的系统调用和所接收的信号. 在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必 ...
- linux神器strace
man strace: strace - trace system calls and signals DESCRIPTION In the simplest case strace runs the ...
- Finding the source of signals on Linux with strace, auditd, or systemtap
inux and UNIX® like operating systems commonly use signals to communicate between processes. The use ...
- 使用strace,lstrace,truss来跟踪程序的运行过程
使用truss.strace或ltrace诊断软件问题 2008-07-05 16:25 使用truss.strace或ltrace诊断软件问题 进程无法启动,软件运行速度突然变慢, ...
- Linux调试工具strace和gdb常用命令小结
strace和gdb是Linux环境下的两个常用调试工具,这里是个人在使用过程中对这两个工具常用参数的总结,留作日后查看使用. strace调试工具 strace工具用于跟踪进程执行时的系统调用和所接 ...
- linux下strace命令详解
简介 strace常用来跟踪进程执行时的系统调用和所接收的信号. 在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必须由用户态模式切换至内核 ...
- oracle linux 7.3 下用dtrace 跟踪 mysql-community-server-5.6.20
第一部分:oracle linux 7.3 dtrace 安装: http://public-yum.oracle.com/ 内核升极到 [root@server1 SPECS]# uname - ...
- 使用 Linux 的 strace 命令跟踪/调试程序的常用选项
原文:http://linoxide.com/linux-command/linux-strace-command-examples/作者: Raghu 在调试的时候,strace能帮助你追踪到一个程 ...
- linux下 玩转ptrace
译者序:在开发Hust Online Judge的过程中,查阅了不少资料,关于调试器技术的资料在网上是很少,即便是UNIX编程巨著<UNIX环境高级编程>中,相关内容也不多,直到我在 ht ...
随机推荐
- hdu4847 Wow!Such Doge!【字符串】【暴力】
Wow! Such Doge! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- Steeltoe之Circuit Breaker篇
在分布式系统中,服务发生异常是很正常的现象.为了处理这类"例外",可以采取不同的应对策略,断路器模式即是其中一种方法.这个模式的主要特点是其可以阻断失败的级联影响,不会因为一个服务 ...
- [No0000A5]批处理常用命令大全&&21个DOS常用命令
1.Echo 命令打开回显或关闭请求回显功能,或显示消息.如果没有任何参数,echo 命令将显示当前回显设置.语法echo [{on|off}] [message]Sample: echo off e ...
- iOS中的静态库与动态库,区别、制作和使用
如果我们有些功能要给别人用,但是又不想公开代码实现,比如高德地图.第三方登录分享等等,这时候我们就要打包成库了.库分静态库和动态库两种: 静态库:以.a 和 .framework为文件后缀名.动态库: ...
- mysql设置指定ip访问,用户权限相关操作
基础语法GRANT priv_type ON database.table TO user[IDENTIFIED BY [PASSWORD] 'password'] [,user [IDENTIFIE ...
- Delphi中DLL初始化和退出处理
来自delphibbs: zhousy_2000, 时间: 2005-09-13 13:53:00, ID: 3203484 <1>利用Unit的Initalization与Finaliz ...
- 洛谷P3121 审查(黄金)Censoring(Gold) [USACO15FEB] AC自动机
正解:AC自动机 解题报告: 传送门! 啊我好呆啊其实就挺模板题的,,,只是要一个栈搞一下,,,然后我就不会了,,,是看了题解才get的,,,QAQ 然后写下解法趴QwQ 首先看到多串匹配不难想到AC ...
- $(this) 和 this 关键字在 jquery 中有何不同?
$(this) 返回一个 jQuery 对象,你可以对它调用多个 jQuery 方法,比如用 text() 获取文本,用 val() 获取值等等. 而 this 代表当前元素,它是 javascrip ...
- 异步fifo的Verilog实现
一.分析 由于是异步FIFO的设计,读写时钟不一样,在产生读空信号和写满信号时,会涉及到跨时钟域的问题,如何解决? 跨时钟域的问题:由于读指针是属于读时钟域的,写指针是属于写时钟域的,而异步FIFO ...
- wamp3.1.0下载地址
WAMP是Windows用来搭建网站或服务器的开源软件,包含Apache + Mysql/MariaDB + Perl/PHP/Python等开发组件,方便快速便捷配置环境,很多朋友说wamp官网下载 ...