我正在编写一个涉及使用ptrace控制tracee进程的程序。 当然,有错误:)为了修复我的错误,我希望能够用gdb检查tracee的状态。 但是, gdb -p说:
warning: process X is already traced by process Y如果我只使用PTRACE_DETACH ,那么tracee将继续执行,直到我启动gdb ,这可能会破坏我正在尝试检查的状态。
关于如何检查ptrace tracee的运行时状态(可能使用除gdb以外的工具)的任何建议都非常感谢。
I'm writing a program that involves controlling a tracee process with ptrace. Of course, there are bugs :) To fix my bugs, I'd like to be able to inspect the tracee's state with gdb. However, gdb -p says:
warning: process X is already traced by process YIf I just use PTRACE_DETACH, then the tracee will resume executing until I launch gdb, which can destroy the state I'm trying to examine.
Any suggestion for how to examine the runtime state of a ptrace tracee (perhaps with tools other than gdb) is greatly appreciated.
最满意答案
有关如何检查ptrace tracee的运行时状态的任何建议
一种方法是让跟踪器实现GDB 远程调试协议 。 其他文档在这里 。
此答案还显示了如何在不恢复进程的情况下分离进程。
Any suggestion for how to examine the runtime state of a ptrace tracee
One way is have the tracer implement GDB remote debugging protocol. Additional documentation here.
Also this answer shows how to detach a process without resuming it.
更多推荐
发布评论