Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org,  drow@false.org
Subject: Re: [rfc] Fix PR 2250 - multithreaded single-step problems in all-stop mode
Date: Sat, 15 Nov 2008 21:30:00 -0000	[thread overview]
Message-ID: <200811151610.40427.pedro@codesourcery.com> (raw)
In-Reply-To: <200811142104.mAEL4JBX024219@d12av02.megacenter.de.ibm.com>

On Friday 14 November 2008 21:04:18, Ulrich Weigand wrote:

> a while ago I posted a patch to fix problem PR 2250:
> http://sourceware.org/ml/gdb-patches/2008-05/msg00089.html
> 
> This problem is about the behaviour of GDB when single-stepping
> a thread of a multi-threaded application.  If during a single-step
> operation, some other event happens in another thread, GDB may get
> into an inconsistent state, where some internal data structures
> still think a single-step operation is going on, while this is
> in fact no longer true.
> 
> The patch I originally proposed, however, conflicted with the
> new non-stop mode (where single-step operations can be outstanding
> in multiple threads at the same time), so it was never applied.
> Now that all the non-stop code is in mainline, the original bug
> is still present in the all-stop mode.  I've reworked the patch
> to fix the problem in all-stop mode, while keeping the new behaviour
> in non-stop mode unchanges.

Thank you very much for your patience and for refitting the patch.

I do find this version much cleaner than the last (for not
relying on global variables, and due to context-switching
being a thing of the past).

> 
> As discussed in the message refered to above, I'm implementing the
> the following two changes:
> 
> - If the step operation is interrupted by an *internal* breakpoint
>   that is handled transparently, the operation continues in a 
>   transparent and consistent manner after the breakpoint was handled.
>   (This is the handle_inferior_event change in the patch below.)
> 

I still agree with this behaviour.  I've made it so that GDB removes
step-resume breakpoints of all threads (in all-stop) on a normal_stop
for the same reasoning (delete_step_thread_step_resume_breakpoint).

> - If the step operation is interrupted by an *explicit* breakpoint
>   that breaks to a user prompt, it is completely cancelled.  It is
>   then up to the user how to continue from the prompt.
>   (This is the clear_proceed_status change in the patch below.)

Yay!  I had something similar here to address this bullet (updated
from the last time I showed it, but unfinished and a bit hacky) that
I ended up never submitting.  Yours is better.

> Regression tested on powerpc64-linux.  This patch fixes the problem
> originally reported as PR 2250 (thanks to Emi Suzuki for verifying!).
> 
> I didn't test anything with all-stop mode, but by construction the
> patch should not modify the behaviour at all in this case.

Yeah, should be fine (obviously talking about non-stop mode here).

> Does this look right?   If there are no objections, I'm planning
> on committing this in a couple of days.

I like this a lot.


Hmm, speaking of things that aren't cleared properly in all
threads when we are going to start a proceed, shouldn't the
things cleared in init_thread_stepping_state be cleared
in clear_proceed_status_thread instead?  E.g.,
step_after_step_resume_breakpoint, etc.

-- 
Pedro Alves


  reply	other threads:[~2008-11-15 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15 16:42 Ulrich Weigand
2008-11-15 21:30 ` Pedro Alves [this message]
2008-11-17 22:19   ` Ulrich Weigand
2008-11-17 23:36     ` Pedro Alves
2008-11-18  1:43       ` Ulrich Weigand
2008-11-18  3:36         ` Pedro Alves
2008-12-07  0:16           ` [rfc] [0/7] infrun cleanup Ulrich Weigand
2008-12-07  1:29             ` Pedro Alves
2008-12-07 17:12               ` Pedro Alves
2008-12-07 18:20                 ` Ulrich Weigand
2008-12-07 19:16                   ` Pedro Alves

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=200811151610.40427.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.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