Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: Daniel Jacobowitz <drow@false.org>,  gdb-patches@sourceware.org
Subject: Re: [RFA] Make continuations per-thread.
Date: Fri, 02 May 2008 14:15:00 -0000	[thread overview]
Message-ID: <200805021810.26615.vladimir@codesourcery.com> (raw)
In-Reply-To: <200805021445.52210.pedro@codesourcery.com>

On Friday 02 May 2008 17:45:51 Pedro Alves wrote:
> A Friday 02 May 2008 14:30:32, Vladimir Prus escreveu:
> > On Friday 02 May 2008 17:23:37 Daniel Jacobowitz wrote:
> > > On Fri, May 02, 2008 at 12:34:11PM +0100, Pedro Alves wrote:
> > > > to not make it centralized.  This is one of the things that gets much
> > > > better looking when we switch completelly to always-a-thread, and
> > > > get rid of context-switching.  I'm introducing another variable,
> > > > instead of
> > >
> > > So maybe we should do that in the FSF tree before the attached patch -
> > > is that feasible?
> > >
> > > On Fri, May 02, 2008 at 03:51:10PM +0400, Vladimir Prus wrote:
> > > > This is only for intermediate continations. For ordinary continuations,
> > > > not running them when we hit a breakpoint in another thread is
> > > > desirable. Why should a breakpoint in some other thread abort "finish"?
> > > > Note that in current gdb, hitting a breakpoint in unrelated thread does
> > > > not abort "next" -- say we did next, inserted step resume breakpoint,
> > > > and then hit breakpoint in some other thread. Then, the step resume
> > > > breakpoint will not be removed. If we decide to continue the program,
> > > > we'll eventually hit it.
> > > >
> > > > I don't see any problem with continuations been kept for a given thread
> > > > for a long time. It's not an unbounded amount of continuations -- if we
> > > > get an event in this thread, continuation will run, and if we don't get
> > > > an event, we won't add any futher continuations.
> > >
> > > In non-stop mode, the continuation will run the first time that thread
> > > stops because threads only stop when there is an event.  But in
> > > all-stop mode the thread will be stopped with its continuations not
> > > yet run.
> > >
> > > [Current thread is 1]
> > > finish
> > > [Switching to thread 2]
> > > Breakpoint at....
> > > thread 1
> > > finish
> > >
> > > Now thread 1 has two finish continuations and they're at different
> > > threads... is it going to do something sensible?  What's sensible?
> >
> 
> Yes, this seems like a problem.  The second finish command installs
> the continuations in the last even thread.  In non-stop, this is
> fixed by making the thread command context_switch instead of just
> switch_to_thread.  Maybe that should be done in all-stop too?

This sounds like a reasonable idea.

> We'd context-switch to the last event thread when resuming, so
> the right context is set to step over breakpoints etc.
> 
> Then the question would be:
> 
>  Now thread 1 has two finish continuations in the queue.  Shouldn't
>  the previous one be canceled?
> 
> > I think the sensible behaviour is the same as for "next" -- abort
> > whatever the operation we were doing. This means that we have to wipe
> > continuation inside 'proceed'. I can adjust the patch this way, but
> > does it make sense to you?
> >
> 
> Isn't that too late?  When you get to proceed, the new finish
> continuation is already installed.

This is true. The clean solution, probably, is to add a check in each
command that eventually calls proceed. If the per-thread state of
the current thread records we're doing some operation, we should ask
the user if he wants to actually abort that operation. I think we
can actually find all the commands that proceed the targets, so this is
doable, but is a bit of work, unfortunately.

- Volodya


      reply	other threads:[~2008-05-02 14:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24 23:08 Vladimir Prus
2008-05-02  3:00 ` Daniel Jacobowitz
2008-05-02 11:34   ` Pedro Alves
2008-05-02 11:43     ` Pedro Alves
2008-05-02 11:51     ` Vladimir Prus
2008-05-02 13:24       ` Daniel Jacobowitz
2008-05-02 13:30         ` Vladimir Prus
2008-05-02 13:44           ` Daniel Jacobowitz
2008-05-02 15:33             ` Ulrich Weigand
2008-05-06 19:02               ` Pedro Alves
2008-05-02 13:51           ` Pedro Alves
2008-05-02 14:15             ` Vladimir Prus [this message]

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