notif.h 2.1 KB

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