Reputation: 286
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.
Upvotes: 0
Views: 892
Reputation: 213526
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.
Upvotes: 1