Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [MI non-stop 03/11, RFA] Discard cleanup when deferring displaced step
@ 2008-06-28 16:45 Vladimir Prus
  2008-07-11 12:34 ` Daniel Jacobowitz
  2008-07-11 13:11 ` Pedro Alves
  0 siblings, 2 replies; 7+ messages in thread
From: Vladimir Prus @ 2008-06-28 16:45 UTC (permalink / raw)
  To: gdb-patches


My MI non-stop tests (coming later in the series) revealed a bug in displaced
stepping -- we fail to discard cleanup on an early exit path, which caused a
call to normal_stop at very unfortunate time -- when a thread was running.

OK?

- Volodya

	* infrun.c (resume): Discard cleanups on early exit path.
---
 gdb/infrun.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index cf23c18..e803d1b 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -964,10 +964,13 @@ a command like `return' or `jump' to continue execution."));
       && sig == TARGET_SIGNAL_0)
     {
       if (!displaced_step_prepare (inferior_ptid))
-	/* Got placed in displaced stepping queue.  Will be resumed
-	   later when all the currently queued displaced stepping
-	   requests finish.  */
-	return;
+	{
+	  /* Got placed in displaced stepping queue.  Will be resumed
+	     later when all the currently queued displaced stepping
+	     requests finish.  */
+	  discard_cleanups (old_cleanups);
+	  return;
+	}
     }
 
   if (step && gdbarch_software_single_step_p (gdbarch))
-- 
1.5.3.5



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MI non-stop 03/11, RFA] Discard cleanup when deferring  displaced step
  2008-06-28 16:45 [MI non-stop 03/11, RFA] Discard cleanup when deferring displaced step Vladimir Prus
@ 2008-07-11 12:34 ` Daniel Jacobowitz
  2008-07-11 13:11 ` Pedro Alves
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-07-11 12:34 UTC (permalink / raw)
  To: gdb-patches

On Sat, Jun 28, 2008 at 08:39:52PM +0400, Vladimir Prus wrote:
> 
> My MI non-stop tests (coming later in the series) revealed a bug in displaced
> stepping -- we fail to discard cleanup on an early exit path, which caused a
> call to normal_stop at very unfortunate time -- when a thread was running.
> 
> OK?

Yes, thanks.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MI non-stop 03/11, RFA] Discard cleanup when deferring displaced step
  2008-06-28 16:45 [MI non-stop 03/11, RFA] Discard cleanup when deferring displaced step Vladimir Prus
  2008-07-11 12:34 ` Daniel Jacobowitz
@ 2008-07-11 13:11 ` Pedro Alves
  2008-07-11 13:21   ` Vladimir Prus
  1 sibling, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2008-07-11 13:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Vladimir Prus

A Saturday 28 June 2008 17:39:52, Vladimir Prus wrote:
> My MI non-stop tests (coming later in the series) revealed a bug in
> displaced stepping -- we fail to discard cleanup on an early exit path,
> which caused a call to normal_stop at very unfortunate time -- when a
> thread was running.
>

Ooops, my bad.  Thanks for catching this!

I think it would make sense to tag the thread as running at that point.
In the point of view of the frontend, it is running, but internally,
it is known to not be executing, until its turn in the displaced stepping
request queue arrives.  That is, the frontend should not allow inspecting
this thread as if it was running already, and interrupting it should make
it stop as soon as it tries to execute, not skip over it like ends up
happening currently.

To be clear, the user told the thread to resume, it just didn't resume
immediatelly due to an internal implementation detail.  (is_running (ptid)
&& !is_executing (ptid)) should be true at that early return.  Not a
serious issue to run to fix it (may need care if starting the
displaced step on it ends up failing), but,

Anyone disagrees in principle?

> OK?
>
> - Volodya
>
> 	* infrun.c (resume): Discard cleanups on early exit path.
> ---
>  gdb/infrun.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index cf23c18..e803d1b 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -964,10 +964,13 @@ a command like `return' or `jump' to continue
> execution.")); && sig == TARGET_SIGNAL_0)
>      {
>        if (!displaced_step_prepare (inferior_ptid))
> -	/* Got placed in displaced stepping queue.  Will be resumed
> -	   later when all the currently queued displaced stepping
> -	   requests finish.  */
> -	return;
> +	{
> +	  /* Got placed in displaced stepping queue.  Will be resumed
> +	     later when all the currently queued displaced stepping
> +	     requests finish.  */
> +	  discard_cleanups (old_cleanups);
> +	  return;
> +	}
>      }
>
>    if (step && gdbarch_software_single_step_p (gdbarch))



-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MI non-stop 03/11, RFA] Discard cleanup when deferring displaced step
  2008-07-11 13:11 ` Pedro Alves
@ 2008-07-11 13:21   ` Vladimir Prus
  2008-07-11 13:35     ` Daniel Jacobowitz
  2008-07-11 13:35     ` Pedro Alves
  0 siblings, 2 replies; 7+ messages in thread
From: Vladimir Prus @ 2008-07-11 13:21 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Friday 11 July 2008 17:10:58 Pedro Alves wrote:
> A Saturday 28 June 2008 17:39:52, Vladimir Prus wrote:
> > My MI non-stop tests (coming later in the series) revealed a bug in
> > displaced stepping -- we fail to discard cleanup on an early exit path,
> > which caused a call to normal_stop at very unfortunate time -- when a
> > thread was running.
> >
> 
> Ooops, my bad.  Thanks for catching this!
> 
> I think it would make sense to tag the thread as running at that point.
> In the point of view of the frontend, it is running, but internally,
> it is known to not be executing, until its turn in the displaced stepping
> request queue arrives.  That is, the frontend should not allow inspecting
> this thread as if it was running already, and interrupting it should make
> it stop as soon as it tries to execute, not skip over it like ends up
> happening currently.
> 
> To be clear, the user told the thread to resume, it just didn't resume
> immediatelly due to an internal implementation detail.  (is_running (ptid)
> && !is_executing (ptid)) should be true at that early return.  Not a
> serious issue to run to fix it (may need care if starting the
> displaced step on it ends up failing), but,
> 
> Anyone disagrees in principle?

Seems right to me. Should that be a separate patch, or should I adjust
this one?

- Volodya


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MI non-stop 03/11, RFA] Discard cleanup when deferring  displaced step
  2008-07-11 13:21   ` Vladimir Prus
@ 2008-07-11 13:35     ` Daniel Jacobowitz
  2008-07-13  5:55       ` Vladimir Prus
  2008-07-11 13:35     ` Pedro Alves
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2008-07-11 13:35 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: Pedro Alves, gdb-patches

On Fri, Jul 11, 2008 at 05:21:24PM +0400, Vladimir Prus wrote:
> Seems right to me. Should that be a separate patch, or should I adjust
> this one?

Separate, please.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MI non-stop 03/11, RFA] Discard cleanup when deferring displaced step
  2008-07-11 13:21   ` Vladimir Prus
  2008-07-11 13:35     ` Daniel Jacobowitz
@ 2008-07-11 13:35     ` Pedro Alves
  1 sibling, 0 replies; 7+ messages in thread
From: Pedro Alves @ 2008-07-11 13:35 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

A Friday 11 July 2008 14:21:24, Vladimir Prus wrote:

> Seems right to me. Should that be a separate patch, or should I adjust
> this one?

Oh great, I wasn't asking you to do it, but if you want :-).  I'd
prefer separate.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MI non-stop 03/11, RFA] Discard cleanup when deferring  displaced step
  2008-07-11 13:35     ` Daniel Jacobowitz
@ 2008-07-13  5:55       ` Vladimir Prus
  0 siblings, 0 replies; 7+ messages in thread
From: Vladimir Prus @ 2008-07-13  5:55 UTC (permalink / raw)
  To: gdb-patches

Daniel Jacobowitz wrote:

> On Fri, Jul 11, 2008 at 05:21:24PM +0400, Vladimir Prus wrote:
>> Seems right to me. Should that be a separate patch, or should I adjust
>> this one?
> 
> Separate, please.

I've checked in the patch without changes. I'll post this separate tweak
later today.

- Volodya



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-13  5:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-28 16:45 [MI non-stop 03/11, RFA] Discard cleanup when deferring displaced step Vladimir Prus
2008-07-11 12:34 ` Daniel Jacobowitz
2008-07-11 13:11 ` Pedro Alves
2008-07-11 13:21   ` Vladimir Prus
2008-07-11 13:35     ` Daniel Jacobowitz
2008-07-13  5:55       ` Vladimir Prus
2008-07-11 13:35     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox