From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 8/8] RSP notification 'Test'.
Date: Tue, 11 Dec 2012 06:41:00 -0000 [thread overview]
Message-ID: <1355208017-9204-9-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1355208017-9204-1-git-send-email-yao@codesourcery.com>
This patch is only to present how do we add a new type of notifcation
in the future, and to test two types of notifications coexist together
for testing purpose. In each time GDB fetches registers, a new event
is pushed, and GDBserver will send a notification %Test to GDB.
This patch is not for committing to CVS trunk.
gdb/gdbserver:
2012-12-11 Yao Qi <yao@codesourcery.com>
* linux-low.c: Include "notif.h".
(linux_fetch_registers): Call notif_push.
* notif.c (notif_reply_test): New.
(notif_test): New variable.
(notifs): Add new element 'notif_test'.
notif.h (notif_test) Declaration.
gdb:
2012-12-11 Yao Qi <yao@codesourcery.com>
* remote-notif.c (remote_notif_parse_test): New.
(remote_notif_test_ack): New.
(remote_notif_test_alloc_event): New.
(notif_client_test): New variable.
(notifs): New element 'notif_client_test'.
---
gdb/gdbserver/linux-low.c | 10 ++++++++++
gdb/gdbserver/notif.c | 12 ++++++++++++
gdb/gdbserver/notif.h | 2 ++
gdb/remote-notif.c | 43 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c697f6b..ef4b3a9 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -20,6 +20,7 @@
#include "linux-low.h"
#include "linux-osdata.h"
#include "agent.h"
+#include "notif.h"
#include "gdb_wait.h"
#include <stdio.h>
@@ -4336,6 +4337,15 @@ linux_fetch_registers (struct regcache *regcache, int regno)
int use_regsets;
int all = 0;
+ /* Only for test. */
+ if (notif_test.queue != NULL)
+ {
+ struct notif_event *new_event
+ = xmalloc (sizeof (struct notif_event));
+
+ notif_push (¬if_test, new_event);
+ }
+
if (regno == -1)
{
if (the_low_target.fetch_register != NULL)
diff --git a/gdb/gdbserver/notif.c b/gdb/gdbserver/notif.c
index 0713b36..f9d4110 100644
--- a/gdb/gdbserver/notif.c
+++ b/gdb/gdbserver/notif.c
@@ -50,9 +50,21 @@
#include "notif.h"
+static void
+notif_reply_test (struct notif_event *event, char *own_buf)
+{
+ strcpy (own_buf, "CESHI");
+}
+
+struct notif_server notif_test =
+{
+ "vTested", "Test", NULL, notif_reply_test
+};
+
static struct notif_server *notifs[] =
{
¬if_stop,
+ ¬if_test,
};
/* Write another event or an OK, if there are no more left, to
diff --git a/gdb/gdbserver/notif.h b/gdb/gdbserver/notif.h
index e153b48..4223c0c 100644
--- a/gdb/gdbserver/notif.h
+++ b/gdb/gdbserver/notif.h
@@ -63,4 +63,6 @@ void notif_push (struct notif_server *np, struct notif_event *event);
void notif_event_enque (struct notif_server *notif,
struct notif_event *event);
+extern struct notif_server notif_test;
+
void initialize_notif (void);
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index c02394a..916e297 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -44,11 +44,54 @@
unsigned int notif_debug = 0;
+static void
+remote_notif_test_parse (struct notif_client *self, char *buf,
+ struct notif_event *event)
+{
+ if (strncmp (buf, "CESHI", 5) != 0)
+ error (_("'CESHI' is expected"));
+}
+
+static void
+remote_notif_test_ack (struct notif_client *self, char *buf,
+ struct notif_event *event)
+{
+ /* acknowledge */
+ putpkt ((char *) self->ack_command);
+}
+
+static int
+remote_notif_test_can_get_pending_events (struct notif_client *self)
+{
+ return 1;
+}
+
+static struct notif_event *
+remote_notif_test_alloc_event (void)
+{
+ struct notif_event *event = xmalloc (sizeof (struct notif_event));
+
+ event->dtr = NULL;
+
+ return event;
+}
+
+static struct notif_client notif_client_test =
+{
+ "Test", "vTested",
+ remote_notif_test_parse,
+ remote_notif_test_ack,
+ remote_notif_test_can_get_pending_events,
+ remote_notif_test_alloc_event,
+ NULL,
+};
+
/* Supported clients of notifications. */
static struct notif_client *notifs[] =
{
¬if_client_stop,
+ ¬if_client_test,
};
static void do_notif_event_xfree (void *arg);
--
1.7.7.6
next prev parent reply other threads:[~2012-12-11 6:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-11 6:40 [PATCH 0/8, V4] A general notification in GDB RSP Yao Qi
2012-12-11 6:40 ` [PATCH 2/8] de-couple %Stop from notification: gdbserver Yao Qi
2012-12-12 17:06 ` Pedro Alves
2012-12-11 6:41 ` [PATCH 4/8] command 'set debug notification' Yao Qi
2012-12-11 7:06 ` Eli Zaretskii
2012-12-12 17:57 ` Pedro Alves
2012-12-12 18:59 ` Eli Zaretskii
2012-12-12 19:17 ` Pedro Alves
2012-12-11 6:41 ` [PATCH 5/8] Different notification from packets Yao Qi
2012-12-12 18:14 ` Pedro Alves
2012-12-11 6:41 ` [PATCH 1/8] new queue.h in common/ Yao Qi
2012-12-12 17:05 ` Pedro Alves
2012-12-11 6:41 ` [PATCH 7/8] Cleanup pending queues before resume in all-stop Yao Qi
2012-12-12 18:22 ` Pedro Alves
2012-12-11 6:41 ` Yao Qi [this message]
2012-12-11 6:41 ` [PATCH 3/8] de-couple %Stop from notification: gdb Yao Qi
2012-12-12 17:32 ` Pedro Alves
2012-12-11 6:41 ` [PATCH 6/8] Handle notification for all-stop Yao Qi
2012-12-12 18:28 ` Pedro Alves
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=1355208017-9204-9-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/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