Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: msnyder@vmware.com (Michael Snyder)
Cc: pedro@codesourcery.com (Pedro Alves),
	        gdb-patches@sourceware.org (gdb-patches@sourceware.org)
Subject: Re: [rfc] Preferred thread event reporting: Linux native target
Date: Mon, 18 Aug 2008 16:01:00 -0000	[thread overview]
Message-ID: <200808181600.m7IG0gNP011499@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <48A5C90E.7080801@vmware.com> from "Michael Snyder" at Aug 15, 2008 11:21:02 AM

Michael Snyder wrote:
> Ulrich Weigand wrote:
> > Pedro Alves wrote:
> > 
> >>> -- this is actually simply the currently selected thread
> >>> (i.e. the current value of inferior_ptid).
> >> Disagreed.  inferior_ptid will change if an event happens in
> >> another thread while you're stepping, but the core decides the event
> >> was not a good reason to stop.  E.g., thread hopping.
> > 
> > Hmm, but if we "thread hop" inferior_ptid should be prefered
> > anyway (to get the internal "thread hop" action over with as
> > quickly as possible), and afterwards we're back to the thread
> > the user is looking at, right?
> 
> After that, I think, we're back to whichever thread
> the OS decides to schedule next.  I don't think there
> is any guarantee that that will be the one the user
> was previously looking at.

I think the OS scheduler is not really relevant here.
GDB assumes it can decide which of the threads of an
application it wants to *single-step*.

So if an application has threads A, B, and C, and is 
stopped on an event in B, and then decides it wants to
continue single-stepping C, it will tell the target to
continue all thread, while single-stepping C.

Now the OS scheduler may choose to run A, B, or C next
(or several of them in parallel on an SMP system), but
no matter what: we should never get single-step events
from A or B, but we should get a single-step event after
C has executed its first instruction (whenever that may
be).

The above assumption (that GDB can decide which threads
to single-step) is always true when using software single-
stepping.  It is also true for the Linux native target,
and for the remote target (assuming the remote side
implements the protocol accordingly).

There may be odd targets where this assumption is false;
GDB will probably get confused on those.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2008-08-18 16:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14 20:40 Ulrich Weigand
2008-08-14 21:20 ` Pedro Alves
2008-08-14 21:51   ` Ulrich Weigand
2008-08-15 18:22     ` Michael Snyder
2008-08-18 16:01       ` Ulrich Weigand [this message]
2008-08-15 23:28     ` Pedro Alves
2008-08-18 16:23       ` Daniel Jacobowitz
2008-08-18 17:01         ` Ulrich Weigand
2008-08-18 17:04           ` Daniel Jacobowitz
2008-08-18 17:18           ` Pedro Alves
2008-08-18 17:15       ` Pedro Alves
2008-08-18 18:19         ` Ulrich Weigand

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=200808181600.m7IG0gNP011499@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    --cc=pedro@codesourcery.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