This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/5] Process notifications when reply is got
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 24 Jan 2014 17:41:01 +0800
- Subject: [PATCH 1/5] Process notifications when reply is got
- Authentication-results: sourceware.org; auth=none
- References: <1390556465-28796-1-git-send-email-yao at codesourcery dot com>
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, ¬if_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, ¬if_client_stop);
break;
}
case 'O': /* Console output. */
--
1.7.7.6