Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <drow@false.org>
Subject: Re: [RFC] 07/10 non-stop inferior control
Date: Mon, 19 May 2008 16:55:00 -0000	[thread overview]
Message-ID: <200805191619.08350.pedro@codesourcery.com> (raw)
In-Reply-To: <20080509014454.GA22833@caradoc.them.org>

A Friday 09 May 2008 02:44:54, Daniel Jacobowitz wrote:
> On Fri, May 09, 2008 at 02:22:51AM +0100, Pedro Alves wrote:
> > Isn't this new_thread_event handling a bandaid for some
> > misbehaving target?  My understanding was that targets should handle
> > new thread events (and call add_thread*) themselves nowadays.
>
> That might be a little strong; but the Linux and remote targets do so,
> because it was much more convenient.
>

Ok.  If you know off-hand of any target that relies on
new_thread_event, I'd like to get to know it.  I think it's very bad
to rely on core GDB to do add threads.  context_switch needed to be
bandaided for cases where threads are not managed by the target.  We
can't distinguish a case of the target escaping a bad ptid_t due
to a bug from a valid event.

The comments around this aren't too optimistic.

static void
context_switch (ptid_t ptid)
{
  /* Caution: it may happen that the new thread (or the old one!)
     is not in the thread list.  In this case we must not attempt
     to "switch context", or we run the risk that our context may
     be lost.  This may happen as a result of the target module
     mishandling thread creation.  */

static void
record_currthread (int currthread)
{
  general_thread = currthread;

  /* If this is a new thread, add it to GDB's thread list.
     If we leave it up to WFI to do this, bad things will happen.  */
  if (!in_thread_list (pid_to_ptid (currthread)))
    add_thread (pid_to_ptid (currthread));

The only benefit of letting the core handle new threads, would
be to add support to stop on new thread events.  But, this form
is of questinable value.  I would argue for implementing that
with events/catchpoints, and/or a new target_waitstatus.

> > Since this is a new mode that will require adaptation
> > by each target, it sounded reasonable to require that the
> > the new_thread_event should never be hit, and that the
> > target handles adding threads to GDB's thread list.
>
> If documented in gdbint, I think this would be a reasonable new
> restriction.

Ok.  I haven't managed to get to the docs yet, but I'll get
to it.

-- 
Pedro Alves


  reply	other threads:[~2008-05-19 15:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-06 17:43 Pedro Alves
2008-05-08 18:19 ` Eli Zaretskii
2008-05-09  2:08   ` Pedro Alves
2008-05-09  2:52     ` Daniel Jacobowitz
2008-05-19 16:55       ` Pedro Alves [this message]
2008-05-19 16:56 ` Pedro Alves
2008-06-04 11:49 ` Vladimir Prus
2008-06-04 12:07   ` Pedro Alves
2008-06-04 12:18     ` Vladimir Prus

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=200805191619.08350.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /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