Commit | Line | Data |
---|---|---|
14a00470 | 1 | /* Notification to GDB. |
42a4f53d | 2 | Copyright (C) 1989-2019 Free Software Foundation, Inc. |
14a00470 YQ |
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 | ||
1a5c2598 TT |
19 | #ifndef GDBSERVER_NOTIF_H |
20 | #define GDBSERVER_NOTIF_H | |
21 | ||
14a00470 | 22 | #include "target.h" |
b494cdff | 23 | #include <list> |
14a00470 YQ |
24 | |
25 | /* Structure holding information related to a single event. We | |
26 | keep a queue of these to push to GDB. It can be extended if | |
27 | the event of given notification contains more information. */ | |
28 | ||
b494cdff | 29 | struct notif_event |
14a00470 | 30 | { |
b494cdff TT |
31 | virtual ~notif_event () |
32 | { | |
33 | } | |
14a00470 | 34 | |
b494cdff TT |
35 | /* No payload needed. */ |
36 | }; | |
14a00470 YQ |
37 | |
38 | /* A type notification to GDB. An object of 'struct notif_server' | |
39 | represents a type of notification. */ | |
40 | ||
41 | typedef struct notif_server | |
42 | { | |
43 | /* The name of ack packet, for example, 'vStopped'. */ | |
44 | const char *ack_name; | |
45 | ||
46 | /* The notification packet, for example, '%Stop'. Note that '%' is | |
47 | not in 'notif_name'. */ | |
48 | const char *notif_name; | |
49 | ||
50 | /* A queue of events to GDB. A new notif_event can be enque'ed | |
51 | into QUEUE at any appropriate time, and the notif_reply is | |
52 | deque'ed only when the ack from GDB arrives. */ | |
b494cdff | 53 | std::list<notif_event *> queue; |
14a00470 YQ |
54 | |
55 | /* Write event EVENT to OWN_BUF. */ | |
56 | void (*write) (struct notif_event *event, char *own_buf); | |
57 | } *notif_server_p; | |
58 | ||
59 | extern struct notif_server notif_stop; | |
60 | ||
61 | int handle_notif_ack (char *own_buf, int packet_len); | |
62 | void notif_write_event (struct notif_server *notif, char *own_buf); | |
63 | ||
64 | void notif_push (struct notif_server *np, struct notif_event *event); | |
65 | void notif_event_enque (struct notif_server *notif, | |
66 | struct notif_event *event); | |
67 | ||
1a5c2598 | 68 | #endif /* GDBSERVER_NOTIF_H */ |