aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/notif.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-04-07 16:17:40 -0600
committerTom Tromey <tom@tromey.com>2019-04-19 14:29:32 -0600
commitb494cdff6922944383ef4dc20fcc90c4d823d315 (patch)
treecb98e6f414bd464bc5edb3709c1554a39c30620d /gdb/gdbserver/notif.c
parentcf250e36790aaa255bb486e2122bb83c95c7669b (diff)
downloadbinutils-b494cdff6922944383ef4dc20fcc90c4d823d315.zip
binutils-b494cdff6922944383ef4dc20fcc90c4d823d315.tar.gz
binutils-b494cdff6922944383ef4dc20fcc90c4d823d315.tar.bz2
Use std::list for event notifications in gdbserver
This changes gdbserver to use std::list rather than common/queue.h for event notifications. gdb/gdbserver/ChangeLog 2019-04-19 Tom Tromey <tom@tromey.com> * server.c (struct vstop_notif): Derive from notif_event. <base>: Remove. (queue_stop_reply): Update. (remove_all_on_match_ptid): Change type. Rewrite. (discard_queued_stop_replies): Rewrite. (in_queued_stop_replies_ptid): Change type. (in_queued_stop_replies): Rewrite. (notif_stop): Update. (queue_stop_reply_callback): Update. (captured_main): Don't call initialize_notif. (push_stop_notification): Update. * notif.c (notif_write_event, handle_notif_ack) (notif_event_enque, notif_push): Update. (notif_event_xfree, initialize_notif): Remove. * notif.h (struct notif_event): Include <list>, not "common/queue.h". (struct notif_server) <queue>: Now a std::list. (notif_event_p): Remove typedef. (initialize_notif): Don't declare. (struct notif_event): Add virtual destructor.
Diffstat (limited to 'gdb/gdbserver/notif.c')
-rw-r--r--gdb/gdbserver/notif.c37
1 files changed, 10 insertions, 27 deletions
diff --git a/gdb/gdbserver/notif.c b/gdb/gdbserver/notif.c
index d581ccc..0b526ed 100644
--- a/gdb/gdbserver/notif.c
+++ b/gdb/gdbserver/notif.c
@@ -61,10 +61,9 @@ static struct notif_server *notifs[] =
void
notif_write_event (struct notif_server *notif, char *own_buf)
{
- if (!QUEUE_is_empty (notif_event_p, notif->queue))
+ if (!notif->queue.empty ())
{
- struct notif_event *event
- = QUEUE_peek (notif_event_p, notif->queue);
+ struct notif_event *event = notif->queue.front ();
notif->write (event, own_buf);
}
@@ -98,16 +97,16 @@ handle_notif_ack (char *own_buf, int packet_len)
/* If we're waiting for GDB to acknowledge a pending event,
consider that done. */
- if (!QUEUE_is_empty (notif_event_p, np->queue))
+ if (!np->queue.empty ())
{
- struct notif_event *head
- = QUEUE_deque (notif_event_p, np->queue);
+ struct notif_event *head = np->queue.front ();
+ np->queue.pop_front ();
if (remote_debug)
debug_printf ("%s: acking %d\n", np->ack_name,
- QUEUE_length (notif_event_p, np->queue));
+ (int) np->queue.size ());
- xfree (head);
+ delete head;
}
notif_write_event (np, own_buf);
@@ -121,11 +120,11 @@ void
notif_event_enque (struct notif_server *notif,
struct notif_event *event)
{
- QUEUE_enque (notif_event_p, notif->queue, event);
+ notif->queue.push_back (event);
if (remote_debug)
debug_printf ("pending events: %s %d\n", notif->notif_name,
- QUEUE_length (notif_event_p, notif->queue));
+ (int) notif->queue.size ());
}
@@ -134,7 +133,7 @@ notif_event_enque (struct notif_server *notif,
void
notif_push (struct notif_server *np, struct notif_event *new_event)
{
- int is_first_event = QUEUE_is_empty (notif_event_p, np->queue);
+ bool is_first_event = np->queue.empty ();
/* Something interesting. Tell GDB about it. */
notif_event_enque (np, new_event);
@@ -153,19 +152,3 @@ notif_push (struct notif_server *np, struct notif_event *new_event)
putpkt_notif (buf);
}
}
-
-static void
-notif_event_xfree (struct notif_event *event)
-{
- xfree (event);
-}
-
-void
-initialize_notif (void)
-{
- int i = 0;
-
- for (i = 0; i < ARRAY_SIZE (notifs); i++)
- notifs[i]->queue
- = QUEUE_alloc (notif_event_p, notif_event_xfree);
-}