Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Unbreak 'target async'.
@ 2008-02-23 18:47 Vladimir Prus
  2008-02-24 14:51 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Prus @ 2008-02-23 18:47 UTC (permalink / raw)
  To: gdb-patches


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


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

end of thread, other threads:[~2008-02-23 18:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-23 18:47 [RFA] Unbreak 'target async' Vladimir Prus
2008-02-24 14:51 ` Daniel Jacobowitz

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