GDBserver
notif.h
Go to the documentation of this file.
1 /* Notification to GDB.
2  Copyright (C) 1989-2015 Free Software Foundation, Inc.
3 
4  This file is part of GDB.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 
19 #include "target.h"
20 #include "queue.h"
21 
22 /* Structure holding information related to a single event. We
23  keep a queue of these to push to GDB. It can be extended if
24  the event of given notification contains more information. */
25 
26 typedef struct notif_event
27 {
28  /* C requires that a struct or union has at least one member. */
29  char dummy;
30 } *notif_event_p;
31 
33 
34 /* A type notification to GDB. An object of 'struct notif_server'
35  represents a type of notification. */
36 
37 typedef struct notif_server
38 {
39  /* The name of ack packet, for example, 'vStopped'. */
40  const char *ack_name;
41 
42  /* The notification packet, for example, '%Stop'. Note that '%' is
43  not in 'notif_name'. */
44  const char *notif_name;
45 
46  /* A queue of events to GDB. A new notif_event can be enque'ed
47  into QUEUE at any appropriate time, and the notif_reply is
48  deque'ed only when the ack from GDB arrives. */
49  QUEUE (notif_event_p) *queue;
50 
51  /* Write event EVENT to OWN_BUF. */
52  void (*write) (struct notif_event *event, char *own_buf);
54 
55 extern struct notif_server notif_stop;
56 
57 int handle_notif_ack (char *own_buf, int packet_len);
58 void notif_write_event (struct notif_server *notif, char *own_buf);
59 
60 void notif_push (struct notif_server *np, struct notif_event *event);
61 void notif_event_enque (struct notif_server *notif,
62  struct notif_event *event);
63 
64 void initialize_notif (void);
int handle_notif_ack(char *own_buf, int packet_len)
Definition: notif.c:80
void notif_write_event(struct notif_server *notif, char *own_buf)
Definition: notif.c:62
struct notif_server * notif_server_p
const char * notif_name
Definition: notif.h:44
struct notif_event * notif_event_p
void(* write)(struct notif_event *event, char *own_buf)
Definition: notif.h:52
void notif_push(struct notif_server *np, struct notif_event *event)
Definition: notif.c:135
const char * ack_name
Definition: notif.h:40
QUEUE(notif_event_p)*queue
void initialize_notif(void)
Definition: notif.c:164
static char * own_buf
Definition: server.c:111
char dummy
Definition: notif.h:29
struct notif_server notif_stop
Definition: server.c:186
void notif_event_enque(struct notif_server *notif, struct notif_event *event)
Definition: notif.c:121
DECLARE_QUEUE_P(notif_event_p)