Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: jan.kratochvil@redhat.com
Cc: drow@false.org, gdb-patches@sourceware.org
Subject: Re: [patch] Fix attaching to Linux stopped processes
Date: Sat, 23 Sep 2006 17:37:00 -0000	[thread overview]
Message-ID: <200609231736.k8NHabVs010214@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <20060918095331.GA9299@host0.dyn.jankratochvil.net> (message from 	Jan Kratochvil on Mon, 18 Sep 2006 11:53:31 +0200)

> Date: Mon, 18 Sep 2006 11:53:31 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> 
> > So I checked.  Sure enough, on my 2.6.18-rc4
> > installation, this is _not_ what happens.  Instead, the traditional
> > thing happens: wait hangs and no new event is returned.
> > 
> > Is this new in kernel.org?  Or is it a Red Hat kernel patch?  Where
> > did it come from?
> 
> Thanks for checking it.
> OK, the patch was originally for GDB on Red Hat "kernel-2.6.17-1.2647.fc6".
> 
> Still it is reproducible even on both linux-2.6.17.13 and linux-2.6.18-rc4, you
> just need to "kill -CONT $pid" the inferior as gdb(1) will hang during
> attaching to it.  Screenshot (sorry for graphics):
> 	http://www.jankratochvil.net/priv/gdb.png
> gdb is built from the current clean CVS snapshot.
> 
> Also the patch looks right to me - after `PT_ATTACH' it is appropriate that
> `WSTOPSIG (status)' will report the original signal that stopped process,
> (WSTOPSIG (status) == SIGSTOP) <=> (process was in running/sleeping mode).

Whoa stop, the status returned by wait(2) doesn't tell you whether a
process is sleeping or running.  Traditionally, after invoking
ptrace(PT_ATTACH, ...) the kernel will always respond with a SIGSTOP.
Any information about any previous signals is lost.

This all smells like a race condition in the kernel to me.  The
linux-nat.c code is quite hairy already.  I'd suggest fixing the
kernel rather than adding more workarounds.

Mark


  parent reply	other threads:[~2006-09-23 17:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-17 22:12 Jan Kratochvil
2006-09-17 22:26 ` Daniel Jacobowitz
2006-09-18  9:53   ` Jan Kratochvil
2006-09-18 13:16     ` Daniel Jacobowitz
2006-09-18 20:49       ` Jan Kratochvil
2006-09-18 20:54         ` Daniel Jacobowitz
2006-09-23 17:37     ` Mark Kettenis [this message]
2006-09-25 10:52       ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200609231736.k8NHabVs010214@elgar.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox