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]

[PATCH 1/5] Process notifications when reply is got


GDB needs some points to consume notification events in all-stop mode.
The end of remote_get_noisy_reply is good place, because GDB has got
a reply from stub, and isn't expecting any others.  At this moment,
GDB is safe to ack notification events one by one.  Likewise, it is a
good time ack notification event after GDB receives a stop reply.

With this change, GDB is able to get Trace notification when command
tstart or tstop is executed.

gdb:

2014-01-24  Yao Qi  <yao@codesourcery.com>

	* remote.c (get_remote_state): Declare.
	(remote_get_noisy_reply): Call remote_notif_process if
	non_stop is false.
	(remote_wait_as): Likewise.
---
 gdb/remote.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 1c914ba..7110e0a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -233,6 +233,8 @@ static int remote_supports_cond_breakpoints (void);
 
 static int remote_can_run_breakpoint_commands (void);
 
+static struct remote_state *get_remote_state (void);
+
 /* For "remote".  */
 
 static struct cmd_list_element *remote_cmdlist;
@@ -600,7 +602,17 @@ remote_get_noisy_reply (char **buf_p,
       else if (buf[0] == 'O' && buf[1] != 'K')
 	remote_console_output (buf + 1);	/* 'O' message from stub */
       else
-	return buf;		/* Here's the actual reply.  */
+	{
+	  struct remote_state *rs = get_remote_state ();
+
+	  /* GDB has got the reply from the remote stub.  It is safe
+	     to query notification events, because GDB isn't expecting
+	     any reply at this moment.  */
+	  if (!non_stop)
+	    remote_notif_process (rs->notif_state, &notif_client_stop);
+
+	  return buf;		/* Here's the actual reply.  */
+	}
     }
   while (1);
 }
@@ -6111,6 +6123,12 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
 						      rs->buf);
 
 	event_ptid = process_stop_reply (stop_reply, status);
+
+	/* GDB has got the reply from the remote stub.  It is safe
+	   to query notification events, because GDB isn't expecting
+	   any reply at this moment.  */
+	if (!non_stop)
+	  remote_notif_process (rs->notif_state, &notif_client_stop);
 	break;
       }
     case 'O':		/* Console output.  */
-- 
1.7.7.6


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