linux - 如何找到程序的系统调用位置?

标签 linux debugging strace

来自 strace 手册:

-i Print the instruction pointer at the time of the system call. 

我跟踪了我的程序:

strace -i prog

结果我接到了很多系统调用。其中之一:

[000da49c] open("./rabbit.o", O_RDONLY) = 3

但是在这个 prog 地址的反汇编指令不会调用任何系统调用(hte 编辑器):

da49c !   mov         r7, ip                          

怎么了?如何找到程序的系统调用位置?

附言我的设备架构不支持 GDB 命令捕获系统调用。

最佳答案

引用“strace”手册页的错误部分:

The -i option is weakly supported.

另一个可能对您有帮助的提示:您是否看过以前的代码? 输出时的 IP 已经指向系统调用之后的 NEXT 指令。 所以你应该检查da49c之前的指令。

关于linux - 如何找到程序的系统调用位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10027013/

相关文章:

c++ - 随机字符串生成器段错误

linux - "-bash://MacOS/Electron: No such file or directory"使用 VS Code 时使用 ". code "快捷方式

c++ - 向项目添加类后对 'main' 的 undefined reference

c - 尝试将 GDB 附加到进程时如何解决 "ptrace operation not permitted"?

android - 你如何调试android平台源代码?

linux-kernel - 为什么使用 strace 只捕获一次系统调用(getpid)?

bash - 找出 bash/dash/sh 在启动过程中读取的所有文件

linux - 狂欢 : Checking binary vs checking directory

javascript - 在 node.js 中获取 *current* 堆栈跟踪(例如,通过 SIGINT)

php - "strace"输出中的(超时)是什么意思? (mysql/php 分析)