From: Andrew Cagney <ac131313@redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: Michael Elizabeth Chastain <mec@shout.net>,
aurelien.chanudet@enst.fr, gdb@sources.redhat.com
Subject: Re: process attaching gdb to itself
Date: Mon, 29 Sep 2003 13:23:00 -0000 [thread overview]
Message-ID: <3F7831F3.6010203@redhat.com> (raw)
In-Reply-To: <20030928232401.GA20802@nevyn.them.org>
>> works on BSD but fails on GNU/Linux. When doing an attach, BSD always
>> generates something for wait4 to consume. GNU/Linux does not, leaving
>> GDB stuck in wait4 :-(
>
>
> Yes, I've known about this problem for a long time. We've [I, Roland,
This explains something.
> a couple of other people I can't recall] talked about changing it and
> decided that, really, the current behavior makes more sense.
Not to me.
GDB sends a message to the kernel asking for the process to stop. The
kernel sends a message back indicating that the request has completed.
> It's not at all hard to make GDB work in the current system anyway.
> Just have to do it. It goes something like:
> - attach
> - wait4 WNOHANG, break if succeeds (optimistic, not necessary)
> - check in /proc to make sure the process is in a stopped state
> - If it was:
> - wait4 WNOHANG
> - If we get a status, then the process was running when we attached
> - If no status is available then the process was stopped when
> we attached
> - If it wasn't:
> - The process was running when we attached and hasn't stopped yet
> - wait4 without WNOHANG
I feel ill. What happens, for instance, if /proc isn't there?
Andrew
next prev parent reply other threads:[~2003-09-29 13:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-28 22:35 Michael Elizabeth Chastain
2003-09-28 22:45 ` Andrew Cagney
2003-09-29 2:21 ` Daniel Jacobowitz
2003-09-29 13:23 ` Andrew Cagney [this message]
2003-09-29 13:30 ` Daniel Jacobowitz
2003-09-29 14:54 ` Andrew Cagney
2003-09-29 14:59 ` Daniel Jacobowitz
-- strict thread matches above, loose matches on Subject: below --
2003-09-28 20:45 Aurelien Chanudet
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=3F7831F3.6010203@redhat.com \
--to=ac131313@redhat.com \
--cc=aurelien.chanudet@enst.fr \
--cc=drow@mvista.com \
--cc=gdb@sources.redhat.com \
--cc=mec@shout.net \
/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