This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix Linux attach to signalled/stopped processes
On Thu, 10 Apr 2008 17:38:54 +0200, Daniel Jacobowitz wrote:
> On Thu, Apr 10, 2008 at 05:30:17PM +0200, Jan Kratochvil wrote:
> > On Thu, 10 Apr 2008 17:15:45 +0200, Daniel Jacobowitz wrote:
> > > On Tue, Apr 01, 2008 at 03:49:36PM -0700, Roland McGrath wrote:
> > ...
> > > > As a gdb user, I have long been annoyed by the behavior on attaching to a
> > > > stopped process. What I want is for attach to complete immediately and let
> > > > me examine the process. If I then "cont", the process should go back to
> > > > what it was doing--sitting in job control stop. Then fg or otherwise
> > > > sending SIGCONT will wake it up normally, and gdb should stop and tell me
> > > > about the SIGCONT like normal.
> > >
> > > How could GDB put an attached process back into job control stop?
> >
> > ptrace (PTRACE_DETACH, child_pid, NULL, (void *) (long) SIGSTOP);
>
> Yes, but Roland said "continue" should put the process back into job
> control sleep - that's what I was asking about. I know how to do it
> if we're detaching, but not without detaching.
Oh, OK. But the same way works for me even for PTRACE_CONT:
after
ptrace (PTRACE_CONT, child_pid, NULL, (void *) (long) SIGSTOP):
State T (stopped)
Pid 5771
TracerPid 5770
$ kill -CONT 5771
and then:
State T (tracing stop)
Pid 5771
TracerPid 5770
Regards,
Jan