Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Unbreak 'target async'.
Date: Sat, 23 Feb 2008 18:47:00 -0000	[thread overview]
Message-ID: <200802232130.56913.vladimir@codesourcery.com> (raw)


Presently, if I connect to gdbserver using 'target async'
and then to 'continue', then continue never finishes.
What happens is that serial_async first calls scb->ops->async,
and only then sets scb->async_handler.
However, ser_base_async calls reschedule which calls serial_is_async,
which checks scb->async_handler. Since it's not set yet,
async mode is never enabled.

The below patch allows me to do 'continue' successfully.
I did not run the testsuite, since it's apparent that
this patch cannot break "target async" more that it's broken now.
OK?

- Volodya

	Unbreak 'target async'.
	* serial.c (serial_async): Set the
	handler function before enabling async
	mode.
---
 gdb/serial.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/serial.c b/gdb/serial.c
index 7bdf170..1fb7f31 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -515,12 +515,12 @@ serial_async (struct serial *scb,
 	      serial_event_ftype *handler,
 	      void *context)
 {
-  /* Only change mode if there is a need. */
-  if ((scb->async_handler == NULL)
-      != (handler == NULL))
-    scb->ops->async (scb, handler != NULL);
+  int changed = ((scb->async_handler == NULL) != (handler == NULL));
   scb->async_handler = handler;
   scb->async_context = context;
+  /* Only change mode if there is a need.  */
+  if (changed)
+    scb->ops->async (scb, handler != NULL);
 }
 
 int
-- 
1.5.3.5


             reply	other threads:[~2008-02-23 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-23 18:47 Vladimir Prus [this message]
2008-02-24 14:51 ` Daniel Jacobowitz

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=200802232130.56913.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=gdb-patches@sources.redhat.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