0

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.

DepressedDaniel
  • 266
  • 1
  • 11

1 Answers1

1

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.

Community
  • 1
  • 1
Employed Russian
  • 199,314
  • 34
  • 295
  • 362