Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: [PATCH 6/8] make dprintf.exp pass in always-async mode
Date: Mon, 29 Jul 2013 16:45:00 -0000	[thread overview]
Message-ID: <1375116324-32092-7-git-send-email-tromey@redhat.com> (raw)
In-Reply-To: <1375116324-32092-1-git-send-email-tromey@redhat.com>

When target-async is enabled, dprintf.exp fails.

This happens because run_inferior_call causes gdb to forget that it is
running in sync_execution mode, so something like a breakpoint
condition that makes an inferior call causes gdb to enter fully async
mode.

This patch fixes the problem by noticing when gdb was in
sync_execution mode in run_inferior_call, and taking care to restore
this state afterward.

Built and regtested on x86-64 Fedora 18.

	PR cli/15718:
	* infcall.c: Include event-top.h.
	(run_inferior_call): Call async_disable_stdin if needed.
---
 gdb/infcall.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/infcall.c b/gdb/infcall.c
index 19af044..7398913 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -36,6 +36,7 @@
 #include "ada-lang.h"
 #include "gdbthread.h"
 #include "exceptions.h"
+#include "event-top.h"
 
 /* If we can't find a function's name from its address,
    we print this instead.  */
@@ -398,6 +399,8 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 
   TRY_CATCH (e, RETURN_MASK_ALL)
     {
+      int was_sync = sync_execution;
+
       proceed (real_pc, GDB_SIGNAL_0, 0);
 
       /* Inferior function calls are always synchronous, even if the
@@ -407,6 +410,11 @@ run_inferior_call (struct thread_info *call_thread, CORE_ADDR real_pc)
 	{
 	  wait_for_inferior ();
 	  normal_stop ();
+	  /* If gdb was previously in sync execution mode, then ensure
+	     that it remains so.  normal_stop calls
+	     async_enable_stdin, so reset it again here.  */
+	  if (was_sync)
+	    async_disable_stdin ();
 	}
     }
 
-- 
1.8.1.4


  parent reply	other threads:[~2013-07-29 16:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 16:45 [PATCH 0/8] enable target-async by default Tom Tromey
2013-07-29 16:45 ` [PATCH 8/8] enable target-async Tom Tromey
2013-07-29 18:30   ` Eli Zaretskii
2013-07-29 18:42     ` Tom Tromey
2013-07-29 16:45 ` [PATCH 1/8] fix latent bugs in ui-out.c Tom Tromey
2013-07-29 16:45 ` [PATCH 4/8] PR gdb/13860: make "-exec-foo"'s MI output equal to "foo"'s MI output Tom Tromey
2013-07-29 16:45 ` Tom Tromey [this message]
2013-07-29 16:45 ` [PATCH 2/8] add target method delegation Tom Tromey
2013-07-30 14:07   ` Metzger, Markus T
2013-07-30 14:47     ` Tom Tromey
2013-07-30 15:08       ` Metzger, Markus T
2013-07-30 15:13         ` Tom Tromey
2013-07-31 12:16         ` Agovic, Sanimir
2013-07-31 17:50           ` Tom Tromey
2013-07-29 16:45 ` [PATCH 5/8] PR gdb/13860: don't lose '-interpreter-exec console EXECUTION_COMMAND''s output in async mode Tom Tromey
2013-07-29 16:45 ` [PATCH 3/8] PR gdb/13860: make -interpreter-exec console "list" behave more like "list" Tom Tromey
2013-07-29 16:45 ` [PATCH 7/8] fix py-finish-breakpoint.exp with always-async Tom Tromey
2013-07-29 23:33   ` Doug Evans
2013-07-30 18:10     ` Tom Tromey
2013-07-30 20:56       ` Tom Tromey
2013-07-30  0:36   ` Yao Qi
2013-07-30 19:00     ` Tom Tromey

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=1375116324-32092-7-git-send-email-tromey@redhat.com \
    --to=tromey@redhat.com \
    --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