This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Unbreak 'target async'.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]