Пример #1
0
Файл: notif.c Проект: 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;
}
Пример #2
0
void
notif_write_event (struct notif_server *notif, char *own_buf)
{
  if (!QUEUE_is_empty (notif_event_p, notif->queue))
    {
      struct notif_event *event
	= QUEUE_peek (notif_event_p, notif->queue);

      notif->write (event, own_buf);
    }
  else
    write_ok (own_buf);
}
Пример #3
0
void
remote_notif_process (struct remote_notif_state *state,
		      struct notif_client *except)
{
  while (!QUEUE_is_empty (notif_client_p, state->notif_queue))
    {
      struct notif_client *nc = QUEUE_deque (notif_client_p,
					     state->notif_queue);

      gdb_assert (nc != except);

      if (nc->can_get_pending_events (nc))
	remote_notif_get_pending_events (nc);
    }
}
Пример #4
0
void
notif_push (struct notif_server *np, struct notif_event *new_event)
{
  int is_first_event = QUEUE_is_empty (notif_event_p, np->queue);

  /* Something interesting.  Tell GDB about it.  */
  notif_event_enque (np, new_event);

  /* If this is the first stop reply in the queue, then inform GDB
     about it, by sending a corresponding notification.  */
  if (is_first_event)
    {
      char buf[PBUFSIZ];
      char *p = buf;

      xsnprintf (p, PBUFSIZ, "%s:", np->notif_name);
      p += strlen (p);

      np->write (new_event, p);
      putpkt_notif (buf);
    }
}