public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: archer@sourceware.org
Subject: Re: Q: mutlithreaded tracees && clone/exit
Date: Sun, 18 Jul 2010 20:22:00 -0000	[thread overview]
Message-ID: <20100718202151.941B94B2C9@magilla.sf.frob.com> (raw)
In-Reply-To: Oleg Nesterov's message of  Sunday, 18 July 2010 19:48:51 +0200 <20100718174851.GA15528@redhat.com>

> Yes, but this doesn't necessarily mean gdbserver can forget its exit
> code (or some internal state), I do not see anything about this in docs.

It means that any protocol requirement about this would almost certainly be
broken, if there were one.  It couldn't be implemented robustly.

> > It's not really clear to me when gdb decides to ask for the thread
> > list.
> 
> Never in my (limited) testing.

It clearly does have paths to do it in the code.
So we need gdb folks to clarify how those are reached.

> > > Q2: Shouldn't gdbstub let debugger know about sub-threads somehow?
> >
> > That's what I would expect in the abstract.  But I know that gdb
> > didn't used to get new-thread notifications from ptrace either.  It
> > looks like the linux-nat code does track PTRACE_EVENT_CLONE now.
> > But it may be that the gdbserver code and remote protocol were made
> > to match how things were when the native ptrace case didn't do that.
> 
> gdbserver tracks PTRACE_EVENT_CLONE, yes. But it doesn't inform gdb.

I was talking about the non-remote gdb code, not gdbserver.
gdbserver does attach new threads implicitly, but indeed that is
only noticed by gdb if a new thread happens to hit a signal
(breakpoint or whatever).

> I have already looked at this code in horror. I really hope this magic
> is not needed for our purposes.
> 
> It is gdbserver, not gdb, who uses libthread_db to find sub-threads and
> do other things.

Again, I was talking about what gdb does in the non-remote case.
AFAIK, it does the same stuff on top of the remote layer too, but
I'm not sure about that.

> OK, so far it is not clear to me what should we do. If nothing else,
> I can replicate the gdbserver's behaviour. But imho it makes sense to
> do something more clever.

We need some more feedback from the gdb folks.

> However, there is the complication I already mentioned. If the main
> thread exits, this confuses gdbserver at least. It sends the "$T05"
> packets to gdb, then eventually gdb does vCont;c:pTGID.-1 and gdbserver
> doesn't work. It doesn't resume sub-threads, doesn't react to ^C, etc.
> 
> I guess, gdbserver shouldn't send '$W' packet in this case, this can
> confuse gdb (but I didn't verify this yet). OTOH, it is not clear if
> gdbserver can delay this notification until all threads exit. Say,
> what should gdbserver do if gdb sends a private signal to the exited
> main thread? Or do something else which assumes it alive.

Yes, it's not clear what is intended or would be right here.
The X/W packets are documented as talking about "the process".
Perhaps some new flavors of notification packets are needed to
distinguish thread-granularity events from process-granularity.


Thanks,
Roland

  parent reply	other threads:[~2010-07-18 20:22 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 [this message]
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
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=20100718202151.941B94B2C9@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=archer@sourceware.org \
    --cc=oleg@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).