From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>, archer@sourceware.org
Subject: Re: Q: mutlithreaded tracees && clone/exit
Date: Wed, 21 Jul 2010 08:32:00 -0000 [thread overview]
Message-ID: <20100721083028.GB5740@redhat.com> (raw)
In-Reply-To: <20100720194119.C0E3C40162@magilla.sf.frob.com>
On 07/20, Roland McGrath wrote:
>
> > Probably this is fine for gdb. But ugdb was started to prototype the
> > new general purpose API. Say, vAttach attaches the whole thread group,
> > there is no way to debug a single thread. Not good in general. The same
> > for D command and for W/X notifications from gdbserver.
>
> It seems fine and normal for whole process to be the granularity of
> attaching. You need to be able to control the individual threads, of
> course. But it doesn't really make a lot of sense to "debug" one thread
> and not another in the same process.
I disagree. But currently this is off-topic.
> > However, when this thread exits, gdbserver sends nothing and gdb
> > continues to wait. For what? Another (main) thead is TASK_TRACED,
> > it can do nothing unless it is SIGKILLED.
>
> Yes, it seems like gdb is confusing itself here.
> Perhaps it is not confused that way when in non-stop mode.
No, I did this testing in non-stop mode. With or without target-async.
Just in case, more info. So, gdb hangs when the sub-thread exits
(to remind, gdbserver sends nothing).
If I press ^C, gdb sends "vCont;t:pTGID.PID" and gdbserver replies
"OK". Now this looks like a bug in gdbserver. This thread no longer
exists, it was already reaped.
So, gdb hangs again after ^C waiting for gdbserver which does nothing.
This is what gdbserver does when the sub-thread exits:
select(5, [3 4], [], [3 4], NULL) = ? ERESTARTNOHAND (To be restarted)
--- SIGCHLD (Child exited) @ 0 (0) ---
(the tracee exits)
read(3, 0x7fffc13431bf, 1) = -1 EAGAIN (Resource temporarily unavailable)
write(5, "+", 1) = 1
rt_sigreturn(0x5) = -1 EINTR (Interrupted system call)
select(5, [3 4], [], [3 4], NULL) = 1 (in [3])
read(3, "+", 1) = 1
read(3, 0x7fffc13434bf, 1) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
wait4(-1, 0x7fffc134356c, WNOHANG, NULL) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|__WCLONE, NULL) = 6538
(this means release_task(), this thread doesn't exist any longer)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
wait4(-1, 0x7fffc134356c, WNOHANG, NULL) = 0
wait4(-1, 0x7fffc134356c, WNOHANG|__WCLONE, NULL) = -1 ECHILD (No child processes)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
select(5, [3 4], [], [3 4], NULL <unfinished ...>
So, it sends nothing to gdb. When I press ^C, gdb sends vCont and:
select(5, [3 4], [], [3 4], NULL) = 1 (in [4])
--- SIGIO (I/O possible) @ 0 (0) ---
read(4, "$vCont;t:p1989.198a#6f", 8192) = 22
write(4, "$OK#9a", 6) = 6
select(5, [3 4], [], [3 4], NULL <unfinished ...>
gdbserver sends the bogus "OK".
The bug is not "fatal", if I press ^C again gdb sends T, gets the
correct "E01", and detects the fact it has exited. Still this looks
like a obvious bug.
Oleg.
next prev parent reply other threads:[~2010-07-21 8:32 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-16 20:54 Oleg Nesterov
2010-07-16 21:40 ` Roland McGrath
2010-07-18 17:51 ` Oleg Nesterov
2010-07-18 18:04 ` Oleg Nesterov
2010-07-18 20:22 ` Roland McGrath
2010-07-19 13:44 ` BUG: add_thread_silent()->switch_to_thread(minus_one_ptid) is wrong Oleg Nesterov
2010-07-19 15:36 ` Oleg Nesterov
2010-07-19 16:01 ` Q: mutlithreaded tracees && clone/exit Jan Kratochvil
2010-07-19 22:57 ` Roland McGrath
2010-07-20 13:18 ` Oleg Nesterov
2010-07-20 14:04 ` BUG? gdb, non-stop && c -a Oleg Nesterov
2010-07-20 14:12 ` Jan Kratochvil
2010-07-20 14:49 ` Oleg Nesterov
2010-07-20 15:08 ` Jan Kratochvil
2010-07-20 15:28 ` Oleg Nesterov
2010-07-20 19:43 ` Roland McGrath
2010-07-21 7:59 ` Oleg Nesterov
2010-07-21 8:10 ` Jan Kratochvil
2010-07-21 11:12 ` Oleg Nesterov
2010-07-20 14:21 ` Q: mutlithreaded tracees && clone/exit Jan Kratochvil
2010-07-20 15:09 ` Oleg Nesterov
2010-07-20 19:41 ` Roland McGrath
2010-07-21 8:32 ` Oleg Nesterov [this message]
2010-07-20 14:43 ` Q: who maintains the STOPPED/RUNNING state? Oleg Nesterov
[not found] ` <y0mk4ophmvn.fsf@fche.csb>
2010-07-21 10:20 ` Oleg Nesterov
2010-07-21 10:51 ` Oleg Nesterov
2010-07-21 17:06 ` Q: multiple inferiors, all-stop && vCont Oleg Nesterov
2010-07-21 20:42 ` Roland McGrath
2010-07-23 17:33 ` Oleg Nesterov
2010-07-26 14:30 ` Oleg Nesterov
2010-07-26 16:06 ` Oleg Nesterov
2010-07-28 18:19 ` gdbstub initial code, another approach Oleg Nesterov
2010-07-29 21:38 ` Frank Ch. Eigler
2010-07-30 13:00 ` Oleg Nesterov
2010-07-30 13:16 ` Frank Ch. Eigler
2010-07-30 15:01 ` Oleg Nesterov
2010-07-30 13:25 ` Jan Kratochvil
2010-07-30 14:44 ` Oleg Nesterov
2010-07-30 15:20 ` Jan Kratochvil
2010-08-02 12:54 ` Oleg Nesterov
2010-08-03 13:55 ` Jan Kratochvil
2010-07-30 17:59 ` Tom Tromey
2010-08-02 18:25 ` Oleg Nesterov
2010-08-02 23:54 ` Jan Kratochvil
2010-08-03 12:27 ` Q: %Stop && gdb crash Oleg Nesterov
2010-08-03 13:17 ` Oleg Nesterov
2010-08-03 19:57 ` Kevin Buettner
2010-08-04 19:42 ` Oleg Nesterov
2010-08-04 23:32 ` Kevin Buettner
2010-08-05 18:24 ` Oleg Nesterov
2010-08-03 13:36 ` Jan Kratochvil
2010-08-03 15:09 ` Oleg Nesterov
2010-08-03 12:39 ` Q: multiple inferiors, all-stop && vCont Jan Kratochvil
2010-08-03 14:32 ` Oleg Nesterov
2010-08-03 15:55 ` Jan Kratochvil
2010-08-03 16:56 ` Oleg Nesterov
2010-08-03 18:37 ` Jan Kratochvil
2010-08-18 17:07 ` Jan Kratochvil
2010-08-18 19:22 ` Roland McGrath
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=20100721083028.GB5740@redhat.com \
--to=oleg@redhat.com \
--cc=archer@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=roland@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).