event-top.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Definitions used by event-top.c, for GDB, the GNU debugger.
  2. Copyright (C) 1999-2022 Free Software Foundation, Inc.
  3. Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
  4. This file is part of GDB.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. #ifndef EVENT_TOP_H
  16. #define EVENT_TOP_H
  17. #include <signal.h>
  18. struct cmd_list_element;
  19. /* Exported functions from event-top.c.
  20. FIXME: these should really go into top.h. */
  21. extern void display_gdb_prompt (const char *new_prompt);
  22. extern void gdb_setup_readline (int);
  23. extern void gdb_disable_readline (void);
  24. extern void gdb_init_signals (void);
  25. extern void change_line_handler (int);
  26. extern void command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl);
  27. extern void command_handler (const char *command);
  28. #ifdef SIGTSTP
  29. extern void handle_sigtstp (int sig);
  30. #endif
  31. extern void handle_sigint (int sig);
  32. extern void handle_sigterm (int sig);
  33. extern void async_request_quit (void *arg);
  34. extern void stdin_event_handler (int error, void *client_data);
  35. extern void async_disable_stdin (void);
  36. extern void async_enable_stdin (void);
  37. /* Exported variables from event-top.c.
  38. FIXME: these should really go into top.h. */
  39. extern bool set_editing_cmd_var;
  40. extern bool exec_done_display_p;
  41. extern struct prompts the_prompts;
  42. extern void (*after_char_processing_hook) (void);
  43. extern int call_stdin_event_handler_again_p;
  44. extern void gdb_readline_no_editing_callback (void *client_data);
  45. /* Wrappers for rl_callback_handler_remove and
  46. rl_callback_handler_install that keep track of whether the callback
  47. handler is installed in readline. Do not call the readline
  48. versions directly. */
  49. extern void gdb_rl_callback_handler_remove (void);
  50. extern void gdb_rl_callback_handler_install (const char *prompt);
  51. /* Reinstall the readline callback handler (with no prompt), if not
  52. currently installed. */
  53. extern void gdb_rl_callback_handler_reinstall (void);
  54. typedef void (*segv_handler_t) (int);
  55. /* On construction, replaces the current thread's SIGSEGV handler with
  56. the provided one. On destruction, restores the handler to the
  57. original one. */
  58. class scoped_segv_handler_restore
  59. {
  60. public:
  61. scoped_segv_handler_restore (segv_handler_t new_handler);
  62. ~scoped_segv_handler_restore ();
  63. private:
  64. segv_handler_t m_old_handler;
  65. };
  66. #endif