Exemplo n.º 1
0
Arquivo: notif.c Projeto: 5kg/gdb
int
handle_notif_ack (char *own_buf, int packet_len)
{
  int i = 0;
  struct notif_server *np = NULL;

  for (i = 0; i < ARRAY_SIZE (notifs); i++)
    {
      np = notifs[i];
      if (strncmp (own_buf, np->ack_name, strlen (np->ack_name)) == 0
	  && packet_len == strlen (np->ack_name))
	break;
    }

  if (np == NULL)
    return 0;

  /* If we're waiting for GDB to acknowledge a pending event,
     consider that done.  */
  if (!QUEUE_is_empty (notif_event_p, np->queue))
    {
      struct notif_event *head
	= QUEUE_deque (notif_event_p, np->queue);

      if (remote_debug)
	fprintf (stderr, "%s: acking %d\n", np->ack_name,
		 QUEUE_length (notif_event_p, np->queue));

      xfree (head);
    }

  notif_write_event (np, own_buf);

  return 1;
}
Exemplo n.º 2
0
void
notif_event_enque (struct notif_server *notif,
		   struct notif_event *event)
{
  QUEUE_enque (notif_event_p, notif->queue, event);

  if (remote_debug)
    fprintf (stderr, "pending events: %s %d\n", notif->notif_name,
	     QUEUE_length (notif_event_p, notif->queue));

}