This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix Linux attach to signalled/stopped processes


On Fri, 15 Jun 2007 20:01:59 +0200, Mark Kettenis wrote:
> > Date: Wed, 6 Jun 2007 16:34:32 +0200
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > 
> > The patch changes the functionality of TO_ATTACH.  The former
> > functionality was too UNIX centric.  I was reading all the TO_ATTACH
> > OS-flavor implementations and I believe the non-"inf-ptrace.c" ones
> > do not need update.  The code was tested only on Linux kernel,
> > though.
> 
> I disagree here.  You're adding all sorts of goo to work around
> Linux-specific problems.  Please put this stuff in linux-nat.c

While that "/proc/PID/status" reading part looks definitely Linux specific
I would guess that the first waitpid(2) after PTRACE_ATTACH may not return
SIGSTOP even on other ptrace(2)-using OSes (BSD?).

Attaching a testcase for a possible non-Linux kernel test which:
Should print approx. 1x '.' per second (on each caught pending SIGALRM signal).
At least Linux 2.6.22-rc5.x86_64 prints '!' which looks as a kernel bug to me.

How does currently GDB behave there while attaching to a SIGSTOPped process?
This waitpid(2)-after-ptrace(2) signals redelivery looks as ptrace(2) specific
and not Linux specific to me.  And so it would belong to inf-ptrace.c.



Regards,
Jan

Attachment: ptrace-test.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]