如何调试ptrace tracee?(How can I debug a ptrace tracee?)

编程入门 行业动态 更新时间:2024-10-11 09:23:35
如何调试ptrace tracee?(How can I debug a ptrace tracee?)

我正在编写一个涉及使用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 Y

If 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.

更多推荐

本文发布于:2023-07-27 03:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1284835.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ptrace   tracee   debug

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!